Skip to content

Commit

Permalink
Add Page Titles
Browse files Browse the repository at this point in the history
  • Loading branch information
theADAMJR committed Aug 10, 2021
1 parent 05253c8 commit ccdafc4
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
-->
<title>DClone - Essential</title>
<title>DClone | Discord Clone With the Essentials</title>

<!-- External -->
<link href="http://fonts.cdnfonts.com/css/whitney-2" rel="stylesheet">
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/pages/guild-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ const GuildPage: React.FunctionComponent = () => {
const guild = useSelector(getGuild(guildId));
const channel = useSelector(getChannel(guildId, channelId));

document.title = channel?.name ?? guild?.name ?? 'DClone';

useEffect(() => {
dispatch(pageSwitched({ channel, guild }));
}, [guild, channel]);
Expand All @@ -30,7 +28,7 @@ const GuildPage: React.FunctionComponent = () => {
}

return (ui.activeGuild) ? (
<PageWrapper>
<PageWrapper pageTitle={channel?.name ?? guild.name}>
<Sidebar />
{(channel)
? <div className="bg-bg-primary">
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/pages/home-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import PageWrapper from './page-wrapper';
import './home-page.scoped.css';

const HomePage: React.FunctionComponent = () => {
document.title = 'DClone | Discord clone with the essential features';

return (
<PageWrapper className="bg-bg-tertiary h-full">
<PageWrapper
className="bg-bg-tertiary h-full"
pageTitle="DClone | Discord Clone With the Essentials">
<Navbar />
<section className="text-center my-4">
<h1>It's time to ditch Skype and TeamSpeak.</h1>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/pages/loading-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const LoadingPage: React.FunctionComponent = () => {
const randomIndex = Math.floor(Math.random() * tips.length);

return (
<PageWrapper className="flex items-center justify-center h-screen">
<PageWrapper
pageTitle="Loading..."
className="flex items-center justify-center h-screen">
<div className="text-center">
<h1 className="text-3xl">Loading...</h1>
<p className="lead block">{tips[randomIndex]}</p>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/login-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const LoginPage: React.FunctionComponent = () => {
return (user)
? <Redirect to="/channels/@me" />
: (
<PageWrapper>
<PageWrapper pageTitle="DClone | Login">
<div className="flex items-center absolute justify-center h-screen">
<form
className="rounded-md shadow bg-bg-primary p-8"
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/components/pages/not-found-page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import Particles from 'react-particles-js';
import { Link } from 'react-router-dom';
import CircleButton from '../utils/buttons/circle-button';
import PageWrapper from './page-wrapper';

const NotFoundPage: React.FunctionComponent = () => {
return (
<div className="relative w-screen h-screen">
<PageWrapper
className="relative w-screen h-screen"
pageTitle="DClone | Not Found">
<header className="absolute text-center bottom-1/2 right-1/2">
<h1 className="text-4xl pb-3">Not Found</h1>
<Link to="/">
<CircleButton>Return Home</CircleButton>
</Link>
</header>
<Particles width="100%" height="100%" />
</div>
</PageWrapper>
);
}

Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/pages/overview-page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useDispatch } from 'react-redux';
import { pageSwitched } from '../../store/ui';
import AppNavbar from '../navigation/app-navbar';
import Sidebar from '../navigation/sidebar/sidebar';
Expand All @@ -13,7 +13,9 @@ const OverviewPage: React.FunctionComponent = () => {
}, []);

return (
<PageWrapper className="bg-bg-primary h-full w-full">
<PageWrapper
className="bg-bg-primary h-full w-full"
pageTitle="DClone">
<Sidebar />
<AppNavbar />
<div className="bg-bg-primary h-full w-full flex flex-col flex-grow"></div>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/pages/page-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const PageWrapper: React.FunctionComponent<PageWrapperProps> = (props) => {

useEffect(() => {
dispatch(ready());
document.title = props.pageTitle ?? 'DClone';
}, []);

return (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/theme/discord-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ textarea {
background-color: var(--bg-textarea);
}

:not(nav a)a[href] {
:not(nav a)[href] {
color: var(--link);
}
nav a {
Expand Down

0 comments on commit ccdafc4

Please sign in to comment.