Files
FabledCurator/frontend/src/router.js
T
2026-05-17 16:29:21 -04:00

48 lines
2.3 KiB
JavaScript

import { createRouter, createWebHistory, createMemoryHistory } from 'vue-router'
import PlaceholderView from './views/PlaceholderView.vue'
import SettingsView from './views/SettingsView.vue'
import GalleryView from './views/GalleryView.vue'
import ShowcaseView from './views/ShowcaseView.vue'
import TagsView from './views/TagsView.vue'
import ArtistView from './views/ArtistView.vue'
import SeriesManageView from './views/SeriesManageView.vue'
import SeriesReaderView from './views/SeriesReaderView.vue'
// The application's front door. `/` redirects here. Changing the front door
// is a one-line edit (e.g. '/gallery' or '/tags').
export const FRONT_DOOR = '/showcase'
const routes = [
// Root is a redirect only — no meta.title so it stays out of the nav.
{ path: '/', redirect: FRONT_DOOR },
// FC-2: image backbone
{ path: '/showcase', name: 'showcase', component: ShowcaseView, meta: { title: 'Showcase' } },
{ path: '/gallery', name: 'gallery', component: GalleryView, meta: { title: 'Gallery' } },
{ path: '/tags', name: 'tags', component: TagsView, meta: { title: 'Tags' } },
// Artist detail — no meta.title (reached by clicking an artist, not nav).
{ path: '/artist/:slug', name: 'artist', component: ArtistView },
// Series management — no meta.title (reached from a series tag card).
{ path: '/series/:tagId', name: 'series-manage', component: SeriesManageView },
// Series reader — immersive (no top nav, no meta.title).
{ path: '/series/:tagId/read', name: 'series-read', component: SeriesReaderView, meta: { immersive: true } },
{ path: '/settings', name: 'settings', component: SettingsView, meta: { title: 'Settings' } },
// FC-3: subscription backbone
{ path: '/subscriptions', name: 'subscriptions', component: PlaceholderView, meta: { title: 'Subscriptions' } },
{ path: '/credentials', name: 'credentials', component: PlaceholderView, meta: { title: 'Credentials' } },
{ path: '/downloads', name: 'downloads', component: PlaceholderView, meta: { title: 'Downloads' } }
]
// Browser uses HTML5 history; non-browser (Vitest/SSR) falls back to memory
// history so the module is importable without `window`.
const history =
typeof window !== 'undefined' ? createWebHistory() : createMemoryHistory()
const router = createRouter({
history,
routes
})
export default router