diff --git a/unraid-ui/src/global.d.ts b/unraid-ui/src/global.d.ts deleted file mode 100644 index c9108b0ce..000000000 --- a/unraid-ui/src/global.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable no-var */ -declare global { - /** loaded by Toaster.vue */ - var toast: (typeof import('vue-sonner'))['toast']; -} - -// an export or import statement is required to make this file a module -export {}; diff --git a/web/app.config.ts b/web/app.config.ts index f542e723c..fd09f3554 100644 --- a/web/app.config.ts +++ b/web/app.config.ts @@ -32,10 +32,18 @@ export default { right: {}, }, }, - }, - toaster: { - position: 'bottom-right' as const, - expand: true, - duration: 5000, + + //css theming/style-overrides for the toast component + // https://ui.nuxt.com/docs/components/toast#theme + toast: {}, + + // Also, for toasts, BUT this is imported in the Root UApp in mount-engine.ts + // https://ui.nuxt.com/docs/components/toast#examples + toaster: { + position: 'top-center' as const, + // expand: false, --> buggy + duration: 5000, + max: 3, + }, }, }; diff --git a/web/src/components/Notifications/CriticalNotifications.standalone.vue b/web/src/components/Notifications/CriticalNotifications.standalone.vue index 783f7a099..025d30bb5 100644 --- a/web/src/components/Notifications/CriticalNotifications.standalone.vue +++ b/web/src/components/Notifications/CriticalNotifications.standalone.vue @@ -1,8 +1,7 @@ - - diff --git a/web/src/components/Wrapper/component-registry.ts b/web/src/components/Wrapper/component-registry.ts index c1be8659e..1a5540626 100644 --- a/web/src/components/Wrapper/component-registry.ts +++ b/web/src/components/Wrapper/component-registry.ts @@ -139,11 +139,6 @@ export const componentMappings: ComponentMapping[] = [ selector: 'unraid-color-switcher', appId: 'color-switcher', }, - { - component: defineAsyncComponent(() => import('@/components/UnraidToaster.vue')), - selector: ['unraid-toaster', 'uui-toaster'], - appId: 'toaster', - }, { component: defineAsyncComponent(() => import('../UpdateOs/TestUpdateModal.standalone.vue')), selector: 'unraid-test-update-modal', diff --git a/web/src/components/Wrapper/mount-engine.ts b/web/src/components/Wrapper/mount-engine.ts index 7c748747a..c834ad6f1 100644 --- a/web/src/components/Wrapper/mount-engine.ts +++ b/web/src/components/Wrapper/mount-engine.ts @@ -12,6 +12,8 @@ import { createI18nInstance, ensureLocale, getWindowLocale } from '~/helpers/i18 import { globalPinia } from '~/store/globalPinia'; import { useThemeStore } from '~/store/theme'; import { ensureUnapiScope, ensureUnapiScopeForSelectors, observeUnapiScope } from '~/utils/unapiScope'; +// Import the app config to pass runtime settings (like toaster position) +import appConfig from '../../../app.config'; // Ensure Apollo client is singleton const apolloClient = (typeof window !== 'undefined' && window.apolloClient) || client; @@ -223,6 +225,7 @@ export async function mountUnifiedApp() { UApp, { portal: portalTarget, + toaster: appConfig.ui.toaster, }, { default: () => h(component, props), diff --git a/web/src/composables/useClipboardWithToast.ts b/web/src/composables/useClipboardWithToast.ts index c7aedd16b..655130ab0 100644 --- a/web/src/composables/useClipboardWithToast.ts +++ b/web/src/composables/useClipboardWithToast.ts @@ -5,6 +5,7 @@ import { useClipboard } from '@vueuse/core'; */ export function useClipboardWithToast() { const { copy, copied, isSupported } = useClipboard(); + const toast = useToast(); /** * Copy text and show toast @@ -19,10 +20,7 @@ export function useClipboardWithToast() { if (isSupported.value) { try { await copy(text); - // Use global toast if available - if (globalThis.toast) { - globalThis.toast.success(successMessage); - } + toast.add({ title: successMessage, color: 'success' }); return true; } catch (error) { console.error('Failed to copy to clipboard:', error); @@ -43,9 +41,7 @@ export function useClipboardWithToast() { document.body.removeChild(textarea); if (success) { - if (globalThis.toast) { - globalThis.toast.success(successMessage); - } + toast.add({ title: successMessage, color: 'success' }); return true; } } catch (error) { @@ -53,9 +49,7 @@ export function useClipboardWithToast() { } // Both methods failed - if (globalThis.toast) { - globalThis.toast.error('Failed to copy to clipboard'); - } + toast.add({ title: 'Failed to copy to clipboard', color: 'error' }); return false; };