From 0584ad2bd8f486a0aaff7d8c96007d05c88a9a5e Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sat, 24 Aug 2024 18:13:02 +0300 Subject: fix(mobile): Allow expanding the text by clicking on bookmark card --- apps/mobile/components/bookmarks/BookmarkCard.tsx | 71 +++++++++++------------ 1 file changed, 34 insertions(+), 37 deletions(-) (limited to 'apps/mobile/components/bookmarks/BookmarkCard.tsx') diff --git a/apps/mobile/components/bookmarks/BookmarkCard.tsx b/apps/mobile/components/bookmarks/BookmarkCard.tsx index 3be1f9a0..860e5486 100644 --- a/apps/mobile/components/bookmarks/BookmarkCard.tsx +++ b/apps/mobile/components/bookmarks/BookmarkCard.tsx @@ -8,9 +8,8 @@ import { Text, View, } from "react-native"; -import Markdown from "react-native-markdown-display"; import * as Haptics from "expo-haptics"; -import { Link } from "expo-router"; +import { Link, router } from "expo-router"; import * as WebBrowser from "expo-web-browser"; import useAppSettings from "@/lib/settings"; import { api } from "@/lib/trpc"; @@ -30,10 +29,11 @@ import { } from "@hoarder/shared-react/utils/bookmarkUtils"; import { BookmarkTypes } from "@hoarder/shared/types/bookmarks"; -import { TailwindResolver } from "../TailwindResolver"; import { Divider } from "../ui/Divider"; import { Skeleton } from "../ui/Skeleton"; import { useToast } from "../ui/Toast"; +import BookmarkAssetImage from "./BookmarkAssetImage"; +import BookmarkTextMarkdown from "./BookmarkTextMarkdown"; import ListPickerModal from "./ListPickerModal"; function ActionBar({ bookmark }: { bookmark: ZBookmark }) { @@ -250,26 +250,21 @@ function TextCard({ bookmark }: { bookmark: ZBookmark }) { const content = bookmark.content.text; return ( - {bookmark.title && ( - - {bookmark.title} - - )} + router.push(`/dashboard/bookmarks/${bookmark.id}`)} + > + {bookmark.title && ( + + {bookmark.title} + + )} + - ( - - {content} - - )} - /> + router.push(`/dashboard/bookmarks/${bookmark.id}`)} + > + + @@ -282,7 +277,6 @@ function TextCard({ bookmark }: { bookmark: ZBookmark }) { } function AssetCard({ bookmark }: { bookmark: ZBookmark }) { - const { settings } = useAppSettings(); if (bookmark.content.type !== BookmarkTypes.ASSET) { throw new Error("Wrong content type rendered"); } @@ -290,21 +284,24 @@ function AssetCard({ bookmark }: { bookmark: ZBookmark }) { return ( - + router.push(`/dashboard/bookmarks/${bookmark.id}`)} + > + + - {title && ( - - {title} - - )} + router.push(`/dashboard/bookmarks/${bookmark.id}`)} + > + {title && ( + + {title} + + )} + -- cgit v1.2.3-70-g09d2