Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/frontend/app/home/cloud-docs/FolderTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function FolderTree({ onDocClick }: FolderTreeProps) {
setNewFolderParent(undefined);
fetchTree();
} catch {
setCreateError("创建文件夹失败,请重试");
setCreateError("Failed to create folder, please try again");
}
};

Expand Down Expand Up @@ -139,7 +139,7 @@ export default function FolderTree({ onDocClick }: FolderTreeProps) {
setNewFolderParent(undefined);
setNewFolderName("");
}}
title="新建文件夹"
title="New folder"
className="w-6 h-6 flex items-center justify-center rounded hover:bg-gray-200 text-gray-500 hover:text-gray-700 transition-colors"
>
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
Expand All @@ -159,7 +159,7 @@ export default function FolderTree({ onDocClick }: FolderTreeProps) {
if (e.key === "Enter") handleCreateFolder();
if (e.key === "Escape") setCreatingFolder(false);
}}
placeholder="文件夹名称"
placeholder="Folder name"
className="w-full text-sm px-2 py-1 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-blue-500 mb-1"
/>
{createError && <p className="text-xs text-red-500 mb-1">{createError}</p>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,20 @@ describe("FolderTree", () => {
it("should show create folder form when + button clicked", async () => {
mockFetch.mockResolvedValueOnce({ ok: true, json: async () => [] });
render(<FolderTree />);
const addBtn = screen.getByTitle("新建文件夹");
const addBtn = screen.getByTitle("New folder");
await userEvent.click(addBtn);
expect(screen.getByPlaceholderText("文件夹名称")).toBeInTheDocument();
expect(screen.getByPlaceholderText("Folder name")).toBeInTheDocument();
});

it("should call POST /documents/folder and reload on creation", async () => {
mockFetch
.mockResolvedValueOnce({ ok: true, json: async () => [] }) // initial load
.mockResolvedValueOnce({ ok: true, json: async () => [] }); // reload after create
render(<FolderTree />);
const addBtn = screen.getByTitle("新建文件夹");
const addBtn = screen.getByTitle("New folder");
await userEvent.click(addBtn);
const input = screen.getByPlaceholderText("文件夹名称");
await userEvent.type(input, "新建文件夹");
const input = screen.getByPlaceholderText("Folder name");
await userEvent.type(input, "Test Folder");
await userEvent.click(screen.getByText("创建"));
await waitFor(() => {
expect(mockFetch).toHaveBeenCalledWith(
Expand All @@ -136,10 +136,10 @@ describe("FolderTree", () => {
it("should close create form on Escape", async () => {
mockFetch.mockResolvedValueOnce({ ok: true, json: async () => [] });
render(<FolderTree />);
const addBtn = screen.getByTitle("新建文件夹");
const addBtn = screen.getByTitle("New folder");
await userEvent.click(addBtn);
const input = screen.getByPlaceholderText("文件夹名称");
const input = screen.getByPlaceholderText("Folder name");
await userEvent.type(input, "test{escape}");
expect(screen.queryByPlaceholderText("文件夹名称")).not.toBeInTheDocument();
expect(screen.queryByPlaceholderText("Folder name")).not.toBeInTheDocument();
});
});
8 changes: 4 additions & 4 deletions packages/frontend/app/home/cloud-docs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default function CloudDocsPage() {
};

return (
<div className="min-h-screen bg-white flex w-full">
<div className="flex flex-1 w-full">
{/* Folder tree sidebar */}
<div className="flex-shrink-0">
<FolderTree onDocClick={handleDocClick} />
Expand Down Expand Up @@ -243,7 +243,7 @@ export default function CloudDocsPage() {
: "text-gray-500 hover:text-gray-900"
}`}
>
<span>与我共享</span>
<span>Shared with me</span>
</button>
<button
onClick={() => setActiveTab("favorites")}
Expand All @@ -253,7 +253,7 @@ export default function CloudDocsPage() {
: "text-gray-500 hover:text-gray-900"
}`}
>
<span>收藏</span>
<span>Favorites</span>
</button>
</div>
</div>
Expand Down Expand Up @@ -332,7 +332,7 @@ export default function CloudDocsPage() {
</div>
)}

{/* 创建文档 loading 遮罩 */}
{/** Document creation loading overlay */}
{creatingDoc && (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-white/60 backdrop-blur-sm">
<div className="flex flex-col items-center gap-3">
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/app/home/knowledge-base/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import { useState } from "react";
import { MdDatabase, MdAdd, MdSearch } from "react-icons/md";
import { MdLibraryBooks, MdAdd, MdSearch } from "react-icons/md";

const SAMPLE_ITEMS = [
{ id: 1, title: "Product Requirements 2024", updatedAt: "2 hours ago", count: 12 },
Expand Down Expand Up @@ -101,7 +101,7 @@ export default function KnowledgeBasePage() {
className="w-10 h-10 rounded-xl flex items-center justify-center"
style={{ background: "#f2f3ff" }}
>
<MdDatabase size={20} style={{ color: "#0043b5" }} />
<MdLibraryBooks size={20} style={{ color: "#0043b5" }} />
</div>
<div>
<p className="font-semibold text-sm" style={{ color: "#131b2e" }}>
Expand Down
Loading