diff options
| author | MohamedBassem <me@mbassem.com> | 2025-08-31 16:09:12 +0100 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2025-08-31 16:09:12 +0100 |
| commit | be7311a7db8c9dcc373090b06b825995a3682ee4 (patch) | |
| tree | 40285d4094f00f931059f5fc73a867f0742821e8 /apps/mobile/components/bookmarks/BookmarkLinkView.tsx | |
| parent | 1e0cce7e6f79ccea00fc740aabc2b05918d17984 (diff) | |
| download | karakeep-be7311a7db8c9dcc373090b06b825995a3682ee4.tar.zst | |
fix(mobile): Fix text bookmark editor
Diffstat (limited to 'apps/mobile/components/bookmarks/BookmarkLinkView.tsx')
| -rw-r--r-- | apps/mobile/components/bookmarks/BookmarkLinkView.tsx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/apps/mobile/components/bookmarks/BookmarkLinkView.tsx b/apps/mobile/components/bookmarks/BookmarkLinkView.tsx new file mode 100644 index 00000000..e8a78029 --- /dev/null +++ b/apps/mobile/components/bookmarks/BookmarkLinkView.tsx @@ -0,0 +1,35 @@ +import { + BookmarkLinkArchivePreview, + BookmarkLinkBrowserPreview, + BookmarkLinkReaderPreview, + BookmarkLinkScreenshotPreview, +} from "@/components/bookmarks/BookmarkLinkPreview"; + +import { BookmarkTypes, ZBookmark } from "@karakeep/shared/types/bookmarks"; + +import { BookmarkLinkType } from "./BookmarkLinkTypeSelector"; + +interface BookmarkLinkViewProps { + bookmark: ZBookmark; + bookmarkPreviewType: BookmarkLinkType; +} + +export default function BookmarkLinkView({ + bookmark, + bookmarkPreviewType, +}: BookmarkLinkViewProps) { + if (bookmark.content.type !== BookmarkTypes.LINK) { + throw new Error("Wrong content type rendered"); + } + + switch (bookmarkPreviewType) { + case "browser": + return <BookmarkLinkBrowserPreview bookmark={bookmark} />; + case "reader": + return <BookmarkLinkReaderPreview bookmark={bookmark} />; + case "screenshot": + return <BookmarkLinkScreenshotPreview bookmark={bookmark} />; + case "archive": + return <BookmarkLinkArchivePreview bookmark={bookmark} />; + } +} |
