mobile: fix types

This commit is contained in:
Ammar Ahmed
2023-12-18 08:50:01 +05:00
committed by Abdullah Atta
parent 1429bdfba9
commit 831ef4173d
2 changed files with 25 additions and 16 deletions

View File

@@ -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>;

View File

@@ -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;
}
if (useSelectionStore.getState().selectionMode === item.type) {
const {
selectedItemsList,
selectionMode,
clearSelection,
setSelectedItem
} = useSelectionStore.getState();
const { selectedItemsList, selectionMode, clearSelection, setSelectedItem } =
useSelectionStore.getState();
if (selectedItemsList.length > 0 && selectionMode === item.type) {
setSelectedItem(note.id);
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
});