mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
core: add sidebar order settings
This commit is contained in:
committed by
Abdullah Atta
parent
bc03ad8339
commit
884fbf65e9
@@ -24,6 +24,7 @@ import {
|
||||
GroupingKey,
|
||||
SettingItem,
|
||||
SettingItemMap,
|
||||
SideBarSectionKey,
|
||||
ToolbarConfig,
|
||||
ToolbarConfigPlatforms,
|
||||
TrashCleanupInterval
|
||||
@@ -60,7 +61,15 @@ const defaultSettings: SettingItemMap = {
|
||||
"groupOptions:reminders": DEFAULT_GROUP_OPTIONS("reminders"),
|
||||
|
||||
"toolbarConfig:desktop": undefined,
|
||||
"toolbarConfig:mobile": undefined
|
||||
"toolbarConfig:mobile": undefined,
|
||||
|
||||
"sideBarOrder:colors": [],
|
||||
"sideBarOrder:menu": [],
|
||||
"sideBarOrder:pinned": [],
|
||||
|
||||
"sideBarHiddenItems:colors": [],
|
||||
"sideBarHiddenItems:menu": [],
|
||||
"sideBarHiddenItems:pinned": []
|
||||
};
|
||||
|
||||
export class Settings implements ICollection {
|
||||
@@ -167,4 +176,20 @@ export class Settings implements ICollection {
|
||||
setTimeFormat(format: TimeFormat) {
|
||||
return this.set("timeFormat", format);
|
||||
}
|
||||
|
||||
getSideBarOrder(section: SideBarSectionKey) {
|
||||
return this.get(`sideBarOrder:${section}`);
|
||||
}
|
||||
|
||||
setSideBarOrder(section: SideBarSectionKey, order: string[]) {
|
||||
return this.set(`sideBarOrder:${section}`, order);
|
||||
}
|
||||
|
||||
getSideBarHiddenItems(section: SideBarSectionKey) {
|
||||
return this.get(`sideBarHiddenItems:${section}`);
|
||||
}
|
||||
|
||||
setSideBarHiddenItems(section: SideBarSectionKey, order: string[]) {
|
||||
return this.set(`sideBarHiddenItems:${section}`, order);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,9 @@ const DataMappers: Partial<Record<ItemType, (row: any) => void>> = {
|
||||
if (
|
||||
row.value &&
|
||||
(row.key.startsWith("groupOptions") ||
|
||||
row.key.startsWith("toolbarConfig"))
|
||||
row.key.startsWith("toolbarConfig") ||
|
||||
row.key.startsWith("sideBarOrder") ||
|
||||
row.key.startsWith("sideBarHidenItems"))
|
||||
)
|
||||
row.value = JSON.parse(row.value);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user