From fe3c8e0971003d6e44dec0429a4f12fcd8a56ef1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 8 Nov 2025 23:19:46 +0000 Subject: [PATCH] chore(web): remove old Location/Attachments/Relations component files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove duplicate component implementations that have been replaced by the unified memo-metadata components: Removed from MemoEditor: - LocationView.tsx → replaced by memo-metadata/LocationDisplay - AttachmentListView.tsx → replaced by memo-metadata/AttachmentList - RelationListView.tsx → replaced by memo-metadata/RelationList Removed from MemoView: - MemoLocationView.tsx → replaced by memo-metadata/LocationDisplay - MemoAttachmentListView.tsx → replaced by memo-metadata/AttachmentList - MemoRelationListView.tsx → replaced by memo-metadata/RelationList This cleanup eliminates ~380 lines of duplicate code and ensures all components use the new unified architecture going forward. Note: MemoAttachment.tsx is retained as it's still used by the new AttachmentList component for rendering non-media file cards. --- web/src/components/MemoAttachmentListView.tsx | 113 ------------------ .../MemoEditor/AttachmentListView.tsx | 71 ----------- .../components/MemoEditor/LocationView.tsx | 34 ------ .../MemoEditor/RelationListView.tsx | 55 --------- web/src/components/MemoLocationView.tsx | 35 ------ web/src/components/MemoRelationListView.tsx | 110 ----------------- 6 files changed, 418 deletions(-) delete mode 100644 web/src/components/MemoAttachmentListView.tsx delete mode 100644 web/src/components/MemoEditor/AttachmentListView.tsx delete mode 100644 web/src/components/MemoEditor/LocationView.tsx delete mode 100644 web/src/components/MemoEditor/RelationListView.tsx delete mode 100644 web/src/components/MemoLocationView.tsx delete mode 100644 web/src/components/MemoRelationListView.tsx diff --git a/web/src/components/MemoAttachmentListView.tsx b/web/src/components/MemoAttachmentListView.tsx deleted file mode 100644 index 7749fb0e2..000000000 --- a/web/src/components/MemoAttachmentListView.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import { memo, useState } from "react"; -import { cn } from "@/lib/utils"; -import { Attachment } from "@/types/proto/api/v1/attachment_service"; -import { getAttachmentThumbnailUrl, getAttachmentType, getAttachmentUrl } from "@/utils/attachment"; -import MemoAttachment from "./MemoAttachment"; -import PreviewImageDialog from "./PreviewImageDialog"; - -const MemoAttachmentListView = ({ attachments = [] }: { attachments: Attachment[] }) => { - const [previewImage, setPreviewImage] = useState<{ open: boolean; urls: string[]; index: number }>({ - open: false, - urls: [], - index: 0, - }); - const mediaAttachments: Attachment[] = []; - const otherAttachments: Attachment[] = []; - - attachments.forEach((attachment) => { - const type = getAttachmentType(attachment); - if (type === "image/*" || type === "video/*") { - mediaAttachments.push(attachment); - return; - } - - otherAttachments.push(attachment); - }); - - const handleImageClick = (imgUrl: string) => { - const imgUrls = mediaAttachments - .filter((attachment) => getAttachmentType(attachment) === "image/*") - .map((attachment) => getAttachmentUrl(attachment)); - const index = imgUrls.findIndex((url) => url === imgUrl); - setPreviewImage({ open: true, urls: imgUrls, index }); - }; - - const MediaCard = ({ attachment, className }: { attachment: Attachment; className?: string }) => { - const type = getAttachmentType(attachment); - const attachmentUrl = getAttachmentUrl(attachment); - const attachmentThumbnailUrl = getAttachmentThumbnailUrl(attachment); - - if (type === "image/*") { - return ( - { - // Fallback to original image if thumbnail fails - const target = e.target as HTMLImageElement; - if (target.src.includes("?thumbnail=true")) { - console.warn("Thumbnail failed, falling back to original image:", attachmentUrl); - target.src = attachmentUrl; - } - }} - onClick={() => handleImageClick(attachmentUrl)} - decoding="async" - loading="lazy" - /> - ); - } else if (type === "video/*") { - return ( -