SurfSense/surfsense_web/components/documents/DocumentsView.tsx
Yigtwxx 908b9aafc4 fix(web): restore biome compliance in the documents view
The biome-check-web pre-commit hook runs `biome check .` over the whole
surfsense_web tree, not just the files a PR touches, so the twelve
diagnostics sitting in the documents view fail Frontend Quality for
every unrelated PR that happens to change anything under surfsense_web.

Six files were formatted at a narrower line width than the configured
lineWidth of 100 and three had unsorted imports; both are pure
`biome check --write` output.

The remaining three are a11y rules with no automatic fix. Two elements
carried `role="status"` where useSemanticElements wants the native
`<output>`, and the loading skeleton had an `aria-label` on a role-less
`<div>`, which useAriaPropsSupportedByRole rejects. All three become
`<output>`, which has the implicit status role and accepts the labels,
so the announced behaviour is unchanged; `block` keeps the two that
replaced block-level elements laid out as before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CpY4T39RzhWyUV9qQpPWw7
2026-08-08 00:09:32 +03:00

32 lines
1 KiB
TypeScript

"use client";
import type { FolderDisplay } from "@/lib/documents/document-tree-types";
import type { DocumentsViewModel } from "@/lib/documents/documents-view-model";
import { DocumentsEmptyState } from "./DocumentsEmptyState";
import { DocumentsSearchResults } from "./DocumentsSearchResults";
import { FolderTreeView, type FolderTreeViewProps } from "./FolderTreeView";
interface DocumentsViewProps extends Omit<FolderTreeViewProps, "folders" | "documents"> {
viewModel: DocumentsViewModel;
onOpenFolder: (folder: FolderDisplay) => void;
}
export function DocumentsView({ viewModel, onOpenFolder, ...treeProps }: DocumentsViewProps) {
if (viewModel.mode === "empty") {
return <DocumentsEmptyState reason={viewModel.reason} />;
}
if (viewModel.mode === "search") {
return (
<DocumentsSearchResults
hits={viewModel.hits}
onOpenDocument={treeProps.onPreviewDocument}
onOpenFolder={onOpenFolder}
/>
);
}
return (
<FolderTreeView {...treeProps} folders={viewModel.folders} documents={viewModel.documents} />
);
}