+ {/* Toolbar (Filters, Search, Layout mode) */}
+
+ {/* Category Filters */}
+
+ {(["all", "image", "document", "other"] as const).map((type) => (
+
+ ))}
+
+
+ {/* Search & Layout Toggles */}
+
+ {/* Search box */}
+
+
+ setSearchQuery(e.target.value)}
+ className="h-8.5 w-full rounded-lg border border-slate-200 bg-slate-50/50 pl-8.5 pr-8 text-xs text-slate-800 placeholder-slate-400 transition-colors focus:border-emerald-500/50 focus:bg-white focus:outline-none focus:ring-1 focus:ring-emerald-500/20"
+ />
+ {searchQuery && (
+
+ )}
+
+
+ {/* Layout switches */}
+
+
+
+
+
+
+
+ {/* Target Upload Memo Info Banner */}
+ {activeMemo ? (
+
+
+ 📌 当前关联笔记:《{activeMemo.title || activeMemo.excerpt || "未命名笔记"}》
+
+
+
+
+
+
+ ) : (
+
+ ⚠️ 提示:在右侧编辑器中打开一篇笔记,即可在此处拖放或上传新文件。
+
+ )}
+
+ {/* Main Content Area */}
+
{resourcesQuery.isLoading ? (
-
正在加载附件列表...
- ) : resources.length === 0 ? (
+
+
+ 正在加载附件列表...
+
+ ) : filteredResources.length === 0 ? (
-
暂无附件
-
插入到笔记中的图片或文件会显示在这里
+
+ {searchQuery || filterType !== "all" ? "未找到匹配附件" : "暂无附件"}
+
+
+ {searchQuery || filterType !== "all"
+ ? "请尝试更改搜索词或分类过滤器"
+ : "拖拽文件到这里,或在上方上传文件"}
+
+
+ ) : layoutMode === "grid" ? (
+ /* Grid View */
+
+ {filteredResources.map((resource) => (
+
+ {/* Thumbnail area */}
+
{
+ if (resource.kind === "image") {
+ handleImageClick(resource.id);
+ } else {
+ window.open(resource.url, "_blank", "noreferrer");
+ }
+ }}
+ className="relative aspect-square w-full cursor-pointer overflow-hidden bg-slate-50 flex items-center justify-center border-b border-slate-100"
+ >
+ {resource.kind === "image" ? (
+

+ ) : (
+
+ {getFileIcon(resource.mimeType, resource.filename)}
+
+ {(resource.filename || "").split(".").pop() || "FILE"}
+
+
+ )}
+ {/* Hover detail overlay */}
+
+
+ {resource.kind === "image" ? "大图预览" : "下载/打开"}
+
+
+
+
+
+ {/* Metadata area */}
+
+
+ {resource.filename || resource.id}
+
+
+ {formatBytes(resource.byteSize)}
+ {(resource.mimeType?.split("/")[1] || resource.kind).toUpperCase()}
+
+
+ 📄 {resource.memoDeleted ? "已删除笔记" : resource.memoTitle || resource.memoExcerpt || "未命名笔记"}
+
+
+
+ ))}
) : (
-
)}
+
+ {/* Drag Active Overlay */}
+ {isDragActive && activeMemo && (
+
+
+
+
将文件释放于此
+
+ 文件将上传并附加到当前正在编辑的笔记:
+ 《{activeMemo.title || activeMemo.excerpt || "未命名"}》
+
+
+
+ )}
+
+ {/* Uploading Status Overlay (Non-intrusive bottom loader) */}
+ {uploadState !== "idle" && (
+
+ {uploadState === "compressing" && (
+ <>
+
+ {uploadProgress}
+ >
+ )}
+ {uploadState === "uploading" && (
+ <>
+
+ {uploadProgress}
+ >
+ )}
+ {uploadState === "success" && (
+ <>
+ ✓
+ 上传成功!
+ >
+ )}
+ {uploadState === "error" && (
+ <>
+ ✕
+ 上传失败,请稍后重试
+ >
+ )}
+
+ )}
+
+ {/* Lightbox Viewer */}
+ {lightboxIndex !== null && (
+
setLightboxIndex(null)}
+ plugins={[Zoom, Thumbnails]}
+ />
+ )}
);
};
diff --git a/apps/web/src/components/WorkspaceApp.tsx b/apps/web/src/components/WorkspaceApp.tsx
index 0036d020..e0d7c968 100644
--- a/apps/web/src/components/WorkspaceApp.tsx
+++ b/apps/web/src/components/WorkspaceApp.tsx
@@ -1947,7 +1947,7 @@ export const WorkspaceApp = ({
onShowGuide={() => setRightView("evernote-migration")}
/>
) : rightView === "assets" ? (
-