From a9300682ee284f53fc3302981165a470a9df944f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 28 May 2026 22:37:58 -0400 Subject: [PATCH] Make the Files scan-status filter functional --- .../src/renderer/src/pages/FilesPage.tsx | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx b/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx index 428487e5..a2108797 100644 --- a/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx +++ b/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx @@ -1,7 +1,8 @@ import { useMemo, useState } from "react"; import { Button, Icon, Segmented } from "../shared/ui"; import { TopbarActions } from "../shared/TopbarActions"; -import type { FileObjectRecord } from "../../../shared/domain"; +import { FILE_SCAN_STATE, type FileObjectRecord, type FileScanState } from "../../../shared/domain"; +import { MenuLabel, MenuRow, Popover } from "../shared/Popover"; import type { PageProps } from "./types"; import { activeOrgId, formatBytes } from "./types"; import { FilesTree } from "./files/FilesTree"; @@ -29,10 +30,12 @@ export function FilesPage({ snapshot, actions }: PageProps) { ); const [section, setSection] = useState
({ kind: "all" }); const [view, setView] = useState("list"); + const [scanFilter, setScanFilter] = useState("all"); const departments = collectDepartments(agents); const filesByAgent = collectAgentFiles(files, agents); - const visibleFiles = filterFiles(files, section, agents); + const sectionFiles = filterFiles(files, section, agents); + const visibleFiles = scanFilter === "all" ? sectionFiles : sectionFiles.filter((file) => file.scanState === scanFilter); const pinnedFiles = files.filter((file) => file.pinned); const totalBytes = visibleFiles.reduce((sum, file) => sum + file.sizeBytes, 0); @@ -62,7 +65,7 @@ export function FilesPage({ snapshot, actions }: PageProps) {
- + value={view} onChange={setView} @@ -128,3 +131,38 @@ export function FilesPage({ snapshot, actions }: PageProps) {
); } + +function FilesFilter({ + scan, + onScan, +}: { + scan: FileScanState | "all"; + onScan: (next: FileScanState | "all") => void; +}) { + const options: ReadonlyArray<{ id: FileScanState | "all"; label: string }> = [ + { id: "all", label: "All files" }, + { id: FILE_SCAN_STATE.APPROVED, label: "Clean" }, + { id: FILE_SCAN_STATE.BLOCKED, label: "Blocked" }, + ]; + return ( + ( + + )} + > + {() => ( + <> + Scan status + {options.map((option) => ( + onScan(option.id)}> + {option.label} + {scan === option.id && } + + ))} + + )} + + ); +}