Skip to content

Commit

Permalink
Page Titles (#475)
Browse files Browse the repository at this point in the history
* titles

* roadmap names

* Update site/src/pages/CoursePage/index.tsx

Co-authored-by: Jacob Sommer <js0mmer@users.noreply.github.com>

* Update site/src/component/Report/Reports.tsx

Co-authored-by: Jacob Sommer <js0mmer@users.noreply.github.com>

* Update site/src/component/Verify/Verify.tsx

Co-authored-by: Jacob Sommer <js0mmer@users.noreply.github.com>

---------

Co-authored-by: Jacob Sommer <js0mmer@users.noreply.github.com>
  • Loading branch information
ptruong0 and js0mmer committed May 20, 2024
1 parent 6234693 commit 167080a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions site/src/component/Report/Reports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const Reports: FC = () => {

useEffect(() => {
getData();
document.title = 'View Reports | PeterPortal';
}, []);

const acceptReports = async (reviewID: string) => {
Expand Down
1 change: 1 addition & 0 deletions site/src/component/Verify/Verify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const Verify: FC = () => {

useEffect(() => {
getUnverifiedReviews();
document.title = 'Verify Reviews | PeterPortal';
}, []);

const verifyReview = async (reviewID: string) => {
Expand Down
1 change: 1 addition & 0 deletions site/src/pages/CoursePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const CoursePage: FC = () => {
if (course) {
dispatch(setCourse(course as CourseGQLData));
setError('');
document.title = `${courseGQLData.department + ' ' + courseGQLData.courseNumber} | PeterPortal`;
} else {
setError(`Course ${id} does not exist!`);
}
Expand Down
1 change: 1 addition & 0 deletions site/src/pages/ProfessorPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const ProfessorPage: FC = () => {
if (professor) {
dispatch(setProfessor(professor as ProfessorGQLData));
setError('');
document.title = `${(professor as ProfessorGQLData).name} | PeterPortal`;
} else {
setError(`Professor ${id} does not exist!`);
}
Expand Down
1 change: 1 addition & 0 deletions site/src/pages/ReviewsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const ReviewsPage: FC = () => {

useEffect(() => {
checkLoggedIn();
document.title = 'Your Reviews | PeterPortal';
}, []);

if (!loaded) {
Expand Down
6 changes: 5 additions & 1 deletion site/src/pages/RoadmapPage/RoadmapMultiplan.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, useState } from 'react';
import { FC, useEffect, useState } from 'react';
import { useAppDispatch, useAppSelector } from '../../store/hooks';
import {
addRoadmapPlan,
Expand Down Expand Up @@ -90,6 +90,10 @@ const RoadmapMultiplan: FC = () => {
setEditIdx(-1);
};

useEffect(() => {
document.title = `${allPlans.plans[currentPlanIndex].name} | PeterPortal`;
}, [currentPlanIndex]);

return (
<div className="multi-plan-selector">
<Dropdown
Expand Down
7 changes: 6 additions & 1 deletion site/src/pages/SearchPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import { FC, useEffect } from 'react';
import { useParams } from 'react-router-dom';
import './SearchPage.scss';
import 'react-multi-carousel/lib/styles.css';
Expand All @@ -13,6 +13,11 @@ import { SearchIndex } from '../../types/types';

const SearchPage: FC = () => {
const { index = 'courses' } = useParams<{ index: SearchIndex }>();

useEffect(() => {
document.title = `${index === 'courses' ? 'Courses' : 'Professors'} | PeterPortal`;
}, [index]);

return (
<>
<div id="content-container">
Expand Down

0 comments on commit 167080a

Please sign in to comment.