import React from "react"; import { Keyboard, Text } from "react-native"; import { BottomSheetBackdrop, BottomSheetModal, BottomSheetModalProps, BottomSheetScrollView, BottomSheetView, TouchableWithoutFeedback, } from "@gorhom/bottom-sheet"; import { useUpdateBookmark } from "@hoarder/shared-react/hooks/bookmarks"; import { isBookmarkStillTagging } from "@hoarder/shared-react/utils/bookmarkUtils"; import { BookmarkTypes, ZBookmark } from "@hoarder/shared/types/bookmarks"; import { Input } from "../ui/Input"; import PageTitle from "../ui/PageTitle"; import { Skeleton } from "../ui/Skeleton"; import TagPill from "./TagPill"; function TagList({ bookmark }: { bookmark: ZBookmark }) { return ( Tags {isBookmarkStillTagging(bookmark) ? ( <> ) : bookmark.tags.length > 0 ? ( {bookmark.tags.map((t) => ( ))} ) : ( No tags )} ); } function NotesEditor({ bookmark }: { bookmark: ZBookmark }) { const { mutate, isPending } = useUpdateBookmark(); return ( Notes mutate({ bookmarkId: bookmark.id, note: ev.nativeEvent.text, }) } defaultValue={bookmark.note ?? ""} /> ); } const ViewBookmarkModal = React.forwardRef< BottomSheetModal, Omit< BottomSheetModalProps, "children" | "backdropComponent" | "onDismiss" > & { bookmark: ZBookmark; } >(({ bookmark, ...props }, ref) => { let title = null; switch (bookmark.content.type) { case BookmarkTypes.LINK: title = bookmark.title ?? bookmark.content.title; break; case BookmarkTypes.TEXT: title = bookmark.title; break; case BookmarkTypes.ASSET: title = bookmark.title ?? bookmark.content.fileName; break; } return ( ( )} {...props} > ); }); ViewBookmarkModal.displayName = "ViewBookmarkModal"; export default ViewBookmarkModal;