| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import { createInertiaApp } from '@inertiajs/react';
- import { Toaster } from '@/components/ui/sonner';
- import { TooltipProvider } from '@/components/ui/tooltip';
- import { initializeTheme } from '@/hooks/use-appearance';
- import AppLayout from '@/layouts/app-layout';
- import AuthLayout from '@/layouts/auth-layout';
- import SettingsLayout from '@/layouts/settings/layout';
- import { storefrontTitlePrefix } from '@/storefront/theme';
-
- const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
-
- void createInertiaApp({
- title: (title) => {
- // A store's own pages show the store's name only, never ours.
- if (title.startsWith(storefrontTitlePrefix)) {
- return title.slice(storefrontTitlePrefix.length);
- }
-
- return title ? `${title} - ${appName}` : appName;
- },
- layout: (name) => {
- switch (true) {
- case name === 'welcome':
- case name === 'stores/preview':
- // Full pages with no dashboard around them.
- return null;
- case name.startsWith('auth/'):
- return AuthLayout;
- case name.startsWith('settings/'):
- return [AppLayout, SettingsLayout];
- default:
- return AppLayout;
- }
- },
- strictMode: true,
- withApp(app) {
- return (
- <TooltipProvider delayDuration={0}>
- {app}
- <Toaster />
- </TooltipProvider>
- );
- },
- progress: {
- color: '#4B5563',
- },
- });
-
- // This will set light / dark mode on load...
- initializeTheme();
|