Polish Bible desk navigation and margin
This commit is contained in:
+23
-1
@@ -88,10 +88,20 @@ export type StudySettings = {
|
||||
marginColumnPercent: number
|
||||
studyStackPinned: boolean
|
||||
activeStudyBook: StudyBook
|
||||
marginPanelOrder: MarginPanelId[]
|
||||
themeMode: ThemeMode
|
||||
}
|
||||
|
||||
export type StudyBook = 'notebook' | 'dictionary' | 'lexicon' | 'atlas' | 'commentary' | 'search'
|
||||
export type StudyBook = 'notebook' | 'dictionary' | 'lexicon' | 'atlas' | 'commentary' | 'audio' | 'search'
|
||||
export type MarginPanelId = 'margin-note' | 'original' | 'linked' | 'definition' | 'study-notes'
|
||||
|
||||
export const defaultMarginPanelOrder: MarginPanelId[] = [
|
||||
'margin-note',
|
||||
'original',
|
||||
'linked',
|
||||
'definition',
|
||||
'study-notes',
|
||||
]
|
||||
|
||||
export type WorkspaceSnapshot = {
|
||||
schemaVersion: number
|
||||
@@ -151,6 +161,7 @@ export function defaultStudySettings(): StudySettings {
|
||||
marginColumnPercent: 20,
|
||||
studyStackPinned: true,
|
||||
activeStudyBook: 'notebook',
|
||||
marginPanelOrder: defaultMarginPanelOrder,
|
||||
themeMode: 'light',
|
||||
}
|
||||
}
|
||||
@@ -193,9 +204,20 @@ export function normalizeStudySettings(settings?: Partial<StudySettings> | null)
|
||||
return {
|
||||
...defaultStudySettings(),
|
||||
...(settings ?? {}),
|
||||
marginPanelOrder: normalizeMarginPanelOrder(settings?.marginPanelOrder),
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeMarginPanelOrder(order?: MarginPanelId[] | null): MarginPanelId[] {
|
||||
if (!Array.isArray(order)) return defaultMarginPanelOrder
|
||||
const known = new Set(defaultMarginPanelOrder)
|
||||
const next = order.filter((panel): panel is MarginPanelId => known.has(panel))
|
||||
for (const panel of defaultMarginPanelOrder) {
|
||||
if (!next.includes(panel)) next.push(panel)
|
||||
}
|
||||
return next
|
||||
}
|
||||
|
||||
export function normalizeSessions(sessions?: StudySession[] | null): StudySession[] {
|
||||
const source = Array.isArray(sessions) && sessions.length ? sessions : [createSession('KJV Study Session')]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user