feat(fc2c-i): front-door redirect, /gallery move, discovery routes

This commit is contained in:
2026-05-15 21:11:06 -04:00
parent 61f9401fde
commit 798d1a7fbc
2 changed files with 43 additions and 5 deletions
+19 -5
View File
@@ -2,13 +2,25 @@ import { createRouter, createWebHistory } 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'
// 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: '/', name: 'gallery', component: GalleryView, meta: { title: 'Gallery' } },
{ path: '/showcase', name: 'showcase', component: PlaceholderView, meta: { title: 'Showcase' } },
{ path: '/tags', name: 'tags', component: PlaceholderView, meta: { title: 'Tags' } },
{ path: '/settings', name: 'settings', component: SettingsView, meta: { title: 'Settings' } },
{ path: '/gallery', name: 'gallery', component: GalleryView, meta: { title: 'Gallery' } },
{ path: '/showcase', name: 'showcase', component: ShowcaseView, meta: { title: 'Showcase' } },
{ 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 },
{ path: '/settings', name: 'settings', component: SettingsView, meta: { title: 'Settings' } },
// FC-3: subscription backbone
{ path: '/subscriptions', name: 'subscriptions', component: PlaceholderView, meta: { title: 'Subscriptions' } },
@@ -16,7 +28,9 @@ const routes = [
{ path: '/downloads', name: 'downloads', component: PlaceholderView, meta: { title: 'Downloads' } }
]
export default createRouter({
const router = createRouter({
history: createWebHistory(),
routes
})
export default router
+24
View File
@@ -0,0 +1,24 @@
import { describe, it, expect } from 'vitest'
import router, { FRONT_DOOR } from '../src/router.js'
describe('router', () => {
it('FRONT_DOOR defaults to /showcase', () => {
expect(FRONT_DOOR).toBe('/showcase')
})
it('/ redirects to FRONT_DOOR', () => {
const resolved = router.resolve('/')
expect(resolved.path).toBe(FRONT_DOOR)
})
it('gallery is reachable at /gallery', () => {
expect(router.resolve('/gallery').name).toBe('gallery')
})
it('showcase, tags, artist resolve to named routes', () => {
expect(router.resolve('/showcase').name).toBe('showcase')
expect(router.resolve('/tags').name).toBe('tags')
expect(router.resolve('/artist/some-slug').name).toBe('artist')
expect(router.resolve('/artist/some-slug').params.slug).toBe('some-slug')
})
})