diff options
| author | Mohamed Bassem <me@mbassem.com> | 2026-01-01 10:01:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-01 08:01:43 +0000 |
| commit | 3d652eee04d13ce992fbcce9a0fce53d52e99a07 (patch) | |
| tree | bb8e3a7a5e30be075b351a9ebd5de8f9975f35dc /apps/mobile/components/bookmarks/BookmarkLinkPreview.tsx | |
| parent | 7a76216e5c971a300e9db32c93509b0376f6f47e (diff) | |
| download | karakeep-3d652eee04d13ce992fbcce9a0fce53d52e99a07.tar.zst | |
feat: add replace banner and attachment download (#2328)
* feat: add replace banner and attachment download
* add pdf preview in mobile app
* fix menu order
* fix comment
Diffstat (limited to 'apps/mobile/components/bookmarks/BookmarkLinkPreview.tsx')
| -rw-r--r-- | apps/mobile/components/bookmarks/BookmarkLinkPreview.tsx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/mobile/components/bookmarks/BookmarkLinkPreview.tsx b/apps/mobile/components/bookmarks/BookmarkLinkPreview.tsx index e0b592d6..4478bdda 100644 --- a/apps/mobile/components/bookmarks/BookmarkLinkPreview.tsx +++ b/apps/mobile/components/bookmarks/BookmarkLinkPreview.tsx @@ -14,6 +14,7 @@ import { BookmarkTypes, ZBookmark } from "@karakeep/shared/types/bookmarks"; import FullPageError from "../FullPageError"; import FullPageSpinner from "../ui/FullPageSpinner"; import BookmarkAssetImage from "./BookmarkAssetImage"; +import { PDFViewer } from "./PDFViewer"; export function BookmarkLinkBrowserPreview({ bookmark, @@ -33,6 +34,30 @@ export function BookmarkLinkBrowserPreview({ ); } +export function BookmarkLinkPdfPreview({ bookmark }: { bookmark: ZBookmark }) { + if (bookmark.content.type !== BookmarkTypes.LINK) { + throw new Error("Wrong content type rendered"); + } + + const asset = bookmark.assets.find((r) => r.assetType == "pdf"); + + const assetSource = useAssetUrl(asset?.id ?? ""); + + if (!asset) { + return ( + <View className="flex-1 bg-background"> + <Text>Asset has no PDF</Text> + </View> + ); + } + + return ( + <View className="flex flex-1"> + <PDFViewer source={assetSource.uri ?? ""} headers={assetSource.headers} /> + </View> + ); +} + export function BookmarkLinkReaderPreview({ bookmark, }: { |
