From 868ae597aec88f5e7e6a9a4668109a152dd761a6 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Thu, 26 Dec 2024 11:57:19 +0500 Subject: [PATCH] mobile: fix ts errors --- apps/mobile/app/common/filesystem/index.ts | 3 +- .../app/components/dialog/base-dialog.tsx | 2 +- .../components/dialogs/color-picker/index.tsx | 1 + .../app/components/list/list-item.wrapper.tsx | 1 - .../app/components/premium/pricing-plans.tsx | 5 +- .../export-notes/{share.js => share.jsx} | 0 .../components/sheets/publish-note/index.tsx | 4 +- .../app/components/sheets/reminder/index.tsx | 4 +- .../components/ui/animated-button/index.tsx | 158 ------------------ apps/mobile/app/components/ui/svg/index.tsx | 6 +- apps/mobile/app/hooks/use-app-state.ts | 11 +- apps/mobile/app/hooks/use-keyboard.ts | 6 +- apps/mobile/app/screens/search/index.tsx | 41 ++++- apps/mobile/native/package.json | 1 - apps/mobile/package-lock.json | 23 +-- apps/mobile/package.json | 14 +- apps/mobile/share/search.tsx | 1 + apps/mobile/tsconfig.json | 2 +- packages/core/src/api/index.ts | 2 +- 19 files changed, 76 insertions(+), 209 deletions(-) rename apps/mobile/app/components/sheets/export-notes/{share.js => share.jsx} (100%) delete mode 100644 apps/mobile/app/components/ui/animated-button/index.tsx diff --git a/apps/mobile/app/common/filesystem/index.ts b/apps/mobile/app/common/filesystem/index.ts index 676ec46654..e236bbe3a6 100644 --- a/apps/mobile/app/common/filesystem/index.ts +++ b/apps/mobile/app/common/filesystem/index.ts @@ -47,7 +47,8 @@ export default { deleteCacheFileByPath, getCacheSize, requestPermission, - checkAndCreateDir + checkAndCreateDir, + getUploadedFileSize }; export const FileStorage: IFileStorage = { diff --git a/apps/mobile/app/components/dialog/base-dialog.tsx b/apps/mobile/app/components/dialog/base-dialog.tsx index f6be7ea6b1..0ffa62fb4a 100644 --- a/apps/mobile/app/components/dialog/base-dialog.tsx +++ b/apps/mobile/app/components/dialog/base-dialog.tsx @@ -38,7 +38,7 @@ import { useAppState } from "../../hooks/use-app-state"; export interface BaseDialogProps extends PropsWithChildren { animation?: "fade" | "none" | "slide" | undefined; - visible: boolean; + visible?: boolean; onRequestClose?: () => void; onShow?: () => void; premium?: boolean; diff --git a/apps/mobile/app/components/dialogs/color-picker/index.tsx b/apps/mobile/app/components/dialogs/color-picker/index.tsx index d6b29f2fde..734c7e3f0c 100644 --- a/apps/mobile/app/components/dialogs/color-picker/index.tsx +++ b/apps/mobile/app/components/dialogs/color-picker/index.tsx @@ -179,6 +179,7 @@ const ColorPicker = ({ title: title.current, colorCode: selectedColor }); + if (!id) return; useRelationStore.getState().update(); useMenuStore.getState().setColorNotes(); setVisible(false); diff --git a/apps/mobile/app/components/list/list-item.wrapper.tsx b/apps/mobile/app/components/list/list-item.wrapper.tsx index 209b00ee4f..aad1361706 100644 --- a/apps/mobile/app/components/list/list-item.wrapper.tsx +++ b/apps/mobile/app/components/list/list-item.wrapper.tsx @@ -297,7 +297,6 @@ function getDate(item: Item, groupType?: GroupingKey): number { groupType ? db.settings.getGroupOptions(groupType) : { - groupBy: "default", sortBy: "dateEdited", sortDirection: "desc" }, diff --git a/apps/mobile/app/components/premium/pricing-plans.tsx b/apps/mobile/app/components/premium/pricing-plans.tsx index a7ce08fd75..d0ef060da4 100644 --- a/apps/mobile/app/components/premium/pricing-plans.tsx +++ b/apps/mobile/app/components/premium/pricing-plans.tsx @@ -129,7 +129,10 @@ export const PricingPlans = ({ if (code.startsWith("com.streetwriters.notesnook")) { skuId = code; } else { - skuId = await db.offers?.getCode(code.split(":")[0], Platform.OS); + skuId = await db.offers?.getCode( + code.split(":")[0], + Platform.OS as "ios" | "android" + ); } const products = await PremiumService.getProducts(); diff --git a/apps/mobile/app/components/sheets/export-notes/share.js b/apps/mobile/app/components/sheets/export-notes/share.jsx similarity index 100% rename from apps/mobile/app/components/sheets/export-notes/share.js rename to apps/mobile/app/components/sheets/export-notes/share.jsx diff --git a/apps/mobile/app/components/sheets/publish-note/index.tsx b/apps/mobile/app/components/sheets/publish-note/index.tsx index 581d21cba6..042c7b6e76 100644 --- a/apps/mobile/app/components/sheets/publish-note/index.tsx +++ b/apps/mobile/app/components/sheets/publish-note/index.tsx @@ -150,7 +150,7 @@ const PublishNoteSheet = ({ ) : ( <> - {isPublished && ( + {isPublished && publishUrl ? ( - )} + ) : null} { diff --git a/apps/mobile/app/components/sheets/reminder/index.tsx b/apps/mobile/app/components/sheets/reminder/index.tsx index b100d0d687..f9669e2d74 100644 --- a/apps/mobile/app/components/sheets/reminder/index.tsx +++ b/apps/mobile/app/components/sheets/reminder/index.tsx @@ -556,9 +556,9 @@ export default function ReminderSheet({ {Object.keys(ReminderNotificationModes).map((mode) => (