From 3d652eee04d13ce992fbcce9a0fce53d52e99a07 Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Thu, 1 Jan 2026 10:01:43 +0200
Subject: 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
---
 .../components/bookmarks/BookmarkLinkPreview.tsx   | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

(limited to 'apps/mobile/components/bookmarks/BookmarkLinkPreview.tsx')

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,
 }: {
-- 
cgit v1.2.3-70-g09d2

