tethys.backend/resources/js/app.ts
Arno Kaimbacher 9368a0dd8d
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 40s
Squashed commit of the following:
commit 579f0878e5240dc17db69be1e0b0c0f5af7ef9fe
Author: Arno Kaimbacher <arno.kaimbacher@geosphere.at>
Date:   Tue Jun 9 09:25:44 2026 +0200

    feat: Refactor error handling in Dataset Edit form and improve validation messages

    - Updated error handling in the Dataset Edit form to use a centralized formatError function for displaying validation messages.
    - Enhanced user feedback by ensuring that error messages are displayed consistently across various fields.
    - Modified the validation rule for arrayContainsTypes to provide clearer error messages for missing main and translated titles/abstracts.
    - Introduced a new ValidationService to manage manual construction of validation errors.
    - Updated Vite configuration to streamline asset loading and improve performance.
    - Adjusted Inertia setup to utilize dynamic imports for page-specific assets.
    - Cleaned up unnecessary comments and code in various files for better readability.

commit 5efddc2a58c0e164fef585cc7344c06155dbc2c1
Author: Arno Kaimbacher <arno.kaimbacher@geosphere.at>
Date:   Mon Jan 12 17:02:47 2026 +0100

    feat: add dataset change detection and form submission composables

    - Implemented `useDatasetChangeDetection` for tracking unsaved changes in dataset forms, including comparisons for licenses, basic properties, files, coverage, and more.
    - Added `useDatasetFormSubmission` for handling dataset form submissions with validation, success/error handling, and auto-save functionality.
2026-06-09 09:35:15 +02:00

105 lines
3.3 KiB
TypeScript

import '../css/app.css';
import { createApp, h } from 'vue';
// import { Inertia } from '@inertiajs/inertia';
import { router } from '@inertiajs/vue3';
import { Head, Link, createInertiaApp } from '@inertiajs/vue3';
// import DefaultLayout from '@/Layouts/Default.vue';
import { createPinia } from 'pinia';
import { StyleService } from '@/Stores/style.service';
import { LayoutService } from '@/Stores/layout';
import { LocaleStore } from '@/Stores/locale';
import { darkModeKey, styleKey } from '@/config';
import type { DefineComponent } from 'vue';
import { resolvePageComponent } from '@adonisjs/inertia/helpers';
const pinia = createPinia();
// import i18n from './i18n';
import { EmitterPlugin } from '@/EmitterDirective';
import { initRoutes } from '@eidellev/adonis-stardust/client/index.js';
initRoutes();
// import { loadTranslations } from './utils/tethyscloud-l10n';
import asyncPlugin from '@/apps/settings/asyncPlugin';
// const translation = await asyncPlugin.install('settings');
// interface SetupOptions {
// el: Element;
// App: App;
// props: Record<string, any>;
// plugin: Plugin;
// }
// import '@fontsource/archivo-black/index.css';
// import '@fontsource/inter/index.css';
createInertiaApp({
progress: {
// color: '#4B5563',
color: '#22C55E',
showSpinner: true,
},
// Webpack
// resolve: async (name: string) => {
// // Dynamically import the Vue component using import
// const { default: page } = await import(`./Pages/${name}.vue`);
// // const page = require(`./Pages/${name}.vue`).default;
// // if (!page.layout) {
// // page.layout = DefaultLayout;
// // }
// return page;
// },
resolve: (name) => {
return resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob<DefineComponent>('./Pages/**/*.vue'));
},
setup({ el, App, props, plugin }) {
const app = createApp({ render: () => h(App, props) })
.use(plugin)
.use(pinia)
// .use(i18n)
.use(EmitterPlugin);
// .component('inertia-link', Link)
app.component('Head', Head);
app.component('Link', Link);
// Listen for navigation event to handle layout changes
// window.addEventListener('inertia:navigate', () => {
// layoutService.isAsideMobileExpanded = false;
// layoutService.isAsideLgActive = false;
// });
asyncPlugin.install('settings').then(() => {
app.mount(el);
});
},
});
const styleService = StyleService(pinia);
const layoutService = LayoutService(pinia);
const localeService = LocaleStore(pinia);
localeService.initializeLocale();
// const mainService = MainService(pinia);
// mainService.setUser(user);
/* App style */
styleService.setStyle(localStorage[styleKey] ?? 'basic');
/* Dark mode */
if ((!localStorage[darkModeKey] && window.matchMedia('(prefers-color-scheme: dark)').matches) || localStorage[darkModeKey] === '1') {
styleService.setDarkMode(true);
}
// mainService.fetchApi('clients');
// mainService.fetchApi('authors');
// mainService.fetchApi('datasets');
// mainService.fetchChartData();
/* Collapse mobile aside menu on route change */
router.on('navigate', () => {
layoutService.isAsideMobileExpanded = false;
layoutService.isAsideLgActive = false;
});