diff --git a/app/public/src/components/Navbar.jsx b/app/public/src/components/Navbar.jsx index 8aa6516..9fdd1b8 100644 --- a/app/public/src/components/Navbar.jsx +++ b/app/public/src/components/Navbar.jsx @@ -20,12 +20,12 @@ function Navbar() {
- Home - About Us - Committees - Resources - Sponsors - Registers + Home + About Us + Committees + Resources + Sponsors + Register
diff --git a/app/public/src/hooks/useDocumentTitle.jsx b/app/public/src/hooks/useDocumentTitle.jsx new file mode 100644 index 0000000..48bee96 --- /dev/null +++ b/app/public/src/hooks/useDocumentTitle.jsx @@ -0,0 +1,11 @@ +import React, {useEffect} from 'react'; + +function useDocumentTitle(title) { + useEffect(() => { + const oldTitle = document.title; + document.title = title; + return () => document.title = oldTitle; + }, [title]); +}; + +export default useDocumentTitle \ No newline at end of file diff --git a/app/public/src/pages/AboutUs.jsx b/app/public/src/pages/AboutUs.jsx index dfb60d3..1b91434 100644 --- a/app/public/src/pages/AboutUs.jsx +++ b/app/public/src/pages/AboutUs.jsx @@ -2,10 +2,13 @@ import React from 'react'; import UserCard from '../components/UserCard.jsx'; import useStaticData from '../hooks/useStaticData.jsx'; import './AboutUs.css'; +import useDocumentTitle from '../hooks/useDocumentTitle.jsx'; function AboutUs() { + useDocumentTitle("About Us"); const secretariat = useStaticData("/data/secretariat.json", []); + return (
diff --git a/app/public/src/pages/CommitteeDetails.jsx b/app/public/src/pages/CommitteeDetails.jsx index a971905..24e6b6d 100644 --- a/app/public/src/pages/CommitteeDetails.jsx +++ b/app/public/src/pages/CommitteeDetails.jsx @@ -5,6 +5,7 @@ import NoPage from './NoPage.jsx'; import './CommitteeDetails.css'; import UserCard from '../components/UserCard.jsx'; import FormattedParagraph from '../components/FormattedParagraph.jsx'; +import useDocumentTitle from '../hooks/useDocumentTitle.jsx'; function findCommittee(committeeGroups, queryId) { for (const group of committeeGroups) { @@ -23,6 +24,7 @@ export default function CommitteeDetails() { const committeeGroups = useStaticData('/data/committees.json'); const {id} = useParams(); if (!committeeGroups) { + useDocumentTitle(""); return null; } @@ -32,6 +34,7 @@ export default function CommitteeDetails() { return } + useDocumentTitle(committee.committee_name); const isOneChair = committee.co_chair_name == null; diff --git a/app/public/src/pages/Committees.jsx b/app/public/src/pages/Committees.jsx index 8ed109c..959f37d 100644 --- a/app/public/src/pages/Committees.jsx +++ b/app/public/src/pages/Committees.jsx @@ -2,9 +2,12 @@ import React from 'react'; import useStaticData from '../hooks/useStaticData.jsx'; import Committee from '../components/Commitee'; import './Committees.css'; +import useDocumentTitle from '../hooks/useDocumentTitle.jsx'; function Committees() { + useDocumentTitle("Committees"); const committeeGroups = useStaticData("/data/committees.json", []); + return (
diff --git a/app/public/src/pages/Home.jsx b/app/public/src/pages/Home.jsx index ab0c750..0736abf 100644 --- a/app/public/src/pages/Home.jsx +++ b/app/public/src/pages/Home.jsx @@ -1,8 +1,11 @@ import React from 'react'; import './Home.css'; import { Link } from 'react-router-dom'; +import useDocumentTitle from '../hooks/useDocumentTitle'; function Home() { + useDocumentTitle("VTMUNC"); + return (
diff --git a/app/public/src/pages/NoPage.jsx b/app/public/src/pages/NoPage.jsx index c68719c..4791739 100644 --- a/app/public/src/pages/NoPage.jsx +++ b/app/public/src/pages/NoPage.jsx @@ -1,6 +1,7 @@ import React from 'react'; function NoPage() { + useDocumentTitle("Page not found"); return (

Error 404: Page not found

diff --git a/app/public/src/pages/Register.jsx b/app/public/src/pages/Register.jsx index 5de1048..016e131 100644 --- a/app/public/src/pages/Register.jsx +++ b/app/public/src/pages/Register.jsx @@ -2,6 +2,7 @@ import React from 'react'; import {useState} from 'react'; import './Register.css'; import { useNavigate } from 'react-router-dom'; +import useDocumentTitle from '../hooks/useDocumentTitle'; function isValidEmail(email) { const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; @@ -9,6 +10,7 @@ function isValidEmail(email) { } function Register() { + useDocumentTitle("Register"); const [formData, setFormData] = useState({ advisorEmail: "",