From 376dae3edb77664cb6a0719a5916f8300a222eac Mon Sep 17 00:00:00 2001 From: Samuel Rowe Date: Fri, 29 Jul 2022 22:41:13 +0530 Subject: [PATCH 1/3] feat: updated `index.html` title --- services/frontend/public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/frontend/public/index.html b/services/frontend/public/index.html index aa069f2..2745ea3 100644 --- a/services/frontend/public/index.html +++ b/services/frontend/public/index.html @@ -24,7 +24,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - React App + Container Toolkit From a8607588a1f18caa7c6f78e18451f4ab09207e63 Mon Sep 17 00:00:00 2001 From: Samuel Rowe Date: Fri, 29 Jul 2022 22:41:32 +0530 Subject: [PATCH 2/3] feat: created `useTitle` hook --- services/frontend/src/hooks/index.ts | 1 + services/frontend/src/hooks/useTitle.ts | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 services/frontend/src/hooks/index.ts create mode 100644 services/frontend/src/hooks/useTitle.ts diff --git a/services/frontend/src/hooks/index.ts b/services/frontend/src/hooks/index.ts new file mode 100644 index 0000000..19097ee --- /dev/null +++ b/services/frontend/src/hooks/index.ts @@ -0,0 +1 @@ +export * from "./useTitle"; diff --git a/services/frontend/src/hooks/useTitle.ts b/services/frontend/src/hooks/useTitle.ts new file mode 100644 index 0000000..85e8210 --- /dev/null +++ b/services/frontend/src/hooks/useTitle.ts @@ -0,0 +1,7 @@ +import { useEffect } from "react"; + +export const useTitle = (title: string) => { + useEffect(() => { + document.title = title; + }, [title]); +}; From 89f030a420c064aba447bb0e60c4334887fdfeca Mon Sep 17 00:00:00 2001 From: Samuel Rowe Date: Fri, 29 Jul 2022 22:51:50 +0530 Subject: [PATCH 3/3] feat: udated title for open project --- services/frontend/src/components/Project/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/frontend/src/components/Project/index.tsx b/services/frontend/src/components/Project/index.tsx index 9825055..6cf043d 100644 --- a/services/frontend/src/components/Project/index.tsx +++ b/services/frontend/src/components/Project/index.tsx @@ -39,6 +39,7 @@ import ModalNetwork from "../Modal/network"; import CreateVolumeModal from "../Modal/volume/CreateVolumeModal"; import EditVolumeModal from "../Modal/volume/EditVolumeModal"; import CodeEditor from "../CodeEditor"; +import { useTitle } from "../../hooks"; export default function Project() { const { uuid } = useParams<{ uuid: string }>(); @@ -96,6 +97,13 @@ export default function Project() { } ); + useTitle( + [ + isFetching ? "" : data ? data.name : "New project", + "Container Toolkit" + ].join(" | ") + ); + stateNodesRef.current = nodes; stateConnectionsRef.current = connections; stateNetworksRef.current = networks;