diff --git a/src/app/components/ClientCard/Avatar.vue b/src/app/components/ClientCard/Avatar.vue index 9b106483..e4e3a3f1 100644 --- a/src/app/components/ClientCard/Avatar.vue +++ b/src/app/components/ClientCard/Avatar.vue @@ -1,11 +1,8 @@ diff --git a/src/app/components/ui/Toast.vue b/src/app/components/base/Toast.vue similarity index 50% rename from src/app/components/ui/Toast.vue rename to src/app/components/base/Toast.vue index 271a5ab6..a1ee0602 100644 --- a/src/app/components/ui/Toast.vue +++ b/src/app/components/base/Toast.vue @@ -7,25 +7,32 @@ import { ToastTitle, } from 'radix-vue'; -defineProps<{ - title: string; - content: string; -}>(); +defineExpose({ + publish, +}); + +const count = reactive<{ title: string; message: string }[]>([]); + +function publish(e: { title: string; message: string }) { + count.push({ title: e.title, message: e.message }); + console.log(count.length); +} diff --git a/src/app/components/ui/Modal.vue b/src/app/components/ui/Modal.vue deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/components/ui/NavBar.vue b/src/app/components/ui/NavBar.vue deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/components/ui/UserMenu.vue b/src/app/components/ui/UserMenu.vue index 1b1046a1..8e956567 100644 --- a/src/app/components/ui/UserMenu.vue +++ b/src/app/components/ui/UserMenu.vue @@ -5,16 +5,9 @@ class="flex items-center rounded-full pe-1 text-sm font-medium text-gray-400 hover:text-red-800 focus:ring-4 focus:ring-gray-100 md:me-0 dark:text-neutral-400 dark:hover:text-red-800 dark:focus:ring-gray-700" type="button" > - - - {{ fallbackName }} - - + + {{ fallbackName }} + {{ authStore.userData?.name }} diff --git a/src/app/layouts/setup.vue b/src/app/layouts/setup.vue index 88ff498f..947fb649 100644 --- a/src/app/layouts/setup.vue +++ b/src/app/layouts/setup.vue @@ -18,14 +18,12 @@ - + diff --git a/src/app/pages/admin/interface.vue b/src/app/pages/admin/interface.vue new file mode 100644 index 00000000..12fecad5 --- /dev/null +++ b/src/app/pages/admin/interface.vue @@ -0,0 +1,3 @@ + + + diff --git a/src/app/pages/index.vue b/src/app/pages/index.vue index 0b44f2ed..47baa194 100644 --- a/src/app/pages/index.vue +++ b/src/app/pages/index.vue @@ -4,8 +4,6 @@ - - diff --git a/src/app/pages/login.vue b/src/app/pages/login.vue index 33b537b0..9e6af3ad 100644 --- a/src/app/pages/login.vue +++ b/src/app/pages/login.vue @@ -75,12 +75,7 @@ /> - + @@ -94,22 +89,7 @@ const remember = ref(false); const username = ref(null); const password = ref(null); const authStore = useAuthStore(); - -type SetupError = { - title: string; - message: string; -}; - -const setupError = ref(null); - -// TODO: check if needed -watch(setupError, (value) => { - if (value) { - setTimeout(() => { - setupError.value = null; - }, 13000); - } -}); +const toast = useTemplateRef('toast'); async function login(e: Event) { e.preventDefault(); @@ -128,10 +108,10 @@ async function login(e: Event) { } } catch (error) { if (error instanceof FetchError) { - setupError.value = { + toast.value?.publish({ title: t('error.login'), message: error.data.message, - }; + }); } } authenticating.value = false; diff --git a/src/app/stores/setup.ts b/src/app/stores/setup.ts index 45fa9414..28ca2403 100644 --- a/src/app/stores/setup.ts +++ b/src/app/stores/setup.ts @@ -50,10 +50,18 @@ export const useSetupStore = defineStore('Setup', () => { message: string; }; - const error = ref(null); + type ErrorRef = { + value: { publish: (e: SetupError) => void } | null; + }; + + const errorRef = ref(null); + + function setErrorRef(a: ErrorRef | null) { + errorRef.value = a; + } function handleError(e: SetupError) { - error.value = e; + errorRef.value?.value?.publish(e); } const step = ref(1); @@ -67,7 +75,7 @@ export const useSetupStore = defineStore('Setup', () => { step4, step5, runMigration, - error, + setErrorRef, handleError, step, totalSteps, diff --git a/src/i18n/i18n.config.ts b/src/i18n/i18n.config.ts index 9b5a9dfc..1364db9e 100644 --- a/src/i18n/i18n.config.ts +++ b/src/i18n/i18n.config.ts @@ -19,13 +19,10 @@ import it from './locales/it.json'; import th from './locales/th.json'; import hi from './locales/hi.json'; -import { LOCALES } from '~~/shared/locales'; - export default defineI18nConfig(() => ({ fallbackLocale: 'en', legacy: false, locale: 'en', - locales: LOCALES, messages: { en, ua,