diff --git a/apps/mobile/app/components/sheets/relations-list/index.tsx b/apps/mobile/app/components/sheets/relations-list/index.tsx
deleted file mode 100644
index 7bb9ab8ae..000000000
--- a/apps/mobile/app/components/sheets/relations-list/index.tsx
+++ /dev/null
@@ -1,173 +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 { Item, ItemReference, VirtualizedGrouping } from "@notesnook/core";
-import { strings } from "@notesnook/intl";
-import { useThemeColors } from "@notesnook/theme";
-import React, { RefObject, useEffect, useState } from "react";
-import { View } from "react-native";
-import { ActionSheetRef } from "react-native-actions-sheet";
-import Icon from "react-native-vector-icons/MaterialCommunityIcons";
-import { db } from "../../../common/database";
-import {
- PresentSheetOptions,
- presentSheet
-} from "../../../services/event-manager";
-import { useRelationStore } from "../../../stores/use-relation-store";
-import { AppFontSize } from "../../../utils/size";
-import { DefaultAppStyles } from "../../../utils/styles";
-import DialogHeader from "../../dialog/dialog-header";
-import List from "../../list";
-import SheetProvider from "../../sheet-provider";
-import { Button, ButtonProps } from "../../ui/button";
-import Paragraph from "../../ui/typography/paragraph";
-
-type RelationsListProps = {
- actionSheetRef: RefObject;
- close?: () => void;
- update?: (options: PresentSheetOptions) => void;
- item: { id: string; type: string };
- referenceType: string;
- relationType: "to" | "from";
- title: string;
- button?: ButtonProps;
- onAdd: () => void;
-};
-
-const IconsByType = {
- reminder: "bell"
-};
-
-export const RelationsList = ({
- actionSheetRef,
- item,
- referenceType,
- relationType,
- title,
- button,
- onAdd
-}: RelationsListProps) => {
- const updater = useRelationStore((state) => state.updater);
- const { colors } = useThemeColors();
- const [items, setItems] = useState>();
- const hasNoRelations = !items || items?.placeholders?.length === 0;
-
- useEffect(() => {
- db.relations?.[relationType]?.(
- { id: item?.id, type: item?.type } as ItemReference,
- referenceType as any
- )
- .selector.sorted({
- sortBy: "dateEdited",
- sortDirection: "desc"
- })
- .then((grouped) => {
- setTimeout(() => {
- setItems(grouped);
- }, 300);
- });
- }, [relationType, referenceType, item?.id, item?.type, updater]);
-
- return (
-
-
-
- {hasNoRelations ? (
-
-
- {strings.noLinksFound()}
-
- ) : (
-
- )}
-
- );
-};
-
-RelationsList.present = ({
- reference,
- referenceType,
- relationType,
- title,
- button,
- onAdd
-}: {
- reference: { id: string; type: string };
- referenceType: string;
- relationType: "to" | "from";
- title: string;
- button?: ButtonProps;
- onAdd: () => void;
-}) => {
- presentSheet({
- component: (ref, close, update) => (
-
- )
- });
-};
diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx
index 74fc1daf9..1dd317d3c 100644
--- a/apps/mobile/app/hooks/use-actions.tsx
+++ b/apps/mobile/app/hooks/use-actions.tsx
@@ -45,11 +45,11 @@ import ExportNotesSheet from "../components/sheets/export-notes";
import PaywallSheet from "../components/sheets/paywall";
import PublishNoteSheet from "../components/sheets/publish-note";
import { ReferencesList } from "../components/sheets/references";
-import { RelationsList } from "../components/sheets/relations-list/index";
import { useSideBarDraggingStore } from "../components/side-menu/dragging-store";
import { ButtonProps } from "../components/ui/button";
import AddReminder from "../screens/add-reminder";
import { useTabStore } from "../screens/editor/tiptap/use-tab-store";
+import RelationsList from "../screens/relations-list";
import {
eSendEvent,
eSubscribeEvent,
@@ -1047,8 +1047,9 @@ export const useActions = ({
title: strings.dataTypesPluralCamelCase.reminder(),
icon: "clock-outline",
onPress: async () => {
+ close();
RelationsList.present({
- reference: item,
+ item,
referenceType: "reminder",
relationType: "from",
title: strings.dataTypesPluralCamelCase.reminder(),
@@ -1065,26 +1066,6 @@ export const useActions = ({
}
AddReminder.present(undefined, item);
close();
- },
- button: {
- type: "plain",
- onPress: async () => {
- if (features && !features.activeReminders.isAllowed) {
- ToastManager.show({
- type: "info",
- message: features.activeReminders.error,
- actionText: strings.upgrade(),
- func: () => {
- PaywallSheet.present(features.activeReminders);
- }
- });
- return;
- }
- AddReminder.present(undefined, item);
- close();
- },
- icon: "plus",
- iconSize: 20
}
});
},
diff --git a/apps/mobile/app/navigation/navigation-stack.tsx b/apps/mobile/app/navigation/navigation-stack.tsx
index 3604bce27..a357f1468 100644
--- a/apps/mobile/app/navigation/navigation-stack.tsx
+++ b/apps/mobile/app/navigation/navigation-stack.tsx
@@ -279,6 +279,7 @@ let MoveNotes: any = null;
let Settings: any = null;
let ManageTags: any = null;
let AddReminder: any = null;
+let RelationsList: any = null;
let PayWall: any = null;
let Wrapped: any = null;
export const RootNavigation = () => {
@@ -385,6 +386,15 @@ export const RootNavigation = () => {
return AddReminder;
}}
/>
+
+ {
+ RelationsList =
+ RelationsList || require("../screens/relations-list").default;
+ return RelationsList;
+ }}
+ />
{
diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
index 64757a02f..55d37e9fa 100644
--- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
+++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
@@ -46,7 +46,6 @@ import EditorTabs from "../../../components/sheets/editor-tabs";
import { Issue } from "../../../components/sheets/github/issue";
import LinkNote from "../../../components/sheets/link-note";
import PaywallSheet from "../../../components/sheets/paywall";
-import { RelationsList } from "../../../components/sheets/relations-list";
import TableOfContents from "../../../components/sheets/toc";
import { DDS } from "../../../services/device-detection";
import {
@@ -80,6 +79,7 @@ import { fluidTabsRef } from "../../../utils/global-refs";
import { sleep } from "../../../utils/time";
import AddReminder from "../../add-reminder";
import ManageTags from "../../manage-tags";
+import RelationsList from "../../relations-list";
import { useDragState } from "../../settings/editor/state";
import { EditorMessage, EditorProps, useEditorType } from "./types";
import { useTabStore } from "./use-tab-store";
@@ -466,7 +466,7 @@ export const useEditorEvents = (
const note = await db.notes.note(noteId);
if (!note) return;
RelationsList.present({
- reference: note as any,
+ item: note as any,
referenceType: "reminder",
relationType: "from",
title: strings.dataTypesPluralCamelCase.reminder(),
diff --git a/apps/mobile/app/screens/notes/index.tsx b/apps/mobile/app/screens/notes/index.tsx
index 3527db26c..d29425296 100644
--- a/apps/mobile/app/screens/notes/index.tsx
+++ b/apps/mobile/app/screens/notes/index.tsx
@@ -18,8 +18,8 @@ along with this program. If not, see .
*/
import { resolveItems } from "@notesnook/common";
-import { Tag, VirtualizedGrouping } from "@notesnook/core";
-import { Color, Note } from "@notesnook/core";
+import { Color, Note, Tag, VirtualizedGrouping } from "@notesnook/core";
+import { strings } from "@notesnook/intl";
import React, { useEffect, useRef, useState } from "react";
import { db } from "../../common/database";
import { FloatingButton } from "../../components/container/floating-button";
@@ -39,10 +39,9 @@ import useNavigationStore, {
NotesScreenParams,
RouteName
} from "../../stores/use-navigation-store";
-import { setOnFirstSave } from "./common";
-import { strings } from "@notesnook/intl";
import { useSettingStore } from "../../stores/use-setting-store";
import { rootNavigatorRef } from "../../utils/global-refs";
+import { setOnFirstSave } from "./common";
export interface RouteProps extends NavigationProps {
get: (
diff --git a/apps/mobile/app/screens/relations-list/index.tsx b/apps/mobile/app/screens/relations-list/index.tsx
new file mode 100644
index 000000000..5604e9e13
--- /dev/null
+++ b/apps/mobile/app/screens/relations-list/index.tsx
@@ -0,0 +1,142 @@
+/*
+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 { Item, ItemReference, VirtualizedGrouping } from "@notesnook/core";
+import { strings } from "@notesnook/intl";
+import { useThemeColors } from "@notesnook/theme";
+import React, { useEffect, useState } from "react";
+import { View } from "react-native";
+import { SafeAreaView } from "react-native-safe-area-context";
+import Icon from "react-native-vector-icons/MaterialCommunityIcons";
+import { db } from "../../common/database";
+import { Header } from "../../components/header";
+import List from "../../components/list";
+import { Button } from "../../components/ui/button";
+import Paragraph from "../../components/ui/typography/paragraph";
+import Navigation, { NavigationProps } from "../../services/navigation";
+import { useRelationStore } from "../../stores/use-relation-store";
+import { AppFontSize } from "../../utils/size";
+
+type RelationsListProps = {
+ item: Item;
+ referenceType: "notebook" | "tag" | "reminder" | "note";
+ relationType: "to" | "from";
+ title: string;
+ onAdd?: () => void;
+};
+
+const IconsByType = {
+ reminder: "bell"
+};
+
+function RelationsList(props: NavigationProps<"RelationsList">) {
+ const { item, referenceType, relationType, title, onAdd } = props.route
+ .params as RelationsListProps;
+ const updater = useRelationStore((state) => state.updater);
+ const { colors } = useThemeColors();
+ const [items, setItems] = useState>();
+ const hasNoRelations = !items || items?.placeholders?.length === 0;
+
+ useEffect(() => {
+ db.relations?.[relationType]?.(
+ { id: item?.id, type: item?.type } as ItemReference,
+ referenceType
+ )
+ .selector.sorted({
+ sortBy: "dateEdited",
+ sortDirection: "desc"
+ })
+ .then((grouped) => {
+ setTimeout(() => {
+ setItems(grouped);
+ }, 300);
+ });
+ }, [relationType, referenceType, item?.id, item?.type, updater]);
+
+ return (
+
+
+
+ {hasNoRelations ? (
+
+
+ {strings.noLinksFound()}
+
+
+ ) : (
+
+ )}
+
+
+ );
+}
+
+RelationsList.present = ({
+ item,
+ relationType,
+ referenceType,
+ title,
+ onAdd
+}: RelationsListProps) => {
+ Navigation.navigate("RelationsList", {
+ item,
+ relationType,
+ referenceType,
+ title,
+ onAdd
+ });
+};
+
+export default RelationsList;
diff --git a/apps/mobile/app/services/navigation.ts b/apps/mobile/app/services/navigation.ts
index ce044aec8..f3b4114d0 100755
--- a/apps/mobile/app/services/navigation.ts
+++ b/apps/mobile/app/services/navigation.ts
@@ -71,6 +71,7 @@ const routeNames = {
Archive: "Archive",
ManageTags: "ManageTags",
AddReminder: "AddReminder",
+ RelationsList: "RelationsList",
PayWall: "PayWall",
Wrapped: "Wrapped"
};
diff --git a/apps/mobile/app/stores/use-navigation-store.ts b/apps/mobile/app/stores/use-navigation-store.ts
index 08984bce8..e3b1ff5c6 100644
--- a/apps/mobile/app/stores/use-navigation-store.ts
+++ b/apps/mobile/app/stores/use-navigation-store.ts
@@ -108,6 +108,13 @@ export interface RouteParams extends ParamListBase {
reminder?: Reminder;
reference?: Note;
};
+ RelationsList: {
+ item: Item;
+ referenceType: "notebook" | "tag" | "reminder" | "note";
+ relationType: "to" | "from";
+ title: string;
+ onAdd?: () => void;
+ };
Intro: GenericRouteParam;
PayWall: {
canGoBack?: boolean;
diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.json
index bcff135b9..546527553 100644
--- a/apps/mobile/package-lock.json
+++ b/apps/mobile/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@notesnook/mobile",
- "version": "3.3.23",
+ "version": "3.3.24",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@notesnook/mobile",
- "version": "3.3.23",
+ "version": "3.3.24",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"dependencies": {