diff --git a/src/chatelet-app/App.vue b/src/chatelet-app/App.vue index b98cf17..359d50f 100644 --- a/src/chatelet-app/App.vue +++ b/src/chatelet-app/App.vue @@ -15,7 +15,7 @@ const { isAuthenticated } = useAuth() // auth-gated the same way events gates My tickets: ghosted when logged out, // and a tap explains instead of bouncing to /login. const tabs = computed(() => [ - { name: 'Rooms', icon: BedDouble, path: '/chatelet' }, + { name: 'Rooms', icon: BedDouble, path: '/' }, { name: 'My bookings', icon: CalendarCheck, @@ -34,6 +34,10 @@ const tabs = computed(() => [ ]) function isActive(path: string): boolean { + // "/" is the Rooms tab: active on the room list and any room detail + // ("/:id"). A prefix test would match every route, so key off the route + // name instead. + if (path === '/') return route.name === 'chatelet' || route.name === 'chatelet-detail' return route.path === path || route.path.startsWith(path + '/') } diff --git a/src/chatelet-app/app.ts b/src/chatelet-app/app.ts index 13a76af..da735a4 100644 --- a/src/chatelet-app/app.ts +++ b/src/chatelet-app/app.ts @@ -39,7 +39,8 @@ export async function createAppInstance() { const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: [ - { path: '/', redirect: '/chatelet' }, + // "/" is the room list (chatelet module route). No redirect: the + // standalone's base path already scopes every route under it. { path: '/login', name: 'login', diff --git a/src/modules/chatelet/index.ts b/src/modules/chatelet/index.ts index f71e445..0c6fd69 100644 --- a/src/modules/chatelet/index.ts +++ b/src/modules/chatelet/index.ts @@ -17,7 +17,11 @@ export const chateletModule = createModulePlugin({ routes: [ { - path: '/chatelet', + // Root-relative: the standalone mounts under a base path (Vite base, + // e.g. "/chatelet/") that the router already applies, so hardcoding + // "/chatelet" here double-prefixed every URL ("/chatelet/chatelet/…") + // and made deep links / refreshes fall back to the list. + path: '/', name: 'chatelet', component: () => import('./views/ChateletPage.vue'), meta: { @@ -26,14 +30,14 @@ export const chateletModule = createModulePlugin({ }, }, { - path: '/chatelet/:id', + path: '/:id', name: 'chatelet-detail', component: () => import('./views/ChateletDetailPage.vue'), meta: { title: 'Room', requiresAuth: false }, }, { - // Mirrors events' /my-tickets; kept off /chatelet/* so it never - // collides with the :id room route. + // Mirrors events' /my-tickets. A static path, so it ranks above the + // "/:id" room route and never resolves as a room id. path: '/my-bookings', name: 'chatelet-my-bookings', component: () => import('./views/MyBookingsPage.vue'), diff --git a/src/modules/chatelet/views/ChateletPage.vue b/src/modules/chatelet/views/ChateletPage.vue index 04418ff..cbe2202 100644 --- a/src/modules/chatelet/views/ChateletPage.vue +++ b/src/modules/chatelet/views/ChateletPage.vue @@ -14,7 +14,7 @@ const { rooms, isLoading, loadRooms } = useChatelet() onMounted(loadRooms) function open(id: string) { - router.push(`/chatelet/${id}`) + router.push(`/${id}`) } function priceLabel(r: Room): string { diff --git a/src/modules/chatelet/views/MyBookingsPage.vue b/src/modules/chatelet/views/MyBookingsPage.vue index 8dfbc36..8eea28f 100644 --- a/src/modules/chatelet/views/MyBookingsPage.vue +++ b/src/modules/chatelet/views/MyBookingsPage.vue @@ -76,7 +76,7 @@ function statusBadge(b: GuestBooking): { label: string; variant: BadgeVariant } {{ group.title }} - +

No bookings yet.