diff --git a/apps/mobile/app/components/list-items/headers/header.tsx b/apps/mobile/app/components/list-items/headers/header.tsx index a90fe430c..3811934ad 100644 --- a/apps/mobile/app/components/list-items/headers/header.tsx +++ b/apps/mobile/app/components/list-items/headers/header.tsx @@ -51,19 +51,11 @@ export const Header = React.memo( {announcements.length !== 0 && !noAnnouncement ? ( ) : (screen as any) === "Search" ? null : !shouldShow ? ( - + <> {messageCard ? ( ) : null} - + ) : null} ); diff --git a/apps/mobile/app/components/list-items/note/index.tsx b/apps/mobile/app/components/list-items/note/index.tsx index e8ef4481c..0ed99bac3 100644 --- a/apps/mobile/app/components/list-items/note/index.tsx +++ b/apps/mobile/app/components/list-items/note/index.tsx @@ -405,7 +405,7 @@ const NoteItem = ({ ) : null} - {selectionMode ? ( + {selectionMode === "note" || selectionMode === "trash" ? ( <> ; @@ -50,6 +53,8 @@ export const NotebookItem = ({ const compactMode = useIsCompactModeEnabled( (item as TrashItem).itemType || item.type ); + const selectionMode = useSelectionStore((state) => state.selectionMode); + const [selected] = useIsSelected(item); return ( <> @@ -185,21 +190,30 @@ export const NotebookItem = ({ ) : null} - - Properties.present(item)} - style={{ - justifyContent: "center", - height: 35, - width: 35, - borderRadius: 100, - alignItems: "center" - }} - /> + {selectionMode === "notebook" || selectionMode === "trash" ? ( + <> + + + ) : ( + Properties.present(item)} + style={{ + justifyContent: "center", + height: 35, + width: 35, + borderRadius: 100, + alignItems: "center" + }} + /> + )} ); diff --git a/apps/mobile/app/components/list-items/reminder/index.tsx b/apps/mobile/app/components/list-items/reminder/index.tsx index b4e4009bc..4ada4924c 100644 --- a/apps/mobile/app/components/list-items/reminder/index.tsx +++ b/apps/mobile/app/components/list-items/reminder/index.tsx @@ -31,6 +31,9 @@ import Heading from "../../ui/typography/heading"; import Paragraph from "../../ui/typography/paragraph"; import SelectionWrapper, { selectItem } from "../selection-wrapper"; import { strings } from "@notesnook/intl"; +import { useSelectionStore } from "../../../stores/use-selection-store"; +import useIsSelected from "../../../hooks/use-selected"; +import AppIcon from "../../ui/AppIcon"; const ReminderItem = React.memo( ({ @@ -48,6 +51,8 @@ const ReminderItem = React.memo( ReminderSheet.present(item, undefined, isSheet); }; + const selectionMode = useSelectionStore((state) => state.selectionMode); + const [selected] = useIsSelected(item); return ( - Properties.present(item, isSheet)} - style={{ - justifyContent: "center", - height: 35, - width: 35, - borderRadius: 100, - alignItems: "center" - }} - /> + + {selectionMode === "note" || selectionMode === "trash" ? ( + <> + + + ) : ( + Properties.present(item, isSheet)} + style={{ + justifyContent: "center", + height: 35, + width: 35, + borderRadius: 100, + alignItems: "center" + }} + /> + )} ); }, diff --git a/apps/mobile/app/components/list/index.tsx b/apps/mobile/app/components/list/index.tsx index 0651bb27d..aaa1887a3 100644 --- a/apps/mobile/app/components/list/index.tsx +++ b/apps/mobile/app/components/list/index.tsx @@ -26,7 +26,7 @@ import { NativeSyntheticEvent, RefreshControl } from "react-native"; -import Animated, { FadeInDown } from "react-native-reanimated"; +import Animated, { FadeIn } from "react-native-reanimated"; import { notesnook } from "../../../e2e/test.ids"; import { useGroupOptions } from "../../hooks/use-group-options"; import { eSendEvent } from "../../services/event-manager"; @@ -149,7 +149,7 @@ export default function List(props: ListProps) { style={{ flex: 1 }} - entering={props.renderedInRoute === "Search" ? undefined : FadeInDown} + entering={props.renderedInRoute === "Search" ? undefined : FadeIn} > { const menuRef = useRef(null); - const { colors: contextMenuColors } = useThemeColors("contextMenu"); const { colors } = useThemeColors(); const selectionMode = useSelectionStore((state) => state.selectionMode); const selectedItemsList = useSelectionStore( (state) => state.selectedItemsList ); const clearSelection = useSelectionStore((state) => state.clearSelection); - const insets = useGlobalSafeAreaInsets(); const allSelected = items?.placeholders?.length === selectedItemsList.length; const focusedRouteId = useNavigationStore((state) => state.focusedRouteId); @@ -102,8 +100,11 @@ export const SelectionHeader = React.memo( const deleteItem = async () => { if (!type) return; presentDialog({ - title: strings.doActions.delete.unknown(type, selectedItemsList.length), - paragraph: strings.actionConfirmations.delete.unknown( + title: strings.doActions.permanentlyDelete.unknown( + type, + selectedItemsList.length + ), + paragraph: strings.actionConfirmations.permanentlyDelete.unknown( type, selectedItemsList.length ), @@ -112,7 +113,7 @@ export const SelectionHeader = React.memo( positivePress: async () => { if (!selectedItemsList.length) return; await db.trash.delete(...selectedItemsList); - Navigation.queueRoutesForUpdate(); + useTrashStore.getState().refresh(); clearSelection(); }, positiveType: "errorShade" diff --git a/apps/mobile/app/navigation/navigation-stack.tsx b/apps/mobile/app/navigation/navigation-stack.tsx index ae8378c44..13ac46915 100644 --- a/apps/mobile/app/navigation/navigation-stack.tsx +++ b/apps/mobile/app/navigation/navigation-stack.tsx @@ -29,14 +29,12 @@ import { hideAllTooltips } from "../hooks/use-tooltip"; import Favorites from "../screens/favorites"; import Home from "../screens/home"; import NotebookScreen from "../screens/notebook"; -import Notebooks from "../screens/notebooks"; import { ColoredNotes } from "../screens/notes/colored"; import { Monographs } from "../screens/notes/monographs"; import { TaggedNotes } from "../screens/notes/tagged"; import Reminders from "../screens/reminders"; import { Search } from "../screens/search"; import Settings from "../screens/settings"; -import Tags from "../screens/tags"; import Trash from "../screens/trash"; import SettingsService from "../services/settings"; import useNavigationStore, { @@ -72,10 +70,8 @@ const AppNavigation = React.memo( }} > - - diff --git a/apps/mobile/app/screens/notebooks/index.tsx b/apps/mobile/app/screens/notebooks/index.tsx deleted file mode 100644 index ee54dc569..000000000 --- a/apps/mobile/app/screens/notebooks/index.tsx +++ /dev/null @@ -1,119 +0,0 @@ -/* -This file is part of the Notesnook project (https://notesnook.com/) - -Copyright (C) 2023 Streetwriters (Private) Limited - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -import React, { useEffect } from "react"; -import { Config } from "react-native-config"; -import { FloatingButton } from "../../components/container/floating-button"; -import DelayLayout from "../../components/delay-layout"; -import { Header } from "../../components/header"; -import List from "../../components/list"; -import SelectionHeader from "../../components/selection-header"; -import { AddNotebookSheet } from "../../components/sheets/add-notebook"; -import { Walkthrough } from "../../components/walkthroughs"; -import { useNavigationFocus } from "../../hooks/use-navigation-focus"; -import Navigation, { NavigationProps } from "../../services/navigation"; -import SettingsService from "../../services/settings"; -import useNavigationStore from "../../stores/use-navigation-store"; -import { useNotebooks } from "../../stores/use-notebook-store"; -import { strings } from "@notesnook/intl"; - -const onButtonPress = () => { - AddNotebookSheet.present(); -}; - -export const Notebooks = ({ - navigation, - route -}: NavigationProps<"Notebooks">) => { - const [notebooks, loading] = useNotebooks(); - - const isFocused = useNavigationFocus(navigation, { - onFocus: (prev) => { - Navigation.routeNeedsUpdate( - route.name, - Navigation.routeUpdateFunctions[route.name] - ); - useNavigationStore.getState().setFocusedRouteId(route.name); - return false; - }, - onBlur: () => false, - delay: SettingsService.get().homepage === route.name ? 1 : -1 - }); - - useEffect(() => { - if (notebooks?.placeholders) { - if (notebooks?.placeholders?.length === 0 && !Config.isTesting) { - Walkthrough.present("notebooks"); - } else { - Walkthrough.update("notebooks"); - } - } - }, [notebooks]); - - return ( - <> - -
{ - Navigation.push("Search", { - placeholder: strings.searchInRoute(route.name), - type: "notebook", - title: route.name, - route: route.name - }); - }} - onPressDefaultRightButton={onButtonPress} - /> - - - - {!notebooks || - notebooks.placeholders.length === 0 || - !isFocused ? null : ( - - )} - - - ); -}; - -export default Notebooks; diff --git a/apps/mobile/app/screens/tags/index.tsx b/apps/mobile/app/screens/tags/index.tsx deleted file mode 100644 index ec7d90c90..000000000 --- a/apps/mobile/app/screens/tags/index.tsx +++ /dev/null @@ -1,88 +0,0 @@ -/* -This file is part of the Notesnook project (https://notesnook.com/) - -Copyright (C) 2023 Streetwriters (Private) Limited - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -import React from "react"; -import DelayLayout from "../../components/delay-layout"; -import { Header } from "../../components/header"; -import List from "../../components/list"; -import SelectionHeader from "../../components/selection-header"; -import { useNavigationFocus } from "../../hooks/use-navigation-focus"; -import Navigation, { NavigationProps } from "../../services/navigation"; -import SettingsService from "../../services/settings"; -import useNavigationStore from "../../stores/use-navigation-store"; -import { useTags } from "../../stores/use-tag-store"; -import { strings } from "@notesnook/intl"; - -export const Tags = ({ navigation, route }: NavigationProps<"Tags">) => { - const [tags, loading] = useTags(); - const isFocused = useNavigationFocus(navigation, { - onFocus: (prev) => { - Navigation.routeNeedsUpdate( - route.name, - Navigation.routeUpdateFunctions[route.name] - ); - useNavigationStore.getState().setFocusedRouteId(route.name); - return !prev?.current; - }, - onBlur: () => false, - delay: SettingsService.get().homepage === route.name ? 1 : -1 - }); - - return ( - <> - -
{ - Navigation.push("Search", { - placeholder: strings.searchInRoute(route.name), - type: "tag", - title: route.name, - route: route.name - }); - }} - /> - - - - - ); -}; - -export default Tags;