|
1 | 1 | <script lang="ts"> |
2 | 2 | import { onMount } from 'svelte'; |
3 | | - import { Router, goto } from "@mateothegreat/svelte5-router"; |
| 3 | + import { Router, goto } from '@mateothegreat/svelte5-router'; |
4 | 4 | import { Toaster } from 'svelte-sonner'; |
5 | | - import Header from "$components/Header.svelte"; |
6 | | - import Footer from "$components/Footer.svelte"; |
7 | | - import Spinner from "$components/Spinner.svelte"; |
8 | | - import ErrorDisplay from "$components/ErrorDisplay.svelte"; |
| 5 | + import Header from '$components/Header.svelte'; |
| 6 | + import Footer from '$components/Footer.svelte'; |
| 7 | + import Spinner from '$components/Spinner.svelte'; |
| 8 | + import ErrorDisplay from '$components/ErrorDisplay.svelte'; |
9 | 9 | import { themeStore } from '$stores/theme.svelte'; |
10 | 10 | import { appError } from '$stores/errorStore.svelte'; |
11 | 11 | import { authStore } from '$stores/auth.svelte'; |
|
14 | 14 | const log = logger.withTag('App'); |
15 | 15 |
|
16 | 16 | // Page components |
17 | | - import Home from "$routes/Home.svelte"; |
18 | | - import Login from "$routes/Login.svelte"; |
19 | | - import Register from "$routes/Register.svelte"; |
20 | | - import Privacy from "$routes/Privacy.svelte"; |
21 | | - import Editor from "$routes/Editor.svelte"; |
22 | | - import Settings from "$routes/Settings.svelte"; |
23 | | - import Notifications from "$routes/Notifications.svelte"; |
24 | | - import AdminEvents from "$routes/admin/AdminEvents.svelte"; |
25 | | - import AdminExecutions from "$routes/admin/AdminExecutions.svelte"; |
26 | | - import AdminSagas from "$routes/admin/AdminSagas.svelte"; |
27 | | - import AdminUsers from "$routes/admin/AdminUsers.svelte"; |
28 | | - import AdminSettings from "$routes/admin/AdminSettings.svelte"; |
| 17 | + import Home from '$routes/Home.svelte'; |
| 18 | + import Login from '$routes/Login.svelte'; |
| 19 | + import Register from '$routes/Register.svelte'; |
| 20 | + import Privacy from '$routes/Privacy.svelte'; |
| 21 | + import Editor from '$routes/Editor.svelte'; |
| 22 | + import Settings from '$routes/Settings.svelte'; |
| 23 | + import Notifications from '$routes/Notifications.svelte'; |
| 24 | + import AdminEvents from '$routes/admin/AdminEvents.svelte'; |
| 25 | + import AdminExecutions from '$routes/admin/AdminExecutions.svelte'; |
| 26 | + import AdminSagas from '$routes/admin/AdminSagas.svelte'; |
| 27 | + import AdminUsers from '$routes/admin/AdminUsers.svelte'; |
| 28 | + import AdminSettings from '$routes/admin/AdminSettings.svelte'; |
29 | 29 |
|
30 | 30 | let authInitialized = $state(false); |
31 | 31 |
|
|
61 | 61 | // Routes configuration |
62 | 62 | const routes = [ |
63 | 63 | // Public routes |
64 | | - { path: "/", component: Home }, |
65 | | - { path: "/login", component: Login }, |
66 | | - { path: "/register", component: Register }, |
67 | | - { path: "/privacy", component: Privacy }, |
| 64 | + { path: '/', component: Home }, |
| 65 | + { path: '/login', component: Login }, |
| 66 | + { path: '/register', component: Register }, |
| 67 | + { path: '/privacy', component: Privacy }, |
68 | 68 | // Protected routes |
69 | | - { path: "/editor", component: Editor, hooks: { pre: requireAuth } }, |
70 | | - { path: "/settings", component: Settings, hooks: { pre: requireAuth } }, |
71 | | - { path: "/notifications", component: Notifications, hooks: { pre: requireAuth } }, |
72 | | - { path: "/admin/events", component: AdminEvents, hooks: { pre: requireAuth } }, |
73 | | - { path: "/admin/executions", component: AdminExecutions, hooks: { pre: requireAuth } }, |
74 | | - { path: "/admin/sagas", component: AdminSagas, hooks: { pre: requireAuth } }, |
75 | | - { path: "/admin/users", component: AdminUsers, hooks: { pre: requireAuth } }, |
76 | | - { path: "/admin/settings", component: AdminSettings, hooks: { pre: requireAuth } }, |
77 | | - { path: "^/admin$", component: AdminEvents, hooks: { pre: requireAuth } }, |
| 69 | + { path: '/editor', component: Editor, hooks: { pre: requireAuth } }, |
| 70 | + { path: '/settings', component: Settings, hooks: { pre: requireAuth } }, |
| 71 | + { path: '/notifications', component: Notifications, hooks: { pre: requireAuth } }, |
| 72 | + { path: '/admin/events', component: AdminEvents, hooks: { pre: requireAuth } }, |
| 73 | + { path: '/admin/executions', component: AdminExecutions, hooks: { pre: requireAuth } }, |
| 74 | + { path: '/admin/sagas', component: AdminSagas, hooks: { pre: requireAuth } }, |
| 75 | + { path: '/admin/users', component: AdminUsers, hooks: { pre: requireAuth } }, |
| 76 | + { path: '/admin/settings', component: AdminSettings, hooks: { pre: requireAuth } }, |
| 77 | + { path: '^/admin$', component: AdminEvents, hooks: { pre: requireAuth } }, |
78 | 78 | ]; |
79 | 79 | // --8<-- [end:routes] |
80 | 80 | </script> |
|
83 | 83 | <ErrorDisplay error={appError.current.error} title={appError.current.title} /> |
84 | 84 | {:else} |
85 | 85 | <div class="flex flex-col min-h-screen bg-bg-default dark:bg-dark-bg-default pt-16"> |
86 | | - <Header/> |
| 86 | + <Header /> |
87 | 87 | <Toaster richColors position="top-right" /> |
88 | 88 | <main class="flex-grow"> |
89 | 89 | {#if !authInitialized} |
|
94 | 94 | <Router base="/" {routes} /> |
95 | 95 | {/if} |
96 | 96 | </main> |
97 | | - <Footer/> |
| 97 | + <Footer /> |
98 | 98 | </div> |
99 | 99 | {/if} |
0 commit comments