aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard/preview/LinkContentSection.tsx
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-05-26 00:06:32 +0000
committerMohamedBassem <me@mbassem.com>2024-05-26 10:11:53 +0000
commitdedc5fb24536832eae2c18d84efa2a92272c955c (patch)
tree4b9540b819db892fa6bc66a29cf8fc790d06ea67 /apps/web/components/dashboard/preview/LinkContentSection.tsx
parent033e8a2d26bb0ecaa8301609960d35d3467a88f4 (diff)
downloadkarakeep-dedc5fb24536832eae2c18d84efa2a92272c955c.tar.zst
feature: Full page archival with monolith. Fixes #132
Diffstat (limited to 'apps/web/components/dashboard/preview/LinkContentSection.tsx')
-rw-r--r--apps/web/components/dashboard/preview/LinkContentSection.tsx18
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/web/components/dashboard/preview/LinkContentSection.tsx b/apps/web/components/dashboard/preview/LinkContentSection.tsx
index 29001c7f..3aeacdcd 100644
--- a/apps/web/components/dashboard/preview/LinkContentSection.tsx
+++ b/apps/web/components/dashboard/preview/LinkContentSection.tsx
@@ -12,6 +12,16 @@ import { ScrollArea } from "@radix-ui/react-scroll-area";
import { ZBookmark, ZBookmarkedLink } from "@hoarder/shared/types/bookmarks";
+function FullPageArchiveSection({ link }: { link: ZBookmarkedLink }) {
+ return (
+ <iframe
+ title={link.url}
+ src={`/api/assets/${link.fullPageArchiveAssetId}`}
+ className="relative h-full min-w-full"
+ />
+ );
+}
+
function ScreenshotSection({ link }: { link: ZBookmarkedLink }) {
return (
<div className="relative h-full min-w-full">
@@ -60,6 +70,8 @@ export default function LinkContentSection({
let content;
if (section === "cached") {
content = <CachedContentSection link={bookmark.content} />;
+ } else if (section === "archive") {
+ content = <FullPageArchiveSection link={bookmark.content} />;
} else {
content = <ScreenshotSection link={bookmark.content} />;
}
@@ -79,6 +91,12 @@ export default function LinkContentSection({
>
Screenshot
</SelectItem>
+ <SelectItem
+ value="archive"
+ disabled={!bookmark.content.fullPageArchiveAssetId}
+ >
+ Archive
+ </SelectItem>
</SelectGroup>
</SelectContent>
</Select>