From e0753018212d4a1ba53887dc2b8c2abd44f1ba0b Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Wed, 1 Apr 2026 17:37:13 +0800 Subject: [PATCH] add scaffolding for entity browsing and card links --- next-ui/src/components/book/card/BookCard.vue | 20 +++---- .../collection/card/CollectionCard.vue | 6 ++- next-ui/src/components/item/card/ItemCard.vue | 18 ++++++- .../components/readlist/card/ReadlistCard.vue | 6 ++- .../src/components/series/card/SeriesCard.vue | 6 ++- next-ui/src/pages/book/[id].vue | 11 ++++ next-ui/src/pages/collection/[id].vue | 11 ++++ next-ui/src/pages/libraries/[id]/books.vue | 1 + next-ui/src/pages/readlist/[id].vue | 11 ++++ next-ui/src/pages/series/[id].vue | 11 ++++ next-ui/src/route-map.d.ts | 52 +++++++++++++++++++ next-ui/src/types/ItemCard.ts | 8 +++ 12 files changed, 146 insertions(+), 15 deletions(-) create mode 100644 next-ui/src/pages/book/[id].vue create mode 100644 next-ui/src/pages/collection/[id].vue create mode 100644 next-ui/src/pages/readlist/[id].vue create mode 100644 next-ui/src/pages/series/[id].vue diff --git a/next-ui/src/components/book/card/BookCard.vue b/next-ui/src/components/book/card/BookCard.vue index fcaa0e51..5f5f133c 100644 --- a/next-ui/src/components/book/card/BookCard.vue +++ b/next-ui/src/components/book/card/BookCard.vue @@ -41,14 +41,10 @@ const intl = useIntl() const id = useId() -const { - book, - showSeries = true, - ...props -} = defineProps< +const { book, showSeries, ...props } = defineProps< { book: components['schemas']['BookDto'] - showSeries?: boolean + showSeries: boolean } & ItemCardProps >() const emit = defineEmits() @@ -98,17 +94,21 @@ const titleAndLines = computed<{ title: ItemCardTitle; lines: ItemCardLine[] }>( if (book.oneshot) { return { - title: { text: book.metadata.title, lines: 2 }, + title: { text: book.metadata.title, lines: 2, routerLink: `/book/${book.id}` }, lines: [footer], } } else { const numberedTitle = `${book.metadata.number} - ${book.metadata.title}` if (showSeries) return { - title: { text: book.seriesTitle, lines: 1 }, - lines: [{ text: numberedTitle, lines: 1 }, footer], + title: { text: book.seriesTitle, lines: 1, routerLink: `/series/${book.seriesId}` }, + lines: [{ text: numberedTitle, lines: 1, routerLink: `/book/${book.id}` }, footer], + } + else + return { + title: { text: numberedTitle, lines: 2, routerLink: `/book/${book.id}` }, + lines: [footer], } - else return { title: { text: numberedTitle, lines: 2 }, lines: [footer] } } }) diff --git a/next-ui/src/components/collection/card/CollectionCard.vue b/next-ui/src/components/collection/card/CollectionCard.vue index 14e02fe2..4f74e270 100644 --- a/next-ui/src/components/collection/card/CollectionCard.vue +++ b/next-ui/src/components/collection/card/CollectionCard.vue @@ -46,7 +46,11 @@ const emit = defineEmits() const bottomSheet = ref(false) -const title = computed(() => ({ text: collection.name, lines: 2 })) +const title = computed(() => ({ + text: collection.name, + lines: 2, + routerLink: `/collection/${collection.id}`, +})) const lines = computed(() => [ { diff --git a/next-ui/src/components/item/card/ItemCard.vue b/next-ui/src/components/item/card/ItemCard.vue index 34c47f60..f2eb4615 100644 --- a/next-ui/src/components/item/card/ItemCard.vue +++ b/next-ui/src/components/item/card/ItemCard.vue @@ -136,8 +136,15 @@ {{ title.text }} + {{ title.text }} + {{ title.text }} + diff --git a/next-ui/src/components/readlist/card/ReadlistCard.vue b/next-ui/src/components/readlist/card/ReadlistCard.vue index c7453de1..946df363 100644 --- a/next-ui/src/components/readlist/card/ReadlistCard.vue +++ b/next-ui/src/components/readlist/card/ReadlistCard.vue @@ -46,7 +46,11 @@ const emit = defineEmits() const bottomSheet = ref(false) -const title = computed(() => ({ text: readList.name, lines: 2 })) +const title = computed(() => ({ + text: readList.name, + lines: 2, + routerLink: `/readlist/${readList.id}`, +})) const lines = computed(() => [ { diff --git a/next-ui/src/components/series/card/SeriesCard.vue b/next-ui/src/components/series/card/SeriesCard.vue index 1302c32f..a1aa5b88 100644 --- a/next-ui/src/components/series/card/SeriesCard.vue +++ b/next-ui/src/components/series/card/SeriesCard.vue @@ -53,7 +53,11 @@ const unreadCount = computed(() => series.oneshot ? undefined : series.booksUnreadCount + series.booksInProgressCount, ) -const title = computed(() => ({ text: series.metadata.title, lines: 2 })) +const title = computed(() => ({ + text: series.metadata.title, + lines: 2, + routerLink: `/series/${series.id}`, +})) const lines = computed(() => { if (series.deleted) diff --git a/next-ui/src/pages/book/[id].vue b/next-ui/src/pages/book/[id].vue new file mode 100644 index 00000000..9a0e603e --- /dev/null +++ b/next-ui/src/pages/book/[id].vue @@ -0,0 +1,11 @@ + + + + + +meta: + requiresRole: USER + diff --git a/next-ui/src/pages/collection/[id].vue b/next-ui/src/pages/collection/[id].vue new file mode 100644 index 00000000..4be85c57 --- /dev/null +++ b/next-ui/src/pages/collection/[id].vue @@ -0,0 +1,11 @@ + + + + + +meta: + requiresRole: USER + diff --git a/next-ui/src/pages/libraries/[id]/books.vue b/next-ui/src/pages/libraries/[id]/books.vue index 66b18a49..c9e79c73 100644 --- a/next-ui/src/pages/libraries/[id]/books.vue +++ b/next-ui/src/pages/libraries/[id]/books.vue @@ -122,6 +122,7 @@ > + + + + +meta: + requiresRole: USER + diff --git a/next-ui/src/pages/series/[id].vue b/next-ui/src/pages/series/[id].vue new file mode 100644 index 00000000..6fa3f01e --- /dev/null +++ b/next-ui/src/pages/series/[id].vue @@ -0,0 +1,11 @@ + + + + + +meta: + requiresRole: USER + diff --git a/next-ui/src/route-map.d.ts b/next-ui/src/route-map.d.ts index 14f6dfa5..0dc13daa 100644 --- a/next-ui/src/route-map.d.ts +++ b/next-ui/src/route-map.d.ts @@ -69,6 +69,13 @@ declare module 'vue-router/auto-routes' { Record, | never >, + '/book/[id]': RouteRecordInfo< + '/book/[id]', + '/book/:id', + { id: ParamValue }, + { id: ParamValue }, + | never + >, '/claim': RouteRecordInfo< '/claim', '/claim', @@ -76,6 +83,13 @@ declare module 'vue-router/auto-routes' { Record, | never >, + '/collection/[id]': RouteRecordInfo< + '/collection/[id]', + '/collection/:id', + { id: ParamValue }, + { id: ParamValue }, + | never + >, '/error': RouteRecordInfo< '/error', '/error', @@ -192,6 +206,20 @@ declare module 'vue-router/auto-routes' { Record, | never >, + '/readlist/[id]': RouteRecordInfo< + '/readlist/[id]', + '/readlist/:id', + { id: ParamValue }, + { id: ParamValue }, + | never + >, + '/series/[id]': RouteRecordInfo< + '/series/[id]', + '/series/:id', + { id: ParamValue }, + { id: ParamValue }, + | never + >, '/server/activity': RouteRecordInfo< '/server/activity', '/server/activity', @@ -297,12 +325,24 @@ declare module 'vue-router/auto-routes' { views: | never } + 'src/pages/book/[id].vue': { + routes: + | '/book/[id]' + views: + | never + } 'src/pages/claim.vue': { routes: | '/claim' views: | never } + 'src/pages/collection/[id].vue': { + routes: + | '/collection/[id]' + views: + | never + } 'src/pages/error.vue': { routes: | '/error' @@ -404,6 +444,18 @@ declare module 'vue-router/auto-routes' { views: | never } + 'src/pages/readlist/[id].vue': { + routes: + | '/readlist/[id]' + views: + | never + } + 'src/pages/series/[id].vue': { + routes: + | '/series/[id]' + views: + | never + } 'src/pages/server/activity.vue': { routes: | '/server/activity' diff --git a/next-ui/src/types/ItemCard.ts b/next-ui/src/types/ItemCard.ts index c7cbd009..e9f59446 100644 --- a/next-ui/src/types/ItemCard.ts +++ b/next-ui/src/types/ItemCard.ts @@ -38,6 +38,10 @@ export type ItemCardTitle = { * Number of lines. */ lines?: number + /** + * Link. + */ + routerLink?: string | object } export type ItemCardLine = { @@ -57,4 +61,8 @@ export type ItemCardLine = { * Whether the container will be shown even if `text` is empty. */ allowEmpty?: boolean + /** + * Link. + */ + routerLink?: string | object }