mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-08-29 20:22:10 +00:00
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
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
"use client";
|
|
|
|
import { useTranslations } from "next-intl";
|
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
import type { DocumentsEmptyReason } from "@/lib/documents/documents-view-model";
|
|
|
|
export function DocumentsEmptyState({ reason }: { reason: DocumentsEmptyReason }) {
|
|
const t = useTranslations("documents");
|
|
|
|
if (reason.kind === "loading") {
|
|
return (
|
|
<output className="block space-y-1 px-4 py-2" aria-busy="true" aria-label={t("loading")}>
|
|
{["loading-1", "loading-2", "loading-3", "loading-4", "loading-5"].map((key, index) => (
|
|
<div key={key} className="flex h-8 items-center gap-2">
|
|
<Skeleton className="size-4 rounded-sm" />
|
|
<Skeleton className={index % 2 === 0 ? "h-4 w-44" : "h-4 w-32"} />
|
|
</div>
|
|
))}
|
|
</output>
|
|
);
|
|
}
|
|
|
|
const title =
|
|
reason.kind === "workspace_empty" ? t("no_documents") : t("empty_no_matching_documents");
|
|
const description =
|
|
reason.kind === "workspace_empty"
|
|
? t("empty_upload_files")
|
|
: reason.kind === "no_search_results"
|
|
? t("empty_try_different_search")
|
|
: t("empty_adjust_filters");
|
|
|
|
return (
|
|
<output
|
|
className="flex flex-1 select-none flex-col items-center justify-center gap-1 px-4 py-12 text-center text-muted-foreground"
|
|
aria-live="polite"
|
|
>
|
|
<p className="text-sm font-medium">{title}</p>
|
|
<p className="text-xs text-muted-foreground/70">{description}</p>
|
|
</output>
|
|
);
|
|
}
|