From 4c0532006c3b9c3366c04b44e8881696dc4b7499 Mon Sep 17 00:00:00 2001 From: diced Date: Thu, 27 Oct 2022 21:07:44 -0700 Subject: [PATCH] fix: resolve multiple el in titles --- src/pages/404.tsx | 41 +++++++++++++++++------------- src/pages/500.tsx | 45 +++++++++++++++++++-------------- src/pages/_error.tsx | 39 ++++++++++++++++------------ src/pages/auth/login.tsx | 3 ++- src/pages/auth/register.tsx | 5 ++-- src/pages/code/[id].tsx | 35 +++++++++++++------------ src/pages/dashboard/files.tsx | 3 ++- src/pages/dashboard/invites.tsx | 3 ++- src/pages/dashboard/manage.tsx | 3 ++- src/pages/dashboard/stats.tsx | 3 ++- src/pages/dashboard/text.tsx | 3 ++- src/pages/dashboard/upload.tsx | 3 ++- src/pages/dashboard/urls.tsx | 3 ++- src/pages/dashboard/users.tsx | 3 ++- 14 files changed, 111 insertions(+), 81 deletions(-) diff --git a/src/pages/404.tsx b/src/pages/404.tsx index 593f842..7b4fbf4 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -2,26 +2,31 @@ import React from 'react'; import { Button, Stack, Title } from '@mantine/core'; import Link from 'components/Link'; import MutedText from 'components/MutedText'; +import Head from 'next/head'; export default function FourOhFour() { return ( - - 404 - This page does not exist! - - + <> + + 404 Not Found + + + + 404 + This page does not exist! + + + ); } - -FourOhFour.title = 'Zipline - 404'; diff --git a/src/pages/500.tsx b/src/pages/500.tsx index 68852cf..5555be1 100644 --- a/src/pages/500.tsx +++ b/src/pages/500.tsx @@ -1,27 +1,34 @@ import React from 'react'; -import { Button, Stack, Title } from '@mantine/core'; +import { Button, Stack, Title, Tooltip } from '@mantine/core'; import Link from 'components/Link'; import MutedText from 'components/MutedText'; +import Head from 'next/head'; export default function FiveHundred() { return ( - - 500 - Internal Server Error - - + <> + + 500 Internal Server Error + + + + 500 + + Internal server error + + + + ); } - -FiveHundred.title = 'Zipline - 500'; diff --git a/src/pages/_error.tsx b/src/pages/_error.tsx index b67562e..d577ad1 100644 --- a/src/pages/_error.tsx +++ b/src/pages/_error.tsx @@ -2,25 +2,32 @@ import React from 'react'; import { Button, Stack, Title } from '@mantine/core'; import Link from 'components/Link'; import MutedText from 'components/MutedText'; +import Head from 'next/head'; export default function Error({ statusCode }) { return ( - - {statusCode} - Something went wrong... - - + <> + + {statusCode} Error + + + + {statusCode} + Something went wrong... + + + ); } diff --git a/src/pages/auth/login.tsx b/src/pages/auth/login.tsx index 23311f4..bd2e660 100644 --- a/src/pages/auth/login.tsx +++ b/src/pages/auth/login.tsx @@ -59,10 +59,11 @@ export default function Login({ title, user_registration, oauth_registration, oa })(); }, []); + const full_title = `${title} - Login`; return ( <> - {title} - Login + {full_title}
diff --git a/src/pages/auth/register.tsx b/src/pages/auth/register.tsx index 2fe828a..d1e6dc7 100644 --- a/src/pages/auth/register.tsx +++ b/src/pages/auth/register.tsx @@ -83,12 +83,11 @@ export default function Register({ code, title, user_registration }) { } }; + const full_title = `${title} - Invite (${code || 'None'})`; return ( <> - - {title} - Invite ({code}) - + {title}
({ height: '100vh', backgroundColor: t.colors.dark[8] })} - withLineNumbers - language={exts[id.split('.').pop()]?.toLowerCase()} - > - {code} - + <> + + {full_title} + + + ({ height: '100vh', backgroundColor: t.colors.dark[8] })} + withLineNumbers + language={exts[id.split('.').pop()]?.toLowerCase()} + > + {code} + + ); } -// handle server-side rendering -export const getServerSideProps: GetServerSideProps = async (context) => { +export const getServerSideProps: GetServerSideProps = async (context) => { if (process.env.ZIPLINE_DOCKER_BUILD) return { props: { code: '', id: '' } }; const { default: datasource } = await import('lib/datasource'); @@ -58,6 +60,7 @@ export const getServerSideProps: GetServerSideProps = async (context) props: { code: await streamToString(data), id: context.params.id as string, + title: config.website.title, }, }; }; diff --git a/src/pages/dashboard/files.tsx b/src/pages/dashboard/files.tsx index cfe02a7..213c6d7 100644 --- a/src/pages/dashboard/files.tsx +++ b/src/pages/dashboard/files.tsx @@ -11,10 +11,11 @@ export default function FilesPage(props) { if (loading) return ; + const title = `${props.title} - Files`; return ( <> - {props.title} - Files + {title} diff --git a/src/pages/dashboard/invites.tsx b/src/pages/dashboard/invites.tsx index edae602..f007dd5 100644 --- a/src/pages/dashboard/invites.tsx +++ b/src/pages/dashboard/invites.tsx @@ -20,10 +20,11 @@ export default function InvitesPage(props) { if (loading) return ; + const title = `${props.title} - Invites`; return ( <> - {props.title} - Invites + {title} diff --git a/src/pages/dashboard/manage.tsx b/src/pages/dashboard/manage.tsx index a37d2ca..876f258 100644 --- a/src/pages/dashboard/manage.tsx +++ b/src/pages/dashboard/manage.tsx @@ -11,10 +11,11 @@ export default function ManagePage(props) { if (loading) return ; + const title = `${props.title} - Manage User`; return ( <> - {props.title} - Manage User + {title} diff --git a/src/pages/dashboard/stats.tsx b/src/pages/dashboard/stats.tsx index 135d29b..7c39b46 100644 --- a/src/pages/dashboard/stats.tsx +++ b/src/pages/dashboard/stats.tsx @@ -11,10 +11,11 @@ export default function StatsPage(props) { if (loading) return ; + const title = `${props.title} - Statistics`; return ( <> - {props.title} - Stats + {title} diff --git a/src/pages/dashboard/text.tsx b/src/pages/dashboard/text.tsx index e92608d..a3e2c2e 100644 --- a/src/pages/dashboard/text.tsx +++ b/src/pages/dashboard/text.tsx @@ -11,10 +11,11 @@ export default function UploadTextPage(props) { if (loading) return ; + const title = `${props.title} - Upload Text`; return ( <> - {props.title} - Upload Text + {title} diff --git a/src/pages/dashboard/upload.tsx b/src/pages/dashboard/upload.tsx index 4cc2770..8b452db 100644 --- a/src/pages/dashboard/upload.tsx +++ b/src/pages/dashboard/upload.tsx @@ -11,10 +11,11 @@ export default function UploadPage(props) { if (loading) return ; + const title = `${props.title} - Upload`; return ( <> - {props.title} - Upload + {title} diff --git a/src/pages/dashboard/urls.tsx b/src/pages/dashboard/urls.tsx index 0a453b1..90e55a9 100644 --- a/src/pages/dashboard/urls.tsx +++ b/src/pages/dashboard/urls.tsx @@ -11,10 +11,11 @@ export default function UrlsPage(props) { if (loading) return ; + const title = `${props.title} - URLs`; return ( <> - {props.title} - URLs + {title} diff --git a/src/pages/dashboard/users.tsx b/src/pages/dashboard/users.tsx index 8d61e22..74385ed 100644 --- a/src/pages/dashboard/users.tsx +++ b/src/pages/dashboard/users.tsx @@ -11,10 +11,11 @@ export default function UsersPage(props) { if (loading) return ; + const title = `${props.title} - User`; return ( <> - {props.title} - Users + {title}