Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added React-Helmet for titles and wrote tests #450

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
"plugins": []
}
6 changes: 5 additions & 1 deletion src/assets/src/components/addQueue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { QueueHost, User } from "../models";
import * as api from "../services/api";
import { recordQueueManagementEvent, redirectToLogin } from "../utils";
import { confirmUserExists, queueDescriptSchema, queueNameSchema, queueLocationSchema } from "../validation";

import { Helmet } from 'react-helmet';
import { getPageTitle } from './titleUtils';

enum AvailableTabs {
General = 'general',
Expand Down Expand Up @@ -225,6 +226,9 @@ export function AddQueuePage(props: PageProps) {

return (
<div>
<Helmet>
<title>{getPageTitle('Add Queue')}</title>
</Helmet>
<LoginDialog visible={loginDialogVisible} loginUrl={props.loginUrl} />
<Breadcrumbs
intermediatePages={[{ title: 'Manage', href: '/manage/' }]}
Expand Down
7 changes: 6 additions & 1 deletion src/assets/src/components/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useState } from "react";
import { MyUser } from "../models";
import { Link } from "react-router-dom";
import { Button, Col, Form, InputGroup, Row } from "react-bootstrap";
import { Helmet } from 'react-helmet';
import { getPageTitle } from './titleUtils';

import { ErrorDisplay, FormError, JoinedQueueAlert, Breadcrumbs } from "./common";
import { PageProps } from "./page";
Expand Down Expand Up @@ -64,6 +66,9 @@ export function HomePage(props: PageProps) {
);
return (
<div>
<Helmet>
<title>{getPageTitle('Office Hours')}</title>
</Helmet>
<Breadcrumbs currentPageTitle="Home" />
<div>
{errorDisplay}
Expand All @@ -72,4 +77,4 @@ export function HomePage(props: PageProps) {
</div>
</div>
);
}
}
5 changes: 5 additions & 0 deletions src/assets/src/components/manage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import * as React from "react";
import { useState } from "react";
import { Link } from "react-router-dom";
import { Button } from "react-bootstrap";
import { Helmet } from 'react-helmet';
import { getPageTitle } from './titleUtils';

import { Breadcrumbs, checkForbiddenError, ErrorDisplay, FormError, LoginDialog, QueueTable } from "./common";
import { PageProps } from "./page";
Expand Down Expand Up @@ -47,6 +49,9 @@ export function ManagePage(props: PageProps) {
&& <ManageQueueTable queues={queues} disabled={false}/>
return (
<div>
<Helmet>
<title>{getPageTitle('Manage')}</title>
</Helmet>
<LoginDialog visible={loginDialogVisible} loginUrl={props.loginUrl} />
<Breadcrumbs currentPageTitle="Manage"/>
{errorDisplay}
Expand Down
7 changes: 6 additions & 1 deletion src/assets/src/components/preferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";
import { useState, useEffect } from "react";
import { Alert, Button, Form, FormGroup } from "react-bootstrap";
import PhoneInput from "react-phone-input-2";
import 'react-phone-input-2/lib/bootstrap.css'
import 'react-phone-input-2/lib/bootstrap.css';

import * as api from "../services/api";
import { MyUser } from "../models";
Expand All @@ -11,6 +11,8 @@ import { usePromise } from "../hooks/usePromise";
import { redirectToLogin } from "../utils";
import { PageProps } from "./page";
import { validatePhoneNumber } from "../validation";
import { Helmet } from 'react-helmet';
import { getPageTitle } from './titleUtils';

interface PreferencesEditorProps {
user: MyUser;
Expand Down Expand Up @@ -167,6 +169,9 @@ export function PreferencesPage(props: PageProps) {
);
return (
<>
<Helmet>
<title>{getPageTitle('Preferences')}</title>
</Helmet>
<LoginDialog visible={loginDialogVisible} loginUrl={props.loginUrl} />
<Breadcrumbs currentPageTitle='User Preferences' />
{errorDisplay}
Expand Down
6 changes: 5 additions & 1 deletion src/assets/src/components/queue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import * as api from "../services/api";
import { useQueueWebSocket, useUserWebSocket } from "../services/sockets";
import { addMeetingAutoAssigned, redirectToLogin } from "../utils";
import { meetingAgendaSchema } from "../validation";

import { Helmet } from 'react-helmet';
import { getPageTitle } from './titleUtils';

interface JoinQueueProps {
queue: QueueAttendee;
Expand Down Expand Up @@ -574,6 +575,9 @@ export function QueuePage(props: PageProps) {
onChangeBackend={setSelectedBackend}/>
return (
<div>
<Helmet>
<title>{getPageTitle('Queue')}</title>
</Helmet>
<Dialog {...dialogState} />
<LoginDialog visible={loginDialogVisible} loginUrl={props.loginUrl}/>
{meetingTypeDialog}
Expand Down
6 changes: 5 additions & 1 deletion src/assets/src/components/queueManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import * as api from "../services/api";
import { useQueueWebSocket, useUserWebSocket } from "../services/sockets";
import { addMeetingAutoAssigned, checkBackendAuth, recordQueueManagementEvent, redirectToLogin } from "../utils";
import { confirmUserExists, uniqnameSchema } from "../validation";

import { Helmet } from 'react-helmet';
import { getPageTitle } from './titleUtils';

interface AddAttendeeFormProps {
allowedBackends: Set<string>;
Expand Down Expand Up @@ -350,6 +351,9 @@ export function QueueManagerPage(props: PageProps) {
);
return (
<>
<Helmet>
<title>{getPageTitle('Manage Queue')}</title>
</Helmet>
<Dialog {...dialogState} />
<LoginDialog visible={loginDialogVisible} loginUrl={props.loginUrl} />
<MeetingInfoDialog backends={props.backends} meeting={visibleMeetingDialog} onClose={() => setVisibleMeetingDialog(undefined)} />
Expand Down
Loading