diff --git a/next-ui/src/colada/readlists.ts b/next-ui/src/colada/readlists.ts index 8d3df969..7f310c88 100644 --- a/next-ui/src/colada/readlists.ts +++ b/next-ui/src/colada/readlists.ts @@ -1,11 +1,40 @@ -import { defineMutation, useMutation } from '@pinia/colada' +import { defineMutation, defineQueryOptions, useMutation } from '@pinia/colada' import { komgaClient } from '@/api/komga-client' import type { components } from '@/generated/openapi/komga' +import type { PageRequest } from '@/types/PageRequest' export const QUERY_KEYS_READLIST = { root: ['readlists'] as const, + bySearch: (request: object) => [...QUERY_KEYS_READLIST.root, JSON.stringify(request)] as const, } +export const useListReadLists = defineQueryOptions( + ({ + search, + libraryId, + pageable, + }: { + search?: string + libraryId?: string + pageable?: PageRequest + }) => ({ + key: QUERY_KEYS_READLIST.bySearch({ search: search, libraryId: libraryId, pageable: pageable }), + query: () => + komgaClient + .GET('/api/v1/readlists', { + params: { + query: { + search: search, + libraryId: libraryId, + ...pageable, + }, + }, + }) + // unwrap the openapi-fetch structure on success + .then((res) => res.data), + }), +) + export const useCreateReadList = defineMutation(() => { return useMutation({ mutation: (readList: components['schemas']['ReadListCreationDto']) => diff --git a/next-ui/src/components/import/readlist/Table.stories.ts b/next-ui/src/components/import/readlist/Table.stories.ts index 9fe0f16f..7927b2f6 100644 --- a/next-ui/src/components/import/readlist/Table.stories.ts +++ b/next-ui/src/components/import/readlist/Table.stories.ts @@ -50,6 +50,7 @@ const singleMatch = { }, ], } + export const Created: Story = { args: { match: singleMatch, @@ -68,6 +69,12 @@ export const Created: Story = { }), } +export const DuplicateName: Story = { + args: { + match: { ...singleMatch, readListMatch: { name: 'Elfes', errorCode: '' } }, + }, +} + export const Empty: Story = { args: { match: { ...matchCbl, requests: [] }, diff --git a/next-ui/src/components/import/readlist/Table.vue b/next-ui/src/components/import/readlist/Table.vue index e228c27b..6874b7aa 100644 --- a/next-ui/src/components/import/readlist/Table.vue +++ b/next-ui/src/components/import/readlist/Table.vue @@ -1,220 +1,223 @@ - - - - - - - - - - - - - - - - - {{ s }} - - - - - - - {{ value?.title }} - - {{ $formatDate(value?.releaseDate, { year: 'numeric', timeZone: 'UTC' }) }} - - - - - - - - - {{ value.number }} - {{ value.title }} - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - + - seriesPicked(series)" - /> + + + + + + + + - bookPicked(book)" - /> + + + {{ s }} + + + + + + + {{ value?.title }} + + {{ $formatDate(value?.releaseDate, { year: 'numeric', timeZone: 'UTC' }) }} + + + + + + + + + {{ value.number }} - {{ value.title }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + seriesPicked(series)" + /> + + bookPicked(book)" + /> + diff --git a/next-ui/src/plugins/vuetify.ts b/next-ui/src/plugins/vuetify.ts index d487ee11..11d5e043 100644 --- a/next-ui/src/plugins/vuetify.ts +++ b/next-ui/src/plugins/vuetify.ts @@ -13,6 +13,7 @@ import { createVuetify } from 'vuetify' import { md3 } from 'vuetify/blueprints' // Labs +import { VFileUpload } from 'vuetify/labs/VFileUpload' import { VIconBtn } from 'vuetify/labs/components' import { createRulesPlugin } from 'vuetify/labs/rules' @@ -69,6 +70,7 @@ export const vuetify = createVuetify({ }, blueprint: md3, components: { + VFileUpload, VIconBtn, }, })