diff --git a/apps/web/src/app.tsx b/apps/web/src/app.tsx index ce66d125a..854574ccb 100644 --- a/apps/web/src/app.tsx +++ b/apps/web/src/app.tsx @@ -170,7 +170,7 @@ function DesktopAppContents() { zIndex: 3 }} > - navPane.current?.expand(0)} /> + navPane.current?.reset(0)} /> )} {!isFocusMode && isListPaneVisible ? ( diff --git a/apps/web/src/components/navigation-menu/index.tsx b/apps/web/src/components/navigation-menu/index.tsx index 97a9a5393..d1064ee8c 100644 --- a/apps/web/src/components/navigation-menu/index.tsx +++ b/apps/web/src/components/navigation-menu/index.tsx @@ -17,13 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import React, { - useCallback, - useEffect, - useMemo, - useRef, - useState -} from "react"; +import React, { useEffect, useMemo, useRef, useState } from "react"; import { Box, Button, Flex, Image, Text } from "@theme-ui/components"; import { Note, @@ -99,16 +93,12 @@ import Tags from "../../views/tags"; import { Notebooks } from "../../views/notebooks"; import { UserProfile } from "../../dialogs/settings/components/user-profile"; import { SUBSCRIPTION_STATUS } from "../../common/constants"; -import { ConfirmDialog, showLogoutConfirmation } from "../../dialogs/confirm"; -import { CREATE_BUTTON_MAP, createBackup, logout } from "../../common"; -import { TaskManager } from "../../common/task-manager"; -import { showToast } from "../../utils/toast"; +import { CREATE_BUTTON_MAP, logout } from "../../common"; import { TabItem } from "./tab-item"; import Notice from "../notice"; import { usePromise } from "@notesnook/common"; import { showSortMenu } from "../group-header"; import { Freeze } from "react-freeze"; -import { logger } from "../../utils/logger"; type Route = { id: "notes" | "favorites" | "reminders" | "monographs" | "trash"; @@ -288,6 +278,7 @@ function NavigationMenu({ onExpand }: { onExpand?: () => void }) { variant="secondary" sx={{ p: 1, bg: "transparent" }} onClick={onExpand} + title={strings.expandSidebar()} > diff --git a/apps/web/src/components/route-container/index.tsx b/apps/web/src/components/route-container/index.tsx index 6ab4b7a4f..113db0ddc 100644 --- a/apps/web/src/components/route-container/index.tsx +++ b/apps/web/src/components/route-container/index.tsx @@ -18,16 +18,13 @@ along with this program. If not, see . */ import { PropsWithChildren, useRef } from "react"; -import { Box, Button, Flex, Text } from "@theme-ui/components"; -import { ArrowLeft, Menu, Search, Plus, Close, AddReminder } from "../icons"; -import { useStore } from "../../stores/app-store"; +import { Box } from "@theme-ui/components"; +import { Close, AddReminder } from "../icons"; import { useStore as useSearchStore } from "../../stores/search-store"; import useMobile from "../../hooks/use-mobile"; import { debounce, usePromise } from "@notesnook/common"; import Field from "../field"; import { strings } from "@notesnook/intl"; -import { TITLE_BAR_HEIGHT } from "../title-bar"; -import { AppEventManager, AppEvents } from "../../common/app-events"; import { RouteResult } from "../../navigation/types"; import { CREATE_BUTTON_MAP } from "../../common"; @@ -160,145 +157,4 @@ function Header(props: RouteContainerProps) { /> ); - // if (isSearching) - // return ( - // - // useSearchStore.setState({ query: e.target.value }), - // 250 - // )} - // onKeyUp={(e) => { - // if (e.key === "Escape") - // useSearchStore.setState({ - // isSearching: false, - // searchType: undefined - // }); - // }} - // action={{ - // icon: Close, - // testId: "search-button", - // onClick: () => - // useSearchStore.setState({ - // isSearching: false, - // searchType: undefined - // }) - // }} - // /> - // - // ); - - // return ( - // - // - // {buttons?.back ? ( - // - // ) : ( - // - // )} - // {titlePromise.status === "fulfilled" && titlePromise.value && ( - // - // {titlePromise.value} - // - // )} - // - // - // {buttons?.search && ( - // - // )} - // {!isMobile && buttons?.create && ( - // - // )} - // - // - // ); } diff --git a/apps/web/src/components/split-pane/index.tsx b/apps/web/src/components/split-pane/index.tsx index facf25774..20b21b873 100644 --- a/apps/web/src/components/split-pane/index.tsx +++ b/apps/web/src/components/split-pane/index.tsx @@ -60,6 +60,7 @@ type PaneOptions = { export type SplitPaneImperativeHandle = { collapse: (index: number) => void; expand: (index: number) => void; + reset: (index: number) => void; isCollapsed: (index: number) => boolean; }; export const SplitPane = React.forwardRef< @@ -285,6 +286,13 @@ export const SplitPane = React.forwardRef< currentPane.expandedSize = undefined; setSizes(paneSizes.current, wrapSize.current); }, + reset: (index: number) => { + const currentPane = paneSizes.current[index]; + currentPane.collapsed = false; + currentPane.size = currentPane.initialSize; + currentPane.expandedSize = undefined; + setSizes(paneSizes.current, wrapSize.current); + }, isCollapsed: (index: number) => { return paneSizes.current[index].collapsed; } diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po index 8ad5c55de..1091068b7 100644 --- a/packages/intl/locale/en.po +++ b/packages/intl/locale/en.po @@ -2508,6 +2508,10 @@ msgstr "Exit fullscreen" msgid "Expand" msgstr "Expand" +#: src/strings.ts:2441 +msgid "Expand sidebar" +msgstr "Expand sidebar" + #: src/strings.ts:2053 msgid "Experience the next level of private note taking\"" msgstr "Experience the next level of private note taking\"" diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po index 4f03f6fe1..778e54fb3 100644 --- a/packages/intl/locale/pseudo-LOCALE.po +++ b/packages/intl/locale/pseudo-LOCALE.po @@ -2497,6 +2497,10 @@ msgstr "" msgid "Expand" msgstr "" +#: src/strings.ts:2441 +msgid "Expand sidebar" +msgstr "" + #: src/strings.ts:2053 msgid "Experience the next level of private note taking\"" msgstr "" diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts index c092bb68c..1f138ca0d 100644 --- a/packages/intl/src/strings.ts +++ b/packages/intl/src/strings.ts @@ -2439,5 +2439,6 @@ Use this if changes from other devices are not appearing on this device. This wi stable: () => t`Stable`, beta: () => t`Beta`, zoom: () => t`Zoom`, - toggleFocusMode: () => t`Toggle focus mode` + toggleFocusMode: () => t`Toggle focus mode`, + expandSidebar: () => t`Expand sidebar` };