Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix types

Ammar Ahmed665f44bcee57
diff --git a/apps/mobile/app/components/list-items/note/index.tsx b/apps/mobile/app/components/list-items/note/index.tsx
index a5f1f0231..f40c1a5ca 100644
--- a/apps/mobile/app/components/list-items/note/index.tsx
+++ b/apps/mobile/app/components/list-items/note/index.tsx
@@ -37,10 +37,7 @@ import { useEditorStore } from "../../../stores/use-editor-store";
import useNavigationStore from "../../../stores/use-navigation-store";
import { useRelationStore } from "../../../stores/use-relation-store";
import { SIZE } from "../../../utils/size";
-import {
- NotebooksWithDateEdited,
- TagsWithDateEdited
-} from "../../list/list-item.wrapper";
+
import { Properties } from "../../properties";
import { Button } from "../../ui/button";
import { IconButton } from "../../ui/icon-button";
@@ -48,6 +45,10 @@ import { ReminderTime } from "../../ui/reminder-time";
import { TimeSince } from "../../ui/time-since";
import Heading from "../../ui/typography/heading";
import Paragraph from "../../ui/typography/paragraph";
+import {
+ NotebooksWithDateEdited,
+ TagsWithDateEdited
+} from "../../../stores/resolve-items";
type NoteItemProps = {
item: Note | BaseTrashItem<Note>;
diff --git a/apps/mobile/app/components/list-items/note/wrapper.tsx b/apps/mobile/app/components/list-items/note/wrapper.tsx
index 13cb5de0b..20e2cdc80 100644
--- a/apps/mobile/app/components/list-items/note/wrapper.tsx
+++ b/apps/mobile/app/components/list-items/note/wrapper.tsx
@@ -33,12 +33,13 @@ import { useEditorStore } from "../../../stores/use-editor-store";
import { useSelectionStore } from "../../../stores/use-selection-store";
import { eOnLoadNote, eShowMergeDialog } from "../../../utils/events";
import { tabBarRef } from "../../../utils/global-refs";
-import type {
- NotebooksWithDateEdited,
- TagsWithDateEdited
-} from "../../list/list-item.wrapper";
+
import NotePreview from "../../note-history/preview";
import SelectionWrapper from "../selection-wrapper";
+import {
+ NotebooksWithDateEdited,
+ TagsWithDateEdited
+} from "../../../stores/resolve-items";
export const openNote = async (
item: Note,
@@ -51,15 +52,20 @@ export const openNote = async (
if (!isTrash) {
note = (await db.notes.note(item.id)) as Note;
}
-
- const { selectedItemsList, selectionMode, clearSelection, setSelectedItem } =
- useSelectionStore.getState();
-
- if (selectedItemsList.length > 0 && selectionMode === item.type) {
- setSelectedItem(note.id);
+ if (useSelectionStore.getState().selectionMode === item.type) {
+ const {
+ selectedItemsList,
+ selectionMode,
+ clearSelection,
+ setSelectedItem
+ } = useSelectionStore.getState();
+
+ if (selectedItemsList.length > 0 && selectionMode === item.type) {
+ setSelectedItem(note.id);
+ } else {
+ clearSelection();
+ }
return;
- } else {
- clearSelection();
}
if (note.conflicted) {
@@ -88,7 +94,9 @@ export const openNote = async (
)
});
} else {
- useEditorStore.getState().setReadonly(note?.readonly);
+ if (note?.readonly) {
+ useEditorStore.getState().setReadonly(note?.readonly);
+ }
eSendEvent(eOnLoadNote, {
item: note
});