Files
readest/apps/readest-app/src/app/layout.tsx
T
chrox 1429f111bc Add file associations to support system "open with Readest" function, closes #1
Support passing files as command line args to Readest
2024-12-03 22:16:51 +01:00

52 lines
1.4 KiB
TypeScript

'use client';
import * as React from 'react';
import { usePathname } from 'next/navigation';
import { AuthProvider } from '@/context/AuthContext';
import { EnvProvider } from '@/context/EnvContext';
import { CSPostHogProvider } from '@/context/PHContext';
import { useTheme } from '@/hooks/useTheme';
import { checkForAppUpdates } from '@/helpers/updater';
import '../styles/globals.css';
import '../styles/fonts.css';
export default function RootLayout({ children }: { children: React.ReactNode }) {
useTheme();
const pathname = usePathname();
React.useEffect(() => {
document.documentElement.setAttribute('data-page', pathname.replace('/', '') || 'default');
}, [pathname]);
React.useEffect(() => {
const doAppUpdates = async () => {
await checkForAppUpdates();
};
doAppUpdates();
}, []);
React.useEffect(() => {
// TODO: disabled for now
// if (process.env['NODE_ENV'] === 'production') {
// document.oncontextmenu = (event) => {
// event.preventDefault();
// };
// }
}, []);
return (
<html lang='en'>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1' />
</head>
<CSPostHogProvider>
<body>
<EnvProvider>
<AuthProvider>{children}</AuthProvider>
</EnvProvider>
</body>
</CSPostHogProvider>
</html>
);
}