mirror of
https://github.com/diced/zipline.git
synced 2025-12-12 07:40:45 -08:00
feat: support website title
This commit is contained in:
@@ -29,13 +29,19 @@ const fetcher = async (url: RequestInfo | URL) => {
|
||||
return res.json();
|
||||
};
|
||||
|
||||
export default function App({ Component, pageProps }: AppProps) {
|
||||
export default function App({
|
||||
Component,
|
||||
pageProps,
|
||||
}: AppProps & { Component: AppProps['Component'] & { title: string } }) {
|
||||
const themes: ZiplineTheme[] = pageProps.themes;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Zipline</title>
|
||||
<title>
|
||||
{pageProps?.config?.website?.title ?? 'Zipline'}
|
||||
{Component.title ? ` – ${Component.title}` : ''}
|
||||
</title>
|
||||
<meta name='viewport' content='minimum-scale=1, initial-scale=1, width=device-width' />
|
||||
<link rel='manifest' href='/manifest.json' />
|
||||
<link rel='icon' type='image/png' href='/favicon' />
|
||||
|
||||
@@ -350,3 +350,5 @@ export const getServerSideProps = withSafeConfig(async () => {
|
||||
|
||||
return {};
|
||||
});
|
||||
|
||||
Login.title = 'Login';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useRouter } from 'next/router';
|
||||
import { useEffect } from 'react';
|
||||
import { mutate } from 'swr';
|
||||
|
||||
export default function Login() {
|
||||
export default function Logout() {
|
||||
const router = useRouter();
|
||||
const setUser = useUserStore((state) => state.setUser);
|
||||
|
||||
@@ -31,3 +31,5 @@ export default function Login() {
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Logout.title = 'Logout';
|
||||
|
||||
@@ -199,3 +199,5 @@ export const getServerSideProps = withSafeConfig<{
|
||||
invite: invite as unknown as Invite,
|
||||
};
|
||||
});
|
||||
|
||||
Register.title = 'Register';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Container } from '@mantine/core';
|
||||
import { readFile } from 'fs/promises';
|
||||
import { InferGetServerSidePropsType } from 'next';
|
||||
|
||||
export default function Login({ tos }: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
||||
export default function TermsOfService({ tos }: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
||||
return (
|
||||
<Container my='md'>
|
||||
<Markdown md={tos!} />
|
||||
@@ -18,9 +18,17 @@ export const getServerSideProps = withSafeConfig(async (_, config) => {
|
||||
notFound: true,
|
||||
};
|
||||
|
||||
const file = await readFile(config.website.tos, 'utf8');
|
||||
try {
|
||||
const file = await readFile(config.website.tos, 'utf8');
|
||||
|
||||
return {
|
||||
tos: file,
|
||||
};
|
||||
return {
|
||||
tos: file,
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
notFound: true,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
TermsOfService.title = 'Terms of Service';
|
||||
|
||||
@@ -48,3 +48,5 @@ export const getServerSideProps = withSafeConfig(async (ctx) => {
|
||||
|
||||
return {};
|
||||
});
|
||||
|
||||
DashboardAdminInvites.title = 'Invites';
|
||||
|
||||
@@ -47,3 +47,5 @@ export const getServerSideProps = withSafeConfig(async (ctx) => {
|
||||
|
||||
return {};
|
||||
});
|
||||
|
||||
DashboardAdminSettings.title = 'Server Settings';
|
||||
|
||||
@@ -8,6 +8,7 @@ import { canInteract } from '@/lib/role';
|
||||
import { getSession } from '@/server/session';
|
||||
import { LoadingOverlay } from '@mantine/core';
|
||||
import { InferGetServerSidePropsType } from 'next';
|
||||
import Head from 'next/head';
|
||||
|
||||
export default function DashboardAdminUsersId({
|
||||
user,
|
||||
@@ -18,9 +19,16 @@ export default function DashboardAdminUsersId({
|
||||
if (!user) return null;
|
||||
|
||||
return (
|
||||
<Layout config={config}>
|
||||
<ViewFiles user={user} />
|
||||
</Layout>
|
||||
<>
|
||||
<Head>
|
||||
<title>
|
||||
{config.website.title ?? 'Zipline'} – {user.username}"s files
|
||||
</title>
|
||||
</Head>
|
||||
<Layout config={config}>
|
||||
<ViewFiles user={user} />
|
||||
</Layout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,3 +48,5 @@ export const getServerSideProps = withSafeConfig(async (ctx) => {
|
||||
|
||||
return {};
|
||||
});
|
||||
|
||||
DashboardAdminUsers.title = 'Users';
|
||||
|
||||
@@ -19,3 +19,5 @@ export default function DashboardFilesPage({
|
||||
}
|
||||
|
||||
export const getServerSideProps = withSafeConfig();
|
||||
|
||||
DashboardFilesPage.title = 'Files';
|
||||
|
||||
@@ -19,3 +19,5 @@ export default function DashboardFoldersPage({
|
||||
}
|
||||
|
||||
export const getServerSideProps = withSafeConfig();
|
||||
|
||||
DashboardFoldersPage.title = 'Folders';
|
||||
|
||||
@@ -28,3 +28,5 @@ export default function DashboardMetricsPage({
|
||||
}
|
||||
|
||||
export const getServerSideProps = withSafeConfig();
|
||||
|
||||
DashboardMetricsPage.title = 'Metrics';
|
||||
|
||||
@@ -19,3 +19,5 @@ export default function DashboardUserSettings({
|
||||
}
|
||||
|
||||
export const getServerSideProps = withSafeConfig();
|
||||
|
||||
DashboardUserSettings.title = 'Settings';
|
||||
|
||||
@@ -32,3 +32,5 @@ export default function DashboardUploadFile({
|
||||
}
|
||||
|
||||
export const getServerSideProps = withSafeConfig();
|
||||
|
||||
DashboardUploadFile.title = 'Upload';
|
||||
|
||||
@@ -47,3 +47,5 @@ export const getServerSideProps = withSafeConfig<{
|
||||
codeMeta,
|
||||
};
|
||||
});
|
||||
|
||||
DashboardUploadText.title = 'Upload Text';
|
||||
|
||||
@@ -19,3 +19,5 @@ export default function DashboardUrlsPage({
|
||||
}
|
||||
|
||||
export const getServerSideProps = withSafeConfig();
|
||||
|
||||
DashboardUrlsPage.title = 'URLs';
|
||||
|
||||
@@ -5,12 +5,21 @@ import { Folder, cleanFolder } from '@/lib/db/models/folder';
|
||||
import { withSafeConfig } from '@/lib/middleware/next/withSafeConfig';
|
||||
import { Container, SimpleGrid, Title } from '@mantine/core';
|
||||
import { InferGetServerSidePropsType } from 'next';
|
||||
import Head from 'next/head';
|
||||
|
||||
export default function ViewFolderId({ folder }: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
||||
export default function ViewFolderId({
|
||||
folder,
|
||||
config,
|
||||
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
||||
if (!folder) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>
|
||||
{config.website.title ?? 'Zipline'} – {folder.name}
|
||||
</title>
|
||||
</Head>
|
||||
<Container>
|
||||
<Title order={1}>{folder.name}</Title>
|
||||
|
||||
|
||||
@@ -245,3 +245,5 @@ export const getServerSideProps: GetServerSideProps = async () => {
|
||||
props: {},
|
||||
};
|
||||
};
|
||||
|
||||
Setup.title = 'Setup';
|
||||
|
||||
Reference in New Issue
Block a user