Initial
This commit is contained in:
+27
-23
@@ -1,33 +1,37 @@
|
||||
import '../css/app.css';
|
||||
|
||||
import { createInertiaApp } from '@inertiajs/vue3';
|
||||
import { initializeTheme } from '@/composables/useAppearance';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import AuthLayout from '@/layouts/AuthLayout.vue';
|
||||
import SettingsLayout from '@/layouts/settings/Layout.vue';
|
||||
import { initializeFlashToast } from '@/lib/flashToast';
|
||||
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
|
||||
import { createApp, h } from 'vue';
|
||||
import type {DefineComponent} from 'vue';
|
||||
import MainLayout from '@/layouts/MainLayout.vue';
|
||||
import vuetify from '@/plugins/vuetify';
|
||||
|
||||
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
|
||||
|
||||
createInertiaApp({
|
||||
title: (title) => (title ? `${title} - ${appName}` : appName),
|
||||
layout: (name) => {
|
||||
switch (true) {
|
||||
case name === 'Welcome':
|
||||
return null;
|
||||
case name.startsWith('auth/'):
|
||||
return AuthLayout;
|
||||
case name.startsWith('settings/'):
|
||||
return [AppLayout, SettingsLayout];
|
||||
default:
|
||||
return AppLayout;
|
||||
}
|
||||
|
||||
resolve: (name) => {
|
||||
const page = resolvePageComponent(
|
||||
`./pages/${name}.vue`,
|
||||
import.meta.glob<DefineComponent>('./pages/**/*.vue'),
|
||||
);
|
||||
page.then((module) => {
|
||||
module.default.layout ??= MainLayout;
|
||||
});
|
||||
|
||||
return page;
|
||||
},
|
||||
|
||||
setup({ el, App, props, plugin }) {
|
||||
return createApp({ render: () => h(App, props) })
|
||||
.use(plugin)
|
||||
.use(vuetify)
|
||||
.mount(el);
|
||||
},
|
||||
|
||||
progress: {
|
||||
color: '#4B5563',
|
||||
color: '#C0392B',
|
||||
},
|
||||
});
|
||||
|
||||
// This will set light / dark mode on page load...
|
||||
initializeTheme();
|
||||
|
||||
// This will listen for flash toast data from the server...
|
||||
initializeFlashToast();
|
||||
|
||||
Reference in New Issue
Block a user