fix: resolve multiple el in titles

This commit is contained in:
diced 2022-10-27 21:07:44 -07:00
parent 7ac574b230
commit 4c0532006c
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1
14 changed files with 111 additions and 81 deletions

View file

@ -2,9 +2,15 @@ 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 (
<>
<Head>
<title>404 Not Found</title>
</Head>
<Stack
sx={{
display: 'flex',
@ -21,7 +27,6 @@ export default function FourOhFour() {
Head to the Dashboard
</Button>
</Stack>
</>
);
}
FourOhFour.title = 'Zipline - 404';

View file

@ -1,10 +1,16 @@
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 (
<>
<Head>
<title>500 Internal Server Error</title>
</Head>
<Stack
sx={{
display: 'flex',
@ -16,12 +22,13 @@ export default function FiveHundred() {
spacing='sm'
>
<Title sx={{ fontSize: 220, fontWeight: 900, lineHeight: 0.8 }}>500</Title>
<MutedText sx={{ fontSize: 40, fontWeight: 500 }}>Internal Server Error</MutedText>
<Tooltip label={"Take a look at Zipline's logs and the browser console for more info"}>
<MutedText>Internal server error</MutedText>
</Tooltip>
<Button component={Link} href='/dashboard'>
Head to the Dashboard
</Button>
</Stack>
</>
);
}
FiveHundred.title = 'Zipline - 500';

View file

@ -2,9 +2,15 @@ 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 (
<>
<Head>
<title>{statusCode} Error</title>
</Head>
<Stack
sx={{
display: 'flex',
@ -21,6 +27,7 @@ export default function Error({ statusCode }) {
Head to the Dashboard
</Button>
</Stack>
</>
);
}

View file

@ -59,10 +59,11 @@ export default function Login({ title, user_registration, oauth_registration, oa
})();
}, []);
const full_title = `${title} - Login`;
return (
<>
<Head>
<title>{title} - Login</title>
<title>{full_title}</title>
</Head>
<Center sx={{ height: '100vh' }}>
<div>

View file

@ -83,12 +83,11 @@ export default function Register({ code, title, user_registration }) {
}
};
const full_title = `${title} - Invite (${code || 'None'})`;
return (
<>
<Head>
<title>
{title} - Invite ({code})
</title>
<title>{title}</title>
</Head>
<Center sx={{ height: '100vh' }}>
<Box

View file

@ -4,15 +4,17 @@ import exts from 'lib/exts';
import { streamToString } from 'lib/utils/streams';
import { GetServerSideProps } from 'next';
import { checkPassword } from 'lib/util';
import config from 'lib/config';
import Head from 'next/head';
type CodeProps = {
code: string;
id: string;
};
// Code component
export default function Code({ code, id }: CodeProps) {
export default function Code({ code, id, title }) {
const full_title = `${title} - Code (${id})`;
return (
<>
<Head>
<title>{full_title}</title>
</Head>
<Prism
sx={(t) => ({ height: '100vh', backgroundColor: t.colors.dark[8] })}
withLineNumbers
@ -20,11 +22,11 @@ export default function Code({ code, id }: CodeProps) {
>
{code}
</Prism>
</>
);
}
// handle server-side rendering
export const getServerSideProps: GetServerSideProps<CodeProps> = 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<CodeProps> = async (context)
props: {
code: await streamToString(data),
id: context.params.id as string,
title: config.website.title,
},
};
};

View file

@ -11,10 +11,11 @@ export default function FilesPage(props) {
if (loading) return <LoadingOverlay visible={loading} />;
const title = `${props.title} - Files`;
return (
<>
<Head>
<title>{props.title} - Files</title>
<title>{title}</title>
</Head>
<Layout props={props}>

View file

@ -20,10 +20,11 @@ export default function InvitesPage(props) {
if (loading) return <LoadingOverlay visible={loading} />;
const title = `${props.title} - Invites`;
return (
<>
<Head>
<title>{props.title} - Invites</title>
<title>{title}</title>
</Head>
<Layout props={props}>
<Invites />

View file

@ -11,10 +11,11 @@ export default function ManagePage(props) {
if (loading) return <LoadingOverlay visible={loading} />;
const title = `${props.title} - Manage User`;
return (
<>
<Head>
<title>{props.title} - Manage User</title>
<title>{title}</title>
</Head>
<Layout props={props}>
<Manage />

View file

@ -11,10 +11,11 @@ export default function StatsPage(props) {
if (loading) return <LoadingOverlay visible={loading} />;
const title = `${props.title} - Statistics`;
return (
<>
<Head>
<title>{props.title} - Stats</title>
<title>{title}</title>
</Head>
<Layout props={props}>
<Stats />

View file

@ -11,10 +11,11 @@ export default function UploadTextPage(props) {
if (loading) return <LoadingOverlay visible={loading} />;
const title = `${props.title} - Upload Text`;
return (
<>
<Head>
<title>{props.title} - Upload Text</title>
<title>{title}</title>
</Head>
<Layout props={props}>
<UploadText />

View file

@ -11,10 +11,11 @@ export default function UploadPage(props) {
if (loading) return <LoadingOverlay visible={loading} />;
const title = `${props.title} - Upload`;
return (
<>
<Head>
<title>{props.title} - Upload</title>
<title>{title}</title>
</Head>
<Layout props={props}>
<Upload chunks={{ chunks_size: props.chunks_size, max_size: props.max_size }} />

View file

@ -11,10 +11,11 @@ export default function UrlsPage(props) {
if (loading) return <LoadingOverlay visible={loading} />;
const title = `${props.title} - URLs`;
return (
<>
<Head>
<title>{props.title} - URLs</title>
<title>{title}</title>
</Head>
<Layout props={props}>
<Urls />

View file

@ -11,10 +11,11 @@ export default function UsersPage(props) {
if (loading) return <LoadingOverlay visible={loading} />;
const title = `${props.title} - User`;
return (
<>
<Head>
<title>{props.title} - Users</title>
<title>{title}</title>
</Head>
<Layout props={props}>
<Users />