diff --git a/next-ui/src/pages/libraries/[id]/series.vue b/next-ui/src/pages/libraries/[id]/series.vue index 2fc9f5b0..3ebeaa23 100644 --- a/next-ui/src/pages/libraries/[id]/series.vue +++ b/next-ui/src/pages/libraries/[id]/series.vue @@ -1,10 +1,106 @@ diff --git a/next-ui/src/stores/app.ts b/next-ui/src/stores/app.ts index 4a74b731..6f2c8af0 100644 --- a/next-ui/src/stores/app.ts +++ b/next-ui/src/stores/app.ts @@ -1,6 +1,8 @@ // Utilities import { defineStore } from 'pinia' import { useDisplay } from 'vuetify' +import type { PresentationMode } from '@/types/libraries' +import type { PageSize } from '@/types/page' export const useAppStore = defineStore('app', { state: () => ({ @@ -9,12 +11,35 @@ export const useAppStore = defineStore('app', { theme: 'system', rememberMe: false, importBooksPath: '', + browsingPageSize: 20 as PageSize, + /** + * Store the presentation mode per view. + * Use the getter to ensure a default value is always set. + */ + presentationMode: {} as Record, // transient reorderLibraries: false, }), + getters: { + getPresentationMode: (state) => (key: string, defaultValue: PresentationMode) => { + return computed({ + get: () => state.presentationMode[key] ?? (state.presentationMode[key] = defaultValue), + set: (value) => { + state.presentationMode[key] = value + }, + }) + }, + }, persist: { key: 'komga.nextui.app', // explicitly state which keys are stored - pick: ['drawer', 'theme', 'rememberMe', 'importBooksPath'], + pick: [ + 'drawer', + 'theme', + 'rememberMe', + 'importBooksPath', + 'browsingPageSize', + 'presentationMode', + ], }, })