From 5714e3b2e19ea950343ebf2a85250166d7f02760 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 6 Feb 2026 23:00:25 -0800 Subject: [PATCH] Store collapsed setting --- .../app-frame/app-frame.component.ts | 29 +++++++++++++++++-- src-ui/src/app/data/ui-settings.ts | 11 +++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src-ui/src/app/components/app-frame/app-frame.component.ts b/src-ui/src/app/components/app-frame/app-frame.component.ts index dcea154a4..aeb34cc81 100644 --- a/src-ui/src/app/components/app-frame/app-frame.component.ts +++ b/src-ui/src/app/components/app-frame/app-frame.component.ts @@ -21,7 +21,7 @@ import { Observable } from 'rxjs' import { first } from 'rxjs/operators' import { Document } from 'src/app/data/document' import { SavedView } from 'src/app/data/saved-view' -import { SETTINGS_KEYS } from 'src/app/data/ui-settings' +import { CollapsibleSection, SETTINGS_KEYS } from 'src/app/data/ui-settings' import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive' import { ComponentCanDeactivate } from 'src/app/guards/dirty-doc.guard' import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe' @@ -94,8 +94,6 @@ export class AppFrameComponent slimSidebarAnimating: boolean = false - attributesSectionsCollapsed: boolean = true - constructor() { super() const permissionsService = this.permissionsService @@ -222,6 +220,31 @@ export class AppFrameComponent }) } + get attributesSectionsCollapsed(): boolean { + return this.settingsService + .get(SETTINGS_KEYS.ATTRIBUTES_SECTIONS_COLLAPSED) + .includes(CollapsibleSection.ATTRIBUTES) + } + + set attributesSectionsCollapsed(collapsed: boolean) { + // TODO: refactor to be able to toggle individual sections, if implemented + this.settingsService.set( + SETTINGS_KEYS.ATTRIBUTES_SECTIONS_COLLAPSED, + collapsed ? [CollapsibleSection.ATTRIBUTES] : [] + ) + this.settingsService + .storeSettings() + .pipe(first()) + .subscribe({ + error: (error) => { + this.toastService.showError( + $localize`An error occurred while saving settings.` + ) + console.warn(error) + }, + }) + } + get aiEnabled(): boolean { return this.settingsService.get(SETTINGS_KEYS.AI_ENABLED) } diff --git a/src-ui/src/app/data/ui-settings.ts b/src-ui/src/app/data/ui-settings.ts index f899cffa4..ee1ceb56d 100644 --- a/src-ui/src/app/data/ui-settings.ts +++ b/src-ui/src/app/data/ui-settings.ts @@ -19,6 +19,10 @@ export enum GlobalSearchType { TITLE_CONTENT = 'title-content', } +export enum CollapsibleSection { + ATTRIBUTES = 'attributes', +} + export const PAPERLESS_GREEN_HEX = '#17541f' export const SETTINGS_KEYS = { @@ -51,6 +55,8 @@ export const SETTINGS_KEYS = { NOTES_ENABLED: 'general-settings:notes-enabled', AUDITLOG_ENABLED: 'general-settings:auditlog-enabled', SLIM_SIDEBAR: 'general-settings:slim-sidebar', + ATTRIBUTES_SECTIONS_COLLAPSED: + 'general-settings:attributes-sections-collapsed', UPDATE_CHECKING_ENABLED: 'general-settings:update-checking:enabled', UPDATE_CHECKING_BACKEND_SETTING: 'general-settings:update-checking:backend-setting', @@ -112,6 +118,11 @@ export const SETTINGS: UiSetting[] = [ type: 'boolean', default: false, }, + { + key: SETTINGS_KEYS.ATTRIBUTES_SECTIONS_COLLAPSED, + type: 'array', + default: [], + }, { key: SETTINGS_KEYS.DOCUMENT_LIST_SIZE, type: 'number',