diff --git a/tabby-settings/src/components/profilesSettingsTab.component.pug b/tabby-settings/src/components/profilesSettingsTab.component.pug index 6062a0503a..29199c5e66 100644 --- a/tabby-settings/src/components/profilesSettingsTab.component.pug +++ b/tabby-settings/src/components/profilesSettingsTab.component.pug @@ -36,7 +36,7 @@ ul.nav-tabs(ngbNav, #nav='ngbNav') ng-container(*ngFor='let group of profileGroups') ng-container(*ngIf='isGroupVisible(group)') .list-group-item.list-group-item-action.d-flex.align-items-center( - (click)='group.collapsed = !group.collapsed' + (click)='toggleGroupCollapse(group)' ) .fa.fa-fw.fa-chevron-right(*ngIf='group.collapsed') .fa.fa-fw.fa-chevron-down(*ngIf='!group.collapsed') diff --git a/tabby-settings/src/components/profilesSettingsTab.component.ts b/tabby-settings/src/components/profilesSettingsTab.component.ts index 33405328a9..a910a831ad 100644 --- a/tabby-settings/src/components/profilesSettingsTab.component.ts +++ b/tabby-settings/src/components/profilesSettingsTab.component.ts @@ -143,6 +143,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent { refresh (): void { this.profiles = this.config.store.profiles this.profileGroups = [] + const profileGroupCollapsed = JSON.parse(window.localStorage.profileGroupCollapsed ?? '{}') for (const profile of this.profiles) { let group = this.profileGroups.find(x => x.name === profile.group) @@ -151,7 +152,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent { name: profile.group, profiles: [], editable: true, - collapsed: false, + collapsed: profileGroupCollapsed[profile.group ?? ''] ?? false, } this.profileGroups.push(group) } @@ -160,12 +161,14 @@ export class ProfilesSettingsTabComponent extends BaseComponent { this.profileGroups.sort((a, b) => a.name?.localeCompare(b.name ?? '') ?? -1) - this.profileGroups.push({ + const builtIn = { name: this.translate.instant('Built-in'), profiles: this.builtinProfiles, editable: false, collapsed: false, - }) + } + builtIn.collapsed = profileGroupCollapsed[builtIn.name ?? ''] ?? false + this.profileGroups.push(builtIn) } async editGroup (group: ProfileGroup): Promise { @@ -246,6 +249,13 @@ export class ProfilesSettingsTabComponent extends BaseComponent { }[this.profilesService.providerForProfile(profile)?.id ?? ''] ?? 'warning' } + toggleGroupCollapse (group: ProfileGroup): void { + group.collapsed = !group.collapsed + const profileGroupCollapsed = JSON.parse(window.localStorage.profileGroupCollapsed ?? '{}') + profileGroupCollapsed[group.name ?? ''] = group.collapsed + window.localStorage.profileGroupCollapsed = JSON.stringify(profileGroupCollapsed) + } + async editDefaults (provider: ProfileProvider): Promise { const modal = this.ngbModal.open( EditProfileModalComponent,