Files
big-agi/pages/_app.tsx
T
Enrico Ros 23a3185696 Load PDFs on drag/drop, min-worker, dynamic import
Cleaned up the code a bit (thx gpt4), with:
 - dynamic module load: JS is chunked up and deferred to PDF loading,
   which improves all the sessions where PDFs are not loaded
 - unified path for drag/drop and 'load file' (shall call it "magic drop"
   so PDFs are text'ified upon drag/dop as well
 - fixed "not being able to load the same doc twice" (thx gpt4)
 - using minified worker, as it's loaded dynamically, we save ~50% bandwidth
2023-04-03 02:57:02 -07:00

32 lines
1.1 KiB
TypeScript

import * as React from 'react';
import Head from 'next/head';
import { Analytics as VercelAnalytics } from '@vercel/analytics/react';
import { AppProps } from 'next/app';
import { CacheProvider, EmotionCache } from '@emotion/react';
import { CssBaseline, CssVarsProvider } from '@mui/joy';
import { createEmotionCache, theme } from '@/lib/theme';
// Client-side cache, shared for the whole session of the user in the browser.
const clientSideEmotionCache = createEmotionCache();
export interface MyAppProps extends AppProps {
emotionCache?: EmotionCache;
}
export default function MyApp({ Component, emotionCache = clientSideEmotionCache, pageProps }: MyAppProps) {
return <>
<CacheProvider value={emotionCache}>
<Head>
<meta name='viewport' content='initial-scale=1, width=device-width' />
</Head>
<CssVarsProvider defaultMode='light' theme={theme}>
{/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
<CssBaseline />
<Component {...pageProps} />
</CssVarsProvider>
</CacheProvider>
<VercelAnalytics debug={false} />
</>;
}