Switch to next/font.

This commit is contained in:
Mike Cao 2023-04-01 20:03:38 -07:00
parent 728e4cff5b
commit 8397102bac
7 changed files with 14 additions and 25 deletions

View File

@ -5,7 +5,6 @@ import NavBar from 'components/layout/NavBar';
import UpdateNotice from 'components/common/UpdateNotice'; import UpdateNotice from 'components/common/UpdateNotice';
import useRequireLogin from 'hooks/useRequireLogin'; import useRequireLogin from 'hooks/useRequireLogin';
import useConfig from 'hooks/useConfig'; import useConfig from 'hooks/useConfig';
import { UI_LAYOUT_BODY } from 'lib/constants';
import styles from './AppLayout.module.css'; import styles from './AppLayout.module.css';
export default function AppLayout({ title, children }) { export default function AppLayout({ title, children }) {
@ -25,14 +24,12 @@ export default function AppLayout({ title, children }) {
<Head> <Head>
<title>{title ? `${title} | umami` : 'umami'}</title> <title>{title ? `${title} | umami` : 'umami'}</title>
</Head> </Head>
<div className={styles.nav}> <nav className={styles.nav}>
<NavBar /> <NavBar />
</div> </nav>
<div className={styles.body} id={UI_LAYOUT_BODY}> <main className={styles.body}>
<Container> <Container>{children}</Container>
<main>{children}</main> </main>
</Container>
</div>
</div> </div>
); );
} }

View File

@ -17,8 +17,8 @@ export default function FilterTags({ websiteId, params }) {
} }
function handleCloseFilter(param) { function handleCloseFilter(param) {
if (param === null) { if (!param) {
router.push(`/websites/${websiteId}/?view=${view}`); router.push(`/websites/${websiteId}${view ? `?view=${view}` : ''}`);
} else { } else {
router.push(resolveUrl({ [param]: undefined })); router.push(resolveUrl({ [param]: undefined }));
} }
@ -41,7 +41,7 @@ export default function FilterTags({ websiteId, params }) {
</div> </div>
); );
})} })}
<Button size="sm" variant="quiet" onClick={() => handleCloseFilter(null)}> <Button size="sm" variant="quiet" onClick={() => handleCloseFilter()}>
<Icon> <Icon>
<Icons.Close /> <Icons.Close />
</Icon> </Icon>

View File

@ -23,8 +23,6 @@ export const DEFAULT_WEBSITE_LIMIT = 10;
export const REALTIME_RANGE = 30; export const REALTIME_RANGE = 30;
export const REALTIME_INTERVAL = 5000; export const REALTIME_INTERVAL = 5000;
export const UI_LAYOUT_BODY = 'ui-layout-body';
export const FILTER_COMBINED = 'filter-combined'; export const FILTER_COMBINED = 'filter-combined';
export const FILTER_RAW = 'filter-raw'; export const FILTER_RAW = 'filter-raw';
export const FILTER_DAY = 'filter-day'; export const FILTER_DAY = 'filter-day';

View File

@ -58,7 +58,6 @@
".next/cache" ".next/cache"
], ],
"dependencies": { "dependencies": {
"@fontsource/inter": "4.5.7",
"@prisma/client": "4.11.0", "@prisma/client": "4.11.0",
"@tanstack/react-query": "^4.16.1", "@tanstack/react-query": "^4.16.1",
"@umami/prisma-client": "^0.2.0", "@umami/prisma-client": "^0.2.0",

View File

@ -1,6 +1,7 @@
import { IntlProvider } from 'react-intl'; import { IntlProvider } from 'react-intl';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import Head from 'next/head'; import Head from 'next/head';
import { Inter } from 'next/font/google';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import useLocale from 'hooks/useLocale'; import useLocale from 'hooks/useLocale';
import useConfig from 'hooks/useConfig'; import useConfig from 'hooks/useConfig';
@ -8,11 +9,11 @@ import 'react-basics/dist/styles.css';
import 'styles/variables.css'; import 'styles/variables.css';
import 'styles/locale.css'; import 'styles/locale.css';
import 'styles/index.css'; import 'styles/index.css';
import '@fontsource/inter/400.css';
import '@fontsource/inter/700.css';
import 'chartjs-adapter-date-fns'; import 'chartjs-adapter-date-fns';
import Script from 'next/script'; import Script from 'next/script';
const inter = Inter({ subsets: ['latin'] });
const client = new QueryClient({ const client = new QueryClient({
defaultOptions: { defaultOptions: {
queries: { queries: {
@ -53,7 +54,9 @@ export default function App({ Component, pageProps }) {
<meta name="theme-color" content="#2f2f2f" media="(prefers-color-scheme: dark)" /> <meta name="theme-color" content="#2f2f2f" media="(prefers-color-scheme: dark)" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
</Head> </Head>
<Component {...pageProps} /> <div className={inter.className}>
<Component {...pageProps} />
</div>
{!pathname.includes('/share/') && <Script src={`${basePath}/telemetry.js`} />} {!pathname.includes('/share/') && <Script src={`${basePath}/telemetry.js`} />}
</IntlProvider> </IntlProvider>
</QueryClientProvider> </QueryClientProvider>

View File

@ -1,8 +1,5 @@
html, html,
body { body {
font-family: Inter, -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans,
Ubuntu, Cantrell, 'Helvetica Neue', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol';
font-size: 14px; font-size: 14px;
font-weight: normal; font-weight: normal;
line-height: 1.5rem; line-height: 1.5rem;

View File

@ -1274,11 +1274,6 @@
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.36.0.tgz#9837f768c03a1e4a30bd304a64fb8844f0e72efe" resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.36.0.tgz#9837f768c03a1e4a30bd304a64fb8844f0e72efe"
integrity sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg== integrity sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg==
"@fontsource/inter@4.5.7":
version "4.5.7"
resolved "https://registry.npmjs.org/@fontsource/inter/-/inter-4.5.7.tgz"
integrity sha512-25k3thupaOEBexuU+jAkGqieKPbuhSuA+sinDwp1iBNhqQPiJ9QHDvsXgoCgCbZ4sGlE8aCwZmSlDJrPdJHNkw==
"@formatjs/cli@^4.2.29": "@formatjs/cli@^4.2.29":
version "4.8.4" version "4.8.4"
resolved "https://registry.npmjs.org/@formatjs/cli/-/cli-4.8.4.tgz" resolved "https://registry.npmjs.org/@formatjs/cli/-/cli-4.8.4.tgz"