From aab9906be0502dda2632c57bcad67f30d7f23750 Mon Sep 17 00:00:00 2001 From: Samuel Rowe Date: Tue, 19 Jul 2022 23:21:55 +0530 Subject: [PATCH] feat(frontend): generate random project names --- services/frontend/src/components/Project/index.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/services/frontend/src/components/Project/index.tsx b/services/frontend/src/components/Project/index.tsx index edf52dc..194e993 100644 --- a/services/frontend/src/components/Project/index.tsx +++ b/services/frontend/src/components/Project/index.tsx @@ -3,6 +3,7 @@ import { useParams } from "react-router-dom"; import { debounce, Dictionary, omit } from "lodash"; import YAML from "yaml"; import { PlusIcon } from "@heroicons/react/solid"; +import randomWords from "random-words"; import { IProjectPayload, IServiceNodeItem, @@ -70,7 +71,15 @@ export default function Project() { const [nodes, setNodes] = useState({}); const [connections, setConnections] = useState<[[string, string]] | []>([]); const [networks, setNetworks] = useState>({}); - const [projectName, setProjectName] = useState("Untitled"); + const [projectName, setProjectName] = useState( + () => + randomWords({ + wordsPerString: 2, + exactly: 1, + separator: "-" + } as any)[0] + ); + const [canvasPosition, setCanvasPosition] = useState({ top: 0, left: 0, @@ -398,7 +407,7 @@ export default function Project() { focus:ring-0 `} type="text" - placeholder="Untitled" + placeholder="Project name" autoComplete="off" id="name" name="name"