aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/components')
-rw-r--r--apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx35
1 files changed, 30 insertions, 5 deletions
diff --git a/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx b/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx
index c7745acd..ab5d0364 100644
--- a/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx
+++ b/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx
@@ -35,6 +35,7 @@ import { CalendarIcon } from "lucide-react";
import { useForm } from "react-hook-form";
import { useUpdateBookmark } from "@karakeep/shared-react/hooks/bookmarks";
+import { getBookmarkTitle } from "@karakeep/shared-react/utils/bookmarkUtils";
import {
BookmarkTypes,
ZBookmark,
@@ -61,11 +62,7 @@ export function EditBookmarkDialog({
const bookmarkToDefault = (bookmark: ZBookmark) => ({
bookmarkId: bookmark.id,
summary: bookmark.summary,
- title: bookmark.title
- ? bookmark.title
- : bookmark.content.type === BookmarkTypes.LINK
- ? bookmark.content.title
- : undefined,
+ title: getBookmarkTitle(bookmark),
createdAt: bookmark.createdAt ?? new Date(),
// Link specific defaults (only if bookmark is a link)
url:
@@ -88,6 +85,11 @@ export function EditBookmarkDialog({
bookmark.content.type === BookmarkTypes.LINK
? bookmark.content.datePublished
: undefined,
+ // Asset specific fields
+ assetContent:
+ bookmark.content.type === BookmarkTypes.ASSET
+ ? bookmark.content.content
+ : undefined,
});
const form = useForm<ZUpdateBookmarksRequest>({
@@ -130,6 +132,7 @@ export function EditBookmarkDialog({
}, [bookmark, form, open]);
const isLink = bookmark.content.type === BookmarkTypes.LINK;
+ const isAsset = bookmark.content.type === BookmarkTypes.ASSET;
return (
<Dialog open={open} onOpenChange={setOpen}>
@@ -215,6 +218,28 @@ export function EditBookmarkDialog({
/>
)}
+ {isAsset && (
+ <FormField
+ control={form.control}
+ name="assetContent"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>
+ {t("bookmark_editor.extracted_content")}
+ </FormLabel>
+ <FormControl>
+ <Textarea
+ placeholder="Extracted Content"
+ {...field}
+ value={field.value ?? ""}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ )}
+
{isLink && (
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<FormField