diff options
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx | 35 | ||||
| -rw-r--r-- | apps/web/lib/i18n/locales/en/translation.json | 3 |
2 files changed, 32 insertions, 6 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 diff --git a/apps/web/lib/i18n/locales/en/translation.json b/apps/web/lib/i18n/locales/en/translation.json index 5166d6bd..f76d0f33 100644 --- a/apps/web/lib/i18n/locales/en/translation.json +++ b/apps/web/lib/i18n/locales/en/translation.json @@ -374,6 +374,7 @@ "publisher": "Publisher", "date_published": "Date Published", "pick_a_date": "Pick a date", - "save_changes": "Save changes" + "save_changes": "Save changes", + "extracted_content": "Extracted Content" } } |
