From e3452312d146770ac505ee404a96493591ecbb63 Mon Sep 17 00:00:00 2001 From: "bert.hausmans" Date: Tue, 5 May 2026 19:11:58 +0200 Subject: [PATCH] refactor(layouts): merge portal navbar/drawer into PortalLayout.vue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrates the navbar (event/platform two-mode toggle), mobile drawer with avatar header + logout, RouterView Suspense wrapper, and footer from apps/portal/src/layouts/portal.vue into the PortalLayout.vue skeleton from PR-A. The skeleton's structure (VApp / VAppBar / VMain / VFooter) is preserved as the outer shell. Notable adaptations: - useAuthStore → usePortalAuthStore (renamed in C.3) - usePortalStore import path → @/stores/portal/usePortalStore - mobile nav links now point at /portal/evenementen and /portal/profiel (the new sub-zone paths) instead of /evenementen and /profiel - explicit `import { useRoute, useRouter }` from vue-router so the vitest mock can intercept (auto-import not configured for these in the trimmed test config) Updated PortalLayout.spec.ts to mock the two pinia stores plus useSkins, vue-router, UserAvatarMenu, and AppLoadingIndicator. Tests now assert the auth-conditional rendering: header + drawer hidden when unauthenticated, main + footer always present. Also pulls in the @form-schema → @/composables/forms/* import rewrites in the C.4-moved composables that the previous commit's rename-only diff left unstaged. Vitest: 23 files / 162 tests, no errors. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../__tests__/usePublicFormSections.spec.ts | 2 +- .../__tests__/usePublicFormTimeSlots.spec.ts | 2 +- apps/app/src/composables/api/usePublicForm.ts | 2 +- .../composables/api/usePublicFormSections.ts | 2 +- .../composables/api/usePublicFormTimeSlots.ts | 2 +- apps/app/src/composables/useFormDraft.ts | 2 +- apps/app/src/layouts/PortalLayout.vue | 226 +++++++++++++++++- .../layouts/__tests__/PortalLayout.spec.ts | 71 +++++- 8 files changed, 278 insertions(+), 31 deletions(-) diff --git a/apps/app/src/composables/api/__tests__/usePublicFormSections.spec.ts b/apps/app/src/composables/api/__tests__/usePublicFormSections.spec.ts index cdeccad4..fd43ce23 100644 --- a/apps/app/src/composables/api/__tests__/usePublicFormSections.spec.ts +++ b/apps/app/src/composables/api/__tests__/usePublicFormSections.spec.ts @@ -9,7 +9,7 @@ vi.mock('@/lib/axios', () => ({ import { apiClient } from '@/lib/axios' import { usePublicFormSections } from '@/composables/api/usePublicFormSections' -import type { PublicFormSectionOption } from '@form-schema/types/formBuilder' +import type { PublicFormSectionOption } from '@/composables/forms/types/formBuilder' interface MockedApi { get: ReturnType } const mocked = apiClient as unknown as MockedApi diff --git a/apps/app/src/composables/api/__tests__/usePublicFormTimeSlots.spec.ts b/apps/app/src/composables/api/__tests__/usePublicFormTimeSlots.spec.ts index 48d5e9bc..81c47d69 100644 --- a/apps/app/src/composables/api/__tests__/usePublicFormTimeSlots.spec.ts +++ b/apps/app/src/composables/api/__tests__/usePublicFormTimeSlots.spec.ts @@ -9,7 +9,7 @@ vi.mock('@/lib/axios', () => ({ import { apiClient } from '@/lib/axios' import { usePublicFormTimeSlots } from '@/composables/api/usePublicFormTimeSlots' -import type { PublicFormTimeSlot } from '@form-schema/types/formBuilder' +import type { PublicFormTimeSlot } from '@/composables/forms/types/formBuilder' interface MockedApi { get: ReturnType } const mocked = apiClient as unknown as MockedApi diff --git a/apps/app/src/composables/api/usePublicForm.ts b/apps/app/src/composables/api/usePublicForm.ts index b3b19a09..832a168f 100644 --- a/apps/app/src/composables/api/usePublicForm.ts +++ b/apps/app/src/composables/api/usePublicForm.ts @@ -9,7 +9,7 @@ import type { SaveDraftBody, StartDraftBody, SubmitBody, -} from '@form-schema/types/formBuilder' +} from '@/composables/forms/types/formBuilder' interface ApiResponse { data: T diff --git a/apps/app/src/composables/api/usePublicFormSections.ts b/apps/app/src/composables/api/usePublicFormSections.ts index 9b337155..187ca7a3 100644 --- a/apps/app/src/composables/api/usePublicFormSections.ts +++ b/apps/app/src/composables/api/usePublicFormSections.ts @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/vue-query' import type { Ref } from 'vue' import { apiClient } from '@/lib/axios' -import type { PublicFormSectionOption } from '@form-schema/types/formBuilder' +import type { PublicFormSectionOption } from '@/composables/forms/types/formBuilder' interface ApiResponse { data: T diff --git a/apps/app/src/composables/api/usePublicFormTimeSlots.ts b/apps/app/src/composables/api/usePublicFormTimeSlots.ts index 24a3cfbe..8f4e26b7 100644 --- a/apps/app/src/composables/api/usePublicFormTimeSlots.ts +++ b/apps/app/src/composables/api/usePublicFormTimeSlots.ts @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/vue-query' import type { Ref } from 'vue' import { apiClient } from '@/lib/axios' -import type { PublicFormTimeSlot } from '@form-schema/types/formBuilder' +import type { PublicFormTimeSlot } from '@/composables/forms/types/formBuilder' interface ApiResponse { data: T diff --git a/apps/app/src/composables/useFormDraft.ts b/apps/app/src/composables/useFormDraft.ts index 37f1902a..0fc34e49 100644 --- a/apps/app/src/composables/useFormDraft.ts +++ b/apps/app/src/composables/useFormDraft.ts @@ -7,7 +7,7 @@ import { useSaveFormDraft, useSubmitForm, } from '@/composables/api/usePublicForm' -import type { FormValues, PublicFormSubmission, SaveDraftBody } from '@form-schema/types/formBuilder' +import type { FormValues, PublicFormSubmission, SaveDraftBody } from '@/composables/forms/types/formBuilder' /** sessionStorage key for reusing an idempotency key across reloads. */ export function draftIdempotencyKey(token: string): string { diff --git a/apps/app/src/layouts/PortalLayout.vue b/apps/app/src/layouts/PortalLayout.vue index dac0597e..14433d3c 100644 --- a/apps/app/src/layouts/PortalLayout.vue +++ b/apps/app/src/layouts/PortalLayout.vue @@ -1,32 +1,232 @@ diff --git a/apps/app/src/layouts/__tests__/PortalLayout.spec.ts b/apps/app/src/layouts/__tests__/PortalLayout.spec.ts index b818a535..41f09ef2 100644 --- a/apps/app/src/layouts/__tests__/PortalLayout.spec.ts +++ b/apps/app/src/layouts/__tests__/PortalLayout.spec.ts @@ -1,38 +1,85 @@ -import { describe, expect, it } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { mount } from '@vue/test-utils' -import PortalLayout from '../PortalLayout.vue' +import { createPinia, setActivePinia } from 'pinia' + +// Mock auto-imported composables / external pinia stores so the layout's +//