From f15b4cf6341aeab77e96f73a20488233530a1f9b Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Tue, 20 Jan 2026 10:17:57 +0500 Subject: [PATCH] mobile: show note references in reminder page --- .../app/components/list-items/note/index.tsx | 10 +- .../app/components/ui/reminder-time/index.tsx | 4 +- .../mobile/app/screens/add-reminder/index.tsx | 105 +++++++++++++----- apps/mobile/package-lock.json | 4 +- 4 files changed, 91 insertions(+), 32 deletions(-) diff --git a/apps/mobile/app/components/list-items/note/index.tsx b/apps/mobile/app/components/list-items/note/index.tsx index 91bd179cd..afbaae87e 100644 --- a/apps/mobile/app/components/list-items/note/index.tsx +++ b/apps/mobile/app/components/list-items/note/index.tsx @@ -252,14 +252,16 @@ const NoteItem = ({ {reminder ? ( ) : null} diff --git a/apps/mobile/app/components/ui/reminder-time/index.tsx b/apps/mobile/app/components/ui/reminder-time/index.tsx index cc127be88..e1da6a88d 100644 --- a/apps/mobile/app/components/ui/reminder-time/index.tsx +++ b/apps/mobile/app/components/ui/reminder-time/index.tsx @@ -41,7 +41,9 @@ export const ReminderTime = ({ } & ButtonProps) => { const { colors } = useThemeColors(); const reminder = props.reminder; - const time = !reminder ? undefined : getFormattedReminderTime(reminder); + const time = !reminder + ? undefined + : getFormattedReminderTime(reminder, props.short || false); const isTodayOrTomorrow = (time?.includes("Today") || time?.includes("Tomorrow")) && !time?.includes("Last"); diff --git a/apps/mobile/app/screens/add-reminder/index.tsx b/apps/mobile/app/screens/add-reminder/index.tsx index 79289f996..59194dc1e 100644 --- a/apps/mobile/app/screens/add-reminder/index.tsx +++ b/apps/mobile/app/screens/add-reminder/index.tsx @@ -39,7 +39,7 @@ import Input from "../../components/ui/input"; import { ReminderTime } from "../../components/ui/reminder-time"; import Paragraph from "../../components/ui/typography/paragraph"; import { DDS } from "../../services/device-detection"; -import { ToastManager } from "../../services/event-manager"; +import { eSendEvent, ToastManager } from "../../services/event-manager"; import Navigation, { NavigationProps } from "../../services/navigation"; import Notifications from "../../services/notifications"; import SettingsService from "../../services/settings"; @@ -47,9 +47,18 @@ import { useRelationStore } from "../../stores/use-relation-store"; import { useSettingStore } from "../../stores/use-setting-store"; import { AppFontSize, defaultBorderRadius } from "../../utils/size"; import { DefaultAppStyles } from "../../utils/styles"; -import { getFormattedDate, useIsFeatureAvailable } from "@notesnook/common"; +import { + getFormattedDate, + useIsFeatureAvailable, + usePromise +} from "@notesnook/common"; import PaywallSheet from "../../components/sheets/paywall"; import { useNavigationFocus } from "../../hooks/use-navigation-focus"; +import { Pressable } from "../../components/ui/pressable"; +import { TimeSince } from "../../components/ui/time-since"; +import Heading from "../../components/ui/typography/heading"; +import { eOnLoadNote } from "../../utils/events"; +import { fluidTabsRef } from "../../utils/global-refs"; const ReminderModes = Platform.OS === "ios" @@ -123,6 +132,15 @@ export default function AddReminder(props: NavigationProps<"AddReminder">) { const titleRef = useRef(null); const descriptionRef = useRef(null); const timer = useRef(undefined); + const referencedNotes = usePromise( + () => + reminder?.id + ? db.relations + .to({ id: reminder.id, type: "reminder" }, "note") + .resolve() + : null, + [reminder?.id] + ); const showDatePicker = () => { setDatePickerVisibility(true); @@ -245,6 +263,9 @@ export default function AddReminder(props: NavigationProps<"AddReminder">) { marginBottom: DDS.isTab ? 25 : undefined, paddingHorizontal: DefaultAppStyles.GAP }} + contentContainerStyle={{ + gap: DefaultAppStyles.GAP_VERTICAL + }} keyboardDismissMode="interactive" keyboardShouldPersistTaps="handled" > @@ -279,15 +300,11 @@ export default function AddReminder(props: NavigationProps<"AddReminder">) { paddingVertical: DefaultAppStyles.GAP_VERTICAL }} height={80} - wrapperStyle={{ - marginBottom: DefaultAppStyles.GAP_VERTICAL - }} /> @@ -343,8 +360,7 @@ export default function AddReminder(props: NavigationProps<"AddReminder">) { style={{ backgroundColor: colors.secondary.background, padding: DefaultAppStyles.GAP, - borderRadius: defaultBorderRadius, - marginBottom: DefaultAppStyles.GAP_VERTICAL + borderRadius: defaultBorderRadius }} > ) { width: "100%", flexDirection: "column", justifyContent: "center", - marginBottom: DefaultAppStyles.GAP_VERTICAL, alignItems: "center" }} > @@ -521,10 +536,8 @@ export default function AddReminder(props: NavigationProps<"AddReminder">) { style={{ borderRadius: defaultBorderRadius, flexDirection: "row", - paddingVertical: DefaultAppStyles.GAP_VERTICAL_SMALL, alignItems: "center", - justifyContent: "flex-start", - marginBottom: DefaultAppStyles.GAP_VERTICAL + justifyContent: "flex-start" }} > <> @@ -560,22 +573,10 @@ export default function AddReminder(props: NavigationProps<"AddReminder">) { )} - - {reminderMode === ReminderModes.Permanent ? null : ( ) { ))} )} + + + + {referencedNotes && + referencedNotes.status === "fulfilled" && + referencedNotes.value !== null && + referencedNotes.value?.length > 0 ? ( + + {strings.referencedIn()} + {referencedNotes.value.map((item) => ( + { + Navigation.navigate("FluidPanelsView"); + fluidTabsRef.current?.goToPage("editor"); + eSendEvent(eOnLoadNote, { + item: item + }); + }} + type="secondary" + > + {item.title} + + + ))} + + ) : null} diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.json index 1e2c4edd6..9409d3e6a 100644 --- a/apps/mobile/package-lock.json +++ b/apps/mobile/package-lock.json @@ -1,12 +1,12 @@ { "name": "@notesnook/mobile", - "version": "3.3.13-beta.0", + "version": "3.3.13-beta.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@notesnook/mobile", - "version": "3.3.13-beta.0", + "version": "3.3.13-beta.1", "hasInstallScript": true, "license": "GPL-3.0-or-later", "dependencies": {