diff options
| author | MohamedBassem <me@mbassem.com> | 2024-04-15 18:39:59 +0100 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-04-15 18:55:34 +0100 |
| commit | 81e0b2849d837649da9adbc5d077b8c819fe7bee (patch) | |
| tree | 003bb21413372825dc19c07a87bdbe6692e384a9 /apps/mobile/components/bookmarks | |
| parent | 5c9acb1cb3bfe341378b91bbed344dd7202a00d7 (diff) | |
| download | karakeep-81e0b2849d837649da9adbc5d077b8c819fe7bee.tar.zst | |
feature: Add title to bookmarks and allow editing them. Fixes #27
Diffstat (limited to 'apps/mobile/components/bookmarks')
| -rw-r--r-- | apps/mobile/components/bookmarks/BookmarkCard.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/mobile/components/bookmarks/BookmarkCard.tsx b/apps/mobile/components/bookmarks/BookmarkCard.tsx index d4fbcb58..76a05aef 100644 --- a/apps/mobile/components/bookmarks/BookmarkCard.tsx +++ b/apps/mobile/components/bookmarks/BookmarkCard.tsx @@ -201,7 +201,7 @@ function LinkCard({ bookmark }: { bookmark: ZBookmark }) { className="line-clamp-2 text-xl font-bold" onPress={() => WebBrowser.openBrowserAsync(url)} > - {bookmark.content.title ?? parsedUrl.host} + {bookmark.title ?? bookmark.content.title ?? parsedUrl.host} </Text> <TagList bookmark={bookmark} /> <Divider orientation="vertical" className="mt-2 h-0.5 w-full" /> @@ -220,6 +220,9 @@ function TextCard({ bookmark }: { bookmark: ZBookmark }) { } return ( <View className="flex max-h-96 gap-2 p-2"> + {bookmark.title && ( + <Text className="line-clamp-2 text-xl font-bold">{bookmark.title}</Text> + )} <View className="max-h-56 overflow-hidden p-2"> <Markdown>{bookmark.content.text}</Markdown> </View> @@ -238,6 +241,7 @@ function AssetCard({ bookmark }: { bookmark: ZBookmark }) { if (bookmark.content.type !== "asset") { throw new Error("Wrong content type rendered"); } + const title = bookmark.title ?? bookmark.content.fileName; return ( <View className="flex gap-2"> @@ -251,6 +255,9 @@ function AssetCard({ bookmark }: { bookmark: ZBookmark }) { className="h-56 min-h-56 w-full object-cover" /> <View className="flex gap-2 p-2"> + {title && ( + <Text className="line-clamp-2 text-xl font-bold">{title}</Text> + )} <TagList bookmark={bookmark} /> <Divider orientation="vertical" className="mt-2 h-0.5 w-full" /> <View className="mt-2 flex flex-row justify-between px-2 pb-2"> |
