A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: add support for setting default sidebar tab
Abdullah Atta7e3abc58193d
diff --git a/apps/web/src/components/navigation-menu/index.tsx b/apps/web/src/components/navigation-menu/index.tsxindex 0b8c90703..136a65359 100644--- a/apps/web/src/components/navigation-menu/index.tsx+++ b/apps/web/src/components/navigation-menu/index.tsx@@ -199,7 +199,17 @@ const settings = {function NavigationMenu({ onExpand }: { onExpand?: () => void }) {const isFocusMode = useAppStore((store) => store.isFocusMode);- const [currentTab, setCurrentTab] = useState<(typeof tabs)[number]>(tabs[0]);+ const [currentTab, setCurrentTab] = useState<(typeof tabs)[number]>(() => {+ switch (useSettingStore.getState().defaultSidebarTab) {+ case "notebooks":+ return tabs[1];+ case "tags":+ return tabs[2];+ case "home":+ default:+ return tabs[0];+ }+ });const isNavPaneCollapsed = useAppStore((store) => store.isNavPaneCollapsed);const [expanded, setExpanded] = useState(false);const isCollapsed = isNavPaneCollapsed && !expanded;diff --git a/apps/web/src/dialogs/settings/behaviour-settings.ts b/apps/web/src/dialogs/settings/behaviour-settings.tsindex e05e50073..59aea873f 100644--- a/apps/web/src/dialogs/settings/behaviour-settings.ts+++ b/apps/web/src/dialogs/settings/behaviour-settings.ts@@ -36,6 +36,27 @@ export const BehaviourSettings: SettingsGroup[] = [header: strings.general(),isHidden: () => !isUserPremium(),settings: [+ {+ key: "default-sidebar-tab",+ title: strings.defaultSidebarTab(),+ description: strings.defaultSidebarTabDesc(),+ keywords: ["default sidebar tab"],+ onStateChange: (listener) =>+ useSettingStore.subscribe((s) => s.defaultSidebarTab, listener),+ components: [+ {+ type: "dropdown",+ onSelectionChanged: (value) =>+ useSettingStore.getState().setDefaultSidebarTab(value as any),+ selectedOption: () => useSettingStore.getState().defaultSidebarTab,+ options: [+ { value: "home", title: strings.routes.Notes() },+ { value: "notebooks", title: strings.routes.Notebooks() },+ { value: "tags", title: strings.routes.Tags() }+ ]+ }+ ]+ },{key: "image-compression",title: strings.imageCompression(),diff --git a/apps/web/src/stores/setting-store.ts b/apps/web/src/stores/setting-store.tsindex 5b18ef371..fc921b96f 100644--- a/apps/web/src/stores/setting-store.ts+++ b/apps/web/src/stores/setting-store.ts@@ -76,6 +76,10 @@ class SettingStore extends BaseStore<SettingStore> {type: "route",id: "notes"});+ defaultSidebarTab = Config.get<"home" | "notebooks" | "tags">(+ "sidebarTab",+ "home"+ );imageCompression = Config.get("imageCompression",ImageCompressionOptions.ASK_EVERY_TIME@@ -147,6 +151,11 @@ class SettingStore extends BaseStore<SettingStore> {Config.set("homepage-v2", homepage);};+ setDefaultSidebarTab = (defaultSidebarTab: "home" | "notebooks" | "tags") => {+ this.set({ defaultSidebarTab });+ Config.set("sidebarTab", defaultSidebarTab);+ };+setImageCompression = (imageCompression: ImageCompressionOptions) => {this.set({ imageCompression });Config.set("imageCompression", imageCompression);diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.poindex 0b3c67bfd..97edc865f 100644--- a/packages/intl/locale/en.po+++ b/packages/intl/locale/en.po@@ -1963,6 +1963,10 @@ msgstr "Default notebook cleared"msgid "Default screen to open on app launch"msgstr "Default screen to open on app launch"+#: src/strings.ts:2465+msgid "Default sidebar tab"+msgstr "Default sidebar tab"+#: src/strings.ts:1238msgid "Default snooze time"msgstr "Default snooze time"@@ -5416,6 +5420,10 @@ msgstr "Select nth day of the month to repeat the reminder."msgid "Select profile picture"msgstr "Select profile picture"+#: src/strings.ts:2466+msgid "Select the default sidebar tab"+msgstr "Select the default sidebar tab"+#: src/strings.ts:374msgid "Select the folder that includes your backup files to list them here."msgstr "Select the folder that includes your backup files to list them here."diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.poindex 7b3856e03..6fe388ce7 100644--- a/packages/intl/locale/pseudo-LOCALE.po+++ b/packages/intl/locale/pseudo-LOCALE.po@@ -1952,6 +1952,10 @@ msgstr ""msgid "Default screen to open on app launch"msgstr ""+#: src/strings.ts:2465+msgid "Default sidebar tab"+msgstr ""+#: src/strings.ts:1238msgid "Default snooze time"msgstr ""@@ -5390,6 +5394,10 @@ msgstr ""msgid "Select profile picture"msgstr ""+#: src/strings.ts:2466+msgid "Select the default sidebar tab"+msgstr ""+#: src/strings.ts:374msgid "Select the folder that includes your backup files to list them here."msgstr ""diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.tsindex cda819e1c..9b4108da0 100644--- a/packages/intl/src/strings.ts+++ b/packages/intl/src/strings.ts@@ -2461,5 +2461,7 @@ Use this if changes from other devices are not appearing on this device. This wiaddToNotebook: () => t`Add to notebook`,notebookAdded: () => t`Notebook added`,addNotes: () => t`Add notes`,- setAsHomepage: () => t`Set as homepage`+ setAsHomepage: () => t`Set as homepage`,+ defaultSidebarTab: () => t`Default sidebar tab`,+ defaultSidebarTabDesc: () => t`Select the default sidebar tab`};