feat: add explicit note organization setting

This commit is contained in:
lucaronin
2026-04-10 13:52:39 +02:00
parent 0e1d98a217
commit 7bc74432ac
20 changed files with 341 additions and 49 deletions

View File

@@ -0,0 +1,22 @@
import type { SidebarSelection } from '../types'
export const INBOX_SELECTION: SidebarSelection = { kind: 'filter', filter: 'inbox' }
export const ALL_NOTES_SELECTION: SidebarSelection = { kind: 'filter', filter: 'all' }
export function isExplicitOrganizationEnabled(explicitOrganization?: boolean | null): boolean {
return explicitOrganization !== false
}
export function getDefaultSelectionForOrganization(explicitOrganization?: boolean | null): SidebarSelection {
return isExplicitOrganizationEnabled(explicitOrganization) ? INBOX_SELECTION : ALL_NOTES_SELECTION
}
export function sanitizeSelectionForOrganization(
selection: SidebarSelection,
explicitOrganization?: boolean | null,
): SidebarSelection {
if (!isExplicitOrganizationEnabled(explicitOrganization) && selection.kind === 'filter' && selection.filter === 'inbox') {
return ALL_NOTES_SELECTION
}
return selection
}