mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
web: fix type errors
This commit is contained in:
@@ -32,7 +32,7 @@ function EditorFooter() {
|
||||
const activeSessionId = useEditorStore((store) => store.activeSessionId);
|
||||
const { words } = useNoteStatistics(activeSessionId || "unknown");
|
||||
const saveState = useEditorStore(
|
||||
(store) => store.getActiveSession(["default", "unlocked"])?.saveState
|
||||
(store) => store.getActiveSession(["default"])?.saveState
|
||||
);
|
||||
const SaveStateIcon = saveState ? SAVE_STATE_ICON_MAP[saveState] : null;
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ import {
|
||||
} from "@notesnook/common";
|
||||
import {
|
||||
Color,
|
||||
Note,
|
||||
Note as NoteType,
|
||||
Notebook as NotebookItem,
|
||||
Tag,
|
||||
createInternalLink
|
||||
@@ -94,11 +94,10 @@ import { MenuItem } from "@notesnook/ui";
|
||||
import { Context } from "../list-container/types";
|
||||
import { SchemeColors } from "@notesnook/theme";
|
||||
import FileSaver from "file-saver";
|
||||
import Vault from "../../common/vault";
|
||||
import { writeToClipboard } from "../../utils/clipboard";
|
||||
|
||||
type NoteProps = NoteResolvedData & {
|
||||
item: Note;
|
||||
item: NoteType;
|
||||
context?: Context;
|
||||
date: number;
|
||||
simplified?: boolean;
|
||||
@@ -326,7 +325,7 @@ const formats = [
|
||||
const notFullySyncedText =
|
||||
"Cannot perform this action because note is not fully synced.";
|
||||
const menuItems: (
|
||||
note: Note,
|
||||
note: NoteType,
|
||||
ids?: string[],
|
||||
context?: { color?: Color; locked?: boolean }
|
||||
) => MenuItem[] = (note, ids = [], context) => {
|
||||
|
||||
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React, { useCallback, useRef } from "react";
|
||||
import React, { useRef } from "react";
|
||||
import { Flex, Text } from "@theme-ui/components";
|
||||
import ListItem from "../list-item";
|
||||
import { useStore, store } from "../../stores/notebook-store";
|
||||
@@ -41,12 +41,12 @@ import { pluralize } from "@notesnook/common";
|
||||
import { confirm } from "../../common/dialog-controller";
|
||||
import { getFormattedDate } from "@notesnook/common";
|
||||
import { MenuItem } from "@notesnook/ui";
|
||||
import { Notebook } from "@notesnook/core";
|
||||
import { Notebook as NotebookType } from "@notesnook/core";
|
||||
import { handleDrop } from "../../common/drop-handler";
|
||||
import { useDragHandler } from "../../hooks/use-drag-handler";
|
||||
|
||||
type NotebookProps = {
|
||||
item: Notebook;
|
||||
item: NotebookType;
|
||||
totalNotes: number;
|
||||
date: number;
|
||||
simplified?: boolean;
|
||||
@@ -148,7 +148,7 @@ export default React.memo(Notebook, (prev, next) => {
|
||||
});
|
||||
|
||||
export const notebookMenuItems: (
|
||||
notebook: Notebook,
|
||||
notebook: NotebookType,
|
||||
ids?: string[]
|
||||
) => MenuItem[] = (notebook, ids = []) => {
|
||||
const defaultNotebook = db.settings.getDefaultNotebook();
|
||||
@@ -231,7 +231,7 @@ export const notebookMenuItems: (
|
||||
];
|
||||
};
|
||||
|
||||
async function openNotebook(notebook: Notebook, totalNotes?: number) {
|
||||
async function openNotebook(notebook: NotebookType, totalNotes?: number) {
|
||||
await useNotesStore.getState().setContext({
|
||||
type: "notebook",
|
||||
id: notebook.id,
|
||||
|
||||
@@ -29,11 +29,11 @@ import { Edit, Shortcut, DeleteForver } from "../icons";
|
||||
import { showToast } from "../../utils/toast";
|
||||
import { pluralize } from "@notesnook/common";
|
||||
import { MenuItem } from "@notesnook/ui";
|
||||
import { Tag } from "@notesnook/core/dist/types";
|
||||
import { Tag as TagType } from "@notesnook/core";
|
||||
import { showEditTagDialog } from "../../common/dialog-controller";
|
||||
import { handleDrop } from "../../common/drop-handler";
|
||||
|
||||
type TagProps = { item: Tag; totalNotes: number };
|
||||
type TagProps = { item: TagType; totalNotes: number };
|
||||
function Tag(props: TagProps) {
|
||||
const { item, totalNotes } = props;
|
||||
const { id, title } = item;
|
||||
@@ -68,7 +68,10 @@ function Tag(props: TagProps) {
|
||||
}
|
||||
export default Tag;
|
||||
|
||||
const menuItems: (tag: Tag, ids?: string[]) => MenuItem[] = (tag, ids = []) => {
|
||||
const menuItems: (tag: TagType, ids?: string[]) => MenuItem[] = (
|
||||
tag,
|
||||
ids = []
|
||||
) => {
|
||||
return [
|
||||
{
|
||||
type: "button",
|
||||
|
||||
@@ -26,11 +26,10 @@ import TimeAgo from "../time-ago";
|
||||
import { pluralize, toTitleCase } from "@notesnook/common";
|
||||
import { showToast } from "../../utils/toast";
|
||||
import { MenuItem } from "@notesnook/ui";
|
||||
import { TrashItem } from "@notesnook/core/dist/types";
|
||||
import { db } from "../../common/db";
|
||||
import { TrashItem as TrashItemType } from "@notesnook/core/dist/types";
|
||||
import { useEditorStore } from "../../stores/editor-store";
|
||||
|
||||
type TrashItemProps = { item: TrashItem; date: number };
|
||||
type TrashItemProps = { item: TrashItemType; date: number };
|
||||
function TrashItem(props: TrashItemProps) {
|
||||
const { item, date } = props;
|
||||
const isOpened = useEditorStore((store) => store.activeSessionId === item.id);
|
||||
@@ -65,7 +64,7 @@ function TrashItem(props: TrashItemProps) {
|
||||
}
|
||||
export default TrashItem;
|
||||
|
||||
const menuItems: (item: TrashItem, ids?: string[]) => MenuItem[] = (
|
||||
const menuItems: (item: TrashItemType, ids?: string[]) => MenuItem[] = (
|
||||
item,
|
||||
ids = []
|
||||
) => {
|
||||
|
||||
@@ -37,8 +37,7 @@ import {
|
||||
Privacy,
|
||||
Pro,
|
||||
ShieldLock,
|
||||
Sync,
|
||||
Proxy
|
||||
Sync
|
||||
} from "../../components/icons";
|
||||
import { Perform } from "../../common/dialog-controller";
|
||||
import NavigationItem from "../../components/navigation-menu/navigation-item";
|
||||
|
||||
@@ -120,10 +120,10 @@ function scheduleReminder(id: string, reminder: Reminder, cron: string) {
|
||||
} else {
|
||||
const notification = new Notification(reminder.title, {
|
||||
body: reminder.description,
|
||||
vibrate: reminder.priority === "vibrate" ? 200 : undefined,
|
||||
// vibrate: reminder.priority === "vibrate" ? 200 : undefined,
|
||||
silent: reminder.priority === "silent",
|
||||
tag: id,
|
||||
renotify: true,
|
||||
// renotify: true,
|
||||
requireInteraction: true
|
||||
});
|
||||
|
||||
|
||||
@@ -156,10 +156,9 @@ class SettingStore extends BaseStore<SettingStore> {
|
||||
Config.set("doubleSpacedLines", !doubleSpacedParagraphs);
|
||||
};
|
||||
|
||||
toggleMarkdownShortcuts = (toggleState) => {
|
||||
toggleMarkdownShortcuts = (toggleState?: boolean) => {
|
||||
this.set((state) => {
|
||||
state.markdownShortcuts =
|
||||
toggleState !== undefined ? toggleState : !state.markdownShortcuts;
|
||||
state.markdownShortcuts = toggleState ?? !state.markdownShortcuts;
|
||||
Config.set("markdownShortcuts", state.markdownShortcuts);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user