Explorar el Código

feat(web): 为表格加载失败添加插画并移除错误行悬停底色

sy hace 1 día
padre
commit
cd322f0120

BIN
klt-bos-web/public/images/table-load-error.webp


+ 5 - 3
klt-bos-web/src/components/TableState.tsx

@@ -1,5 +1,5 @@
 import type { ReactNode } from "react";
-import { FileSearch, FileWarning, LoaderCircle, RotateCw } from "lucide-react";
+import { FileSearch, LoaderCircle, RotateCw } from "lucide-react";
 import "./table-state.css";
 
 export type TableStateProps = {
@@ -11,9 +11,11 @@ export type TableStateProps = {
 };
 
 export function TableState({ kind = "empty", children, details, onRetry, busy }: TableStateProps) {
-  const Icon = kind === "error" ? FileWarning : kind === "loading" ? LoaderCircle : FileSearch;
+  const Icon = kind === "loading" ? LoaderCircle : FileSearch;
   return <div className="table-feedback" data-kind={kind}>
-    <span className="table-feedback-art" aria-hidden="true"><Icon size={28} strokeWidth={1.5} /></span>
+    {kind === "error"
+      ? <img className="table-feedback-illustration" src="/images/table-load-error.webp" alt="" width={168} height={112} />
+      : <span className="table-feedback-art" aria-hidden="true"><Icon size={28} strokeWidth={1.5} /></span>}
     <div className="table-feedback-copy" role={kind === "error" ? "alert" : "status"}>{children}</div>
     {onRetry && <button type="button" className="table-feedback-retry" disabled={busy} onClick={onRetry}>
       <RotateCw size={14} aria-hidden="true" />{busy ? "正在重试…" : "重新加载"}

+ 6 - 1
klt-bos-web/src/components/table-state.css

@@ -29,7 +29,12 @@
 }
 .table-feedback-art::before { left: 4px; top: 4px; }
 .table-feedback-art::after { right: 3px; bottom: 0; width: 3px; height: 3px; }
-.table-feedback[data-kind="error"] .table-feedback-art { color: var(--warning); background: var(--warning-soft); }
+.table-feedback-illustration { display: block; max-inline-size: 100%; block-size: auto; }
+/* Ledger styles can highlight either the row or its pinned cells. */
+tbody tr:has(> .ops-table-empty-cell .table-feedback[data-kind="error"]),
+tbody tr > .ops-table-empty-cell:has(.table-feedback[data-kind="error"]) {
+  background: transparent !important;
+}
 .table-feedback-copy { display: grid; justify-items: center; gap: 4px; max-inline-size: 42em; overflow-wrap: anywhere; font-size: 14px; font-weight: 500; line-height: 1.6; }
 .table-feedback-copy p { font-size: 13px; font-weight: 400; color: var(--muted-foreground); }
 .table-feedback-retry { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--primary-border); border-radius: 7px; background: var(--primary-soft); color: var(--primary-soft-foreground); font: 500 13px/1.5 var(--font-sans); cursor: pointer; }