fix(ui): trim document-read copy and de-duplicate recovery headings

Remove the two per-document AI copy blocks in the document detail sheet:
the external-egress notice and the "read this document" explainer. The
settings-toggle honesty confirm already states the egress trade, so the
per-document repeat is redundant. Drop the now-unused `egressExternal`
prop and the `documents.ai.egressNotice` + `documents.ai.available` keys
across all six locales. Keep the capability `egress` DTO field — the API
still reports it.

On /insights/recovery, the metric block rendered an outer heading plus an
explainer above a tile whose own header repeated the same title. Move the
explainer inside the tile as a `description` beneath its `TileHeader` and
promote the tile title to a real `<h2>` (new `titleAs` affordance), so each
metric shows one heading with the blurb under it and the h1->h2 outline
stays nested. Applies to every metric the block renders.
This commit is contained in:
Marc-André Bombeck committed 2026-07-09 13:42:14 +02:00
1 parent 1e2b1d2c6a
commit 97f8cb4303
13 files changed
+88 -85

No files matched your search

@@ -34,7 +34,6 @@ function base(
aiEnabled: true,
indexEnabled: true,
unavailableReason: null,
egressExternal: false,
actionsDisabled: false,
onSuggest: noop,
suggestPending: false,
@@ -143,20 +142,14 @@ describe("<DocumentAiSection>", () => {
expect(html).toContain("Not saved");
});
it("shows the vendor-blind egress notice before an external document read", () => {
const html = render(base({ aiEnabled: true, egressExternal: true }));
expect(html).toContain('data-slot="document-ai-egress-notice"');
expect(html).toContain("third-party AI service");
// Vendor-blind: never names a specific AI vendor in the document surface.
expect(html).not.toContain("OpenAI");
expect(html).not.toContain("ChatGPT");
// The actions are still offered — the notice informs, it does not block.
expect(html).toContain('data-slot="assist-suggest"');
});
it("omits the egress notice when the read stays on the local machine", () => {
const html = render(base({ aiEnabled: true, egressExternal: false }));
it("renders no per-document egress notice — the settings confirm covers it", () => {
// The per-document egress notice was retired; the settings-toggle honesty
// confirm is now the single place the egress trade is stated.
const html = render(base({ aiEnabled: true }));
expect(html).not.toContain('data-slot="document-ai-egress-notice"');
// The actions are still offered.
expect(html).toContain('data-slot="assist-suggest"');
expect(html).toContain('data-slot="document-read-ai"');
});
it("hides the Read-with-AI action when indexing is unavailable but keeps suggest", () => {
@@ -22,7 +22,7 @@
* status pill stays, honestly reflecting any local auto-index, and the manual
* form below stays fully usable.
*/
import { FileText, ScanText, ShieldAlert, WandSparkles } from "lucide-react";
import { FileText, ScanText, WandSparkles } from "lucide-react";
import type { ReactNode } from "react";
import { Button } from "@/components/ui/button";
@@ -47,7 +47,6 @@ export function DocumentAiSection({
aiEnabled,
indexEnabled,
unavailableReason,
egressExternal,
actionsDisabled,
onSuggest,
suggestPending,
@@ -75,12 +74,6 @@ export function DocumentAiSection({
aiEnabled: boolean;
indexEnabled: boolean;
unavailableReason: "no-provider" | "enable-local-ocr" | null;
/**
* True when a document read will egress to a third-party AI service (any
* provider other than a self-hosted local model). Drives the vendor-blind
* "this leaves your machine" notice shown before the AI actions.
*/
egressExternal: boolean;
/** Capability still resolving — the transport mode isn't known yet. */
actionsDisabled: boolean;
onSuggest: () => void;
@@ -143,23 +136,8 @@ export function DocumentAiSection({
/>
</div>
{egressExternal ? (
<div
data-slot="document-ai-egress-notice"
role="note"
className="border-border text-muted-foreground flex items-start gap-2 rounded-lg border border-dashed px-3 py-2.5 text-xs"
>
<ShieldAlert className="mt-0.5 size-3.5 shrink-0" aria-hidden />
<p className="min-w-0">{t("documents.ai.egressNotice")}</p>
</div>
) : null}
{aiEnabled ? (
<>
<p className="text-muted-foreground text-xs">
{t("documents.ai.available")}
</p>
<div className="flex flex-wrap items-center gap-2">
{indexEnabled ? (
<Button
@@ -506,7 +506,6 @@ export function DocumentDetailSheet({
aiEnabled={aiEnabled}
indexEnabled={indexEnabled}
unavailableReason={capability.data?.reason ?? null}
egressExternal={capability.data?.egress === "external"}
actionsDisabled={capability.isPending}
onSuggest={runSuggest}
suggestPending={suggest.isPending}