From 762e86a060027fa75c6297cc0498dad3aab8ae9e Mon Sep 17 00:00:00 2001 From: Nishit Suwal <81785002+NSUWAL123@users.noreply.github.com> Date: Tue, 2 Apr 2024 23:36:08 +0545 Subject: [PATCH] fix: more informative browser tab titles/details (#1411) * feat useDocumentTitle - hook to dynamically set document title * feat documentTitle: document title add across all pages * feat projectDetails: dynamic project name display on document title --- .../ConsentDetailsForm.tsx | 2 ++ .../CreateEditOrganizationForm.tsx | 8 ++++++++ .../ManageProject/DeleteTab/index.tsx | 2 ++ .../ManageProject/EditTab/FormUpdateTab.tsx | 2 ++ .../EditTab/ProjectDescriptionTab.tsx | 2 ++ .../ManageProject/UserTab/AssignTab.tsx | 2 ++ .../ManageProject/UserTab/InviteTab.tsx | 2 ++ .../SubmissionsInfographics.tsx | 2 ++ .../ProjectSubmissions/SubmissionsTable.tsx | 2 ++ .../createnewproject/DataExtract.tsx | 3 ++- .../createnewproject/ProjectDetailsForm.tsx | 2 ++ .../createnewproject/SelectForm.tsx | 2 ++ .../createnewproject/SplitTasks.tsx | 2 ++ .../createnewproject/UploadArea.tsx | 2 ++ .../src/utilfunctions/useDocumentTitle.ts | 20 +++++++++++++++++++ .../src/views/ApproveOrganization.tsx | 2 ++ src/frontend/src/views/Home.tsx | 2 ++ src/frontend/src/views/Organisation.tsx | 2 ++ src/frontend/src/views/ProjectDetailsV2.tsx | 10 ++++++++++ src/frontend/src/views/SubmissionDetails.tsx | 2 ++ 20 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 src/frontend/src/utilfunctions/useDocumentTitle.ts diff --git a/src/frontend/src/components/CreateEditOrganization/ConsentDetailsForm.tsx b/src/frontend/src/components/CreateEditOrganization/ConsentDetailsForm.tsx index cebc2f0f1c..a83b200db2 100644 --- a/src/frontend/src/components/CreateEditOrganization/ConsentDetailsForm.tsx +++ b/src/frontend/src/components/CreateEditOrganization/ConsentDetailsForm.tsx @@ -10,8 +10,10 @@ import { useDispatch } from 'react-redux'; import { OrganisationAction } from '@/store/slices/organisationSlice'; import InstructionsSidebar from '@/components/CreateEditOrganization/InstructionsSidebar'; import { useAppSelector } from '@/types/reduxTypes'; +import useDocumentTitle from '@/utilfunctions/useDocumentTitle'; const ConsentDetailsForm = () => { + useDocumentTitle('Consent Details Form'); const navigate = useNavigate(); const dispatch = useDispatch(); diff --git a/src/frontend/src/components/CreateEditOrganization/CreateEditOrganizationForm.tsx b/src/frontend/src/components/CreateEditOrganization/CreateEditOrganizationForm.tsx index 059d6847e3..9cb889eaf1 100644 --- a/src/frontend/src/components/CreateEditOrganization/CreateEditOrganizationForm.tsx +++ b/src/frontend/src/components/CreateEditOrganization/CreateEditOrganizationForm.tsx @@ -113,6 +113,14 @@ const CreateEditOrganizationForm = ({ organizationId }: { organizationId: string handleCustomChange('fillODKCredentials', false); }, []); + useEffect(() => { + if (organizationId) { + document.title = 'Edit Organization - Field Mapping Tasking Manager'; + } else { + document.title = 'Add Organization - Field Mapping Tasking Manager'; + } + }, []); + return (