2023-07-13 10:12:31 +09:00
|
|
|
import ExitSettingsButton from './components/ExitSettingsButton';
|
2023-08-03 09:29:14 +01:00
|
|
|
import GlobalDataProvider from './components/providers/GlobalDataProvider';
|
2023-05-17 19:09:09 +02:00
|
|
|
import Heading from './admin-x-ds/global/Heading';
|
2023-05-24 16:31:02 +02:00
|
|
|
import NiceModal from '@ebay/nice-modal-react';
|
2023-08-14 14:11:53 +02:00
|
|
|
import RoutingProvider, {ExternalLink} from './components/providers/RoutingProvider';
|
2023-05-16 11:53:36 +05:30
|
|
|
import Settings from './components/Settings';
|
|
|
|
import Sidebar from './components/Sidebar';
|
2023-09-08 21:53:41 +03:00
|
|
|
import clsx from 'clsx';
|
2023-08-02 08:37:51 +01:00
|
|
|
import {GlobalDirtyStateProvider} from './hooks/useGlobalDirtyState';
|
2023-08-08 21:34:07 +01:00
|
|
|
import {OfficialTheme, ServicesProvider} from './components/providers/ServiceProvider';
|
2023-08-02 08:37:51 +01:00
|
|
|
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
|
|
|
|
import {Toaster} from 'react-hot-toast';
|
2023-08-16 18:59:31 +01:00
|
|
|
import {ZapierTemplate} from './components/settings/advanced/integrations/ZapierModal';
|
2023-05-16 11:53:36 +05:30
|
|
|
|
2023-06-01 13:23:45 +05:30
|
|
|
interface AppProps {
|
|
|
|
ghostVersion: string;
|
2023-07-13 10:12:31 +09:00
|
|
|
officialThemes: OfficialTheme[];
|
2023-08-16 18:59:31 +01:00
|
|
|
zapierTemplates: ZapierTemplate[];
|
2023-08-14 14:11:53 +02:00
|
|
|
externalNavigate: (link: ExternalLink) => void;
|
2023-09-08 21:53:41 +03:00
|
|
|
darkMode?: boolean;
|
2023-06-01 13:23:45 +05:30
|
|
|
}
|
|
|
|
|
2023-08-04 12:24:19 +01:00
|
|
|
const queryClient = new QueryClient({
|
|
|
|
defaultOptions: {
|
|
|
|
queries: {
|
|
|
|
refetchOnWindowFocus: false,
|
|
|
|
staleTime: 5 * (60 * 1000), // 5 mins
|
|
|
|
cacheTime: 10 * (60 * 1000) // 10 mins
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2023-07-31 18:27:30 +01:00
|
|
|
|
2023-09-08 21:53:41 +03:00
|
|
|
function App({ghostVersion, officialThemes, zapierTemplates, externalNavigate, darkMode = false}: AppProps) {
|
|
|
|
const appClassName = clsx(
|
|
|
|
'admin-x-settings h-[100vh] w-full overflow-y-auto',
|
|
|
|
darkMode && 'dark'
|
|
|
|
);
|
|
|
|
|
2023-05-16 11:53:36 +05:30
|
|
|
return (
|
2023-07-31 18:27:30 +01:00
|
|
|
<QueryClientProvider client={queryClient}>
|
2023-08-16 18:59:31 +01:00
|
|
|
<ServicesProvider ghostVersion={ghostVersion} officialThemes={officialThemes} zapierTemplates={zapierTemplates}>
|
2023-08-03 09:29:14 +01:00
|
|
|
<GlobalDataProvider>
|
2023-08-14 14:11:53 +02:00
|
|
|
<RoutingProvider externalNavigate={externalNavigate}>
|
2023-07-31 18:27:30 +01:00
|
|
|
<GlobalDirtyStateProvider>
|
2023-09-08 21:53:41 +03:00
|
|
|
<div className={appClassName} id="admin-x-root" style={{
|
2023-08-02 08:37:51 +01:00
|
|
|
height: '100vh',
|
|
|
|
width: '100%'
|
|
|
|
}}
|
2023-07-31 18:27:30 +01:00
|
|
|
>
|
|
|
|
<Toaster />
|
|
|
|
<NiceModal.Provider>
|
2023-09-07 14:23:26 +03:00
|
|
|
<div className='relative z-20 px-6 py-4 tablet:fixed'>
|
2023-07-31 18:27:30 +01:00
|
|
|
<ExitSettingsButton />
|
|
|
|
</div>
|
2023-05-16 11:53:36 +05:30
|
|
|
|
2023-07-31 18:27:30 +01:00
|
|
|
{/* Main container */}
|
2023-09-07 14:23:26 +03:00
|
|
|
<div className="mx-auto flex max-w-[1080px] flex-col px-[5vmin] py-[12vmin] tablet:flex-row tablet:items-start tablet:gap-x-10 tablet:py-[8vmin]" id="admin-x-settings-content">
|
2023-05-16 11:53:36 +05:30
|
|
|
|
2023-07-31 18:27:30 +01:00
|
|
|
{/* Sidebar */}
|
2023-09-07 14:23:26 +03:00
|
|
|
<div className="sticky top-[-42px] z-20 min-w-[260px] grow-0 md:top-[-52px] tablet:fixed tablet:top-[8vmin] tablet:basis-[260px]">
|
2023-09-07 17:39:30 +03:00
|
|
|
<div className='-mx-6 h-[84px] bg-white px-6 tablet:m-0 tablet:bg-transparent tablet:p-0'>
|
2023-07-31 18:27:30 +01:00
|
|
|
<Heading>Settings</Heading>
|
|
|
|
</div>
|
2023-09-08 21:53:41 +03:00
|
|
|
<div className="relative mt-[-32px] w-full overflow-x-hidden after:absolute after:inset-x-0 after:top-0 after:hidden after:h-[40px] after:bg-gradient-to-b after:from-white after:to-transparent after:content-[''] dark:after:from-black tablet:w-[260px] tablet:after:!visible tablet:after:!block">
|
2023-07-31 18:27:30 +01:00
|
|
|
<Sidebar />
|
|
|
|
</div>
|
2023-07-04 20:26:46 +05:30
|
|
|
</div>
|
2023-09-07 14:23:26 +03:00
|
|
|
<div className="relative flex-auto pt-[3vmin] tablet:ml-[300px] tablet:pt-[85px]">
|
2023-09-12 17:11:12 +03:00
|
|
|
{/* <div className='pointer-events-none fixed inset-x-0 top-0 z-[5] hidden h-[80px] bg-gradient-to-t from-transparent to-white to-60% dark:to-black tablet:!visible tablet:!block'></div> */}
|
2023-07-31 18:27:30 +01:00
|
|
|
<Settings />
|
2023-07-04 20:26:46 +05:30
|
|
|
</div>
|
2023-06-20 12:58:44 +10:00
|
|
|
</div>
|
2023-07-31 18:27:30 +01:00
|
|
|
</NiceModal.Provider>
|
|
|
|
</div>
|
|
|
|
</GlobalDirtyStateProvider>
|
|
|
|
</RoutingProvider>
|
2023-08-03 09:29:14 +01:00
|
|
|
</GlobalDataProvider>
|
2023-07-31 18:27:30 +01:00
|
|
|
</ServicesProvider>
|
|
|
|
</QueryClientProvider>
|
2023-05-16 11:53:36 +05:30
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|