Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
fix(ok): give the bug-report toast a close button (PRD-8483) (#4028)
Andrew Mikofalvyed8742b16d2b
diff --git a/.changeset/bug-report-toast-close-button.md b/.changeset/bug-report-toast-close-button.mdnew file mode 100644index 000000000..66cfb8fa3--- /dev/null+++ b/.changeset/bug-report-toast-close-button.md@@ -0,0 +1,7 @@+---+"@inkeep/open-knowledge": patch+---++The bug-report toast can be closed.++Sending a report puts a toast in the corner that reports progress and then the outcome. It carried no close button, unlike the app's ordinary toasts, so the three outcomes that offered actions — the reference to copy, the email draft, the failed send you can retry — could only be waited out, and two of those never time out at all. Each of the five now carries a close button in the corner, in the same place the app's ordinary toasts put theirs. The separate **Dismiss** button on the in-progress and already-sending toasts is gone; the close button replaces it.diff --git a/packages/app/src/components/BugReportSendToast.dom.test.tsx b/packages/app/src/components/BugReportSendToast.dom.test.tsxindex fe3e79f19..ae7bc6e8d 100644--- a/packages/app/src/components/BugReportSendToast.dom.test.tsx+++ b/packages/app/src/components/BugReportSendToast.dom.test.tsx@@ -124,12 +124,16 @@ describe('while the send is in flight', () => {await settleWith(FAILED_RESULT);});- test('Dismiss asks the host to close the toast without touching the send', async () => {+ test('Close asks the host to close the toast without touching the send', async () => {const manager = startOperation();const actions = makeActions();renderToast(manager, actions);- await userEvent.click(screen.getByRole('button', { name: 'Dismiss' }));+ // The corner button is the only dismiss affordance: a partial revert that+ // brought the labelled one back alongside it would otherwise pass.+ expect(screen.queryByRole('button', { name: 'Dismiss' })).toBeNull();++ await userEvent.click(screen.getByRole('button', { name: 'Close' }));expect(actions.dismiss).toHaveBeenCalledTimes(1);expect(manager.get(OPERATION_ID)?.status).toBe('sending');@@ -271,3 +275,64 @@ describe('when the operation is unknown', () => {expect(container.textContent).toBe('');});});++/**+ * Pinned per outcome rather than on one representative status: the sonner gate+ * that makes `ToastCard` supply its own close button (see that component's+ * docblock) is per-body, but the wiring below is per-layout.+ *+ * The tab assertion guards the source order specifically. The button is+ * absolutely positioned, so moving it back below the content column is+ * visually free and would silently put every action button ahead of Close.+ */+describe('every outcome can be closed', () => {+ const outcomes: ReadonlyArray<+ readonly [label: string, settle: (() => Promise<void>) | undefined, marker: string]+ > = [+ ['sending', undefined, 'Sending report'],+ ['sent', () => settleWith({ ok: true, reference: 'OK-1234-ABCD' }), 'Thanks for the report!'],+ [+ 'email-draft',+ () =>+ settleWith({+ ok: false,+ reason: 'email-draft',+ fallback: { mailtoUrl: MAILTO, zipPath: ZIP_PATH },+ }),+ 'Send your report by email',+ ],+ ['failed', () => settleWith(FAILED_RESULT), "Couldn't send the report"],+ [+ 'already-sending',+ () =>+ settleWith({+ ok: false,+ reason: 'send-in-flight',+ fallback: { mailtoUrl: MAILTO, zipPath: ZIP_PATH },+ }),+ 'Already sending this report',+ ],+ ];++ test.each(outcomes)('%s offers Close', async (_label, settle, marker) => {+ const manager = startOperation();+ const actions = makeActions();+ if (settle !== undefined) await settle();+ renderToast(manager, actions);++ // Guards the case where a layout renamed its copy and the assertion below+ // would otherwise pass against whichever layout happened to render.+ expect(screen.getByText(marker)).toBeTruthy();++ expect(screen.queryByRole('button', { name: 'Dismiss' })).toBeNull();++ const close = screen.getByRole('button', { name: 'Close' });+ await userEvent.tab();+ expect(document.activeElement).toBe(close);++ await userEvent.click(close);+ expect(actions.dismiss).toHaveBeenCalledTimes(1);++ if (settle === undefined) await settleWith(FAILED_RESULT);+ });+});diff --git a/packages/app/src/components/BugReportSendToast.tsx b/packages/app/src/components/BugReportSendToast.tsxindex b7aa020c4..5348d511d 100644--- a/packages/app/src/components/BugReportSendToast.tsx+++ b/packages/app/src/components/BugReportSendToast.tsx@@ -19,7 +19,7 @@*/import { Trans, useLingui } from '@lingui/react/macro';-import { AlertCircleIcon, CheckIcon, CopyIcon, InfoIcon, MailIcon } from 'lucide-react';+import { AlertCircleIcon, CheckIcon, CopyIcon, InfoIcon, MailIcon, XIcon } from 'lucide-react';import type { ReactNode } from 'react';import { useEffect, useId, useState, useSyncExternalStore } from 'react';import { Button } from '@/components/ui/button';@@ -82,9 +82,42 @@ export function BugReportSendToast({}}-function ToastCard({ icon, children }: { icon: ReactNode; children: ReactNode }) {+/**+ * Sonner renders its own close button only for a non-jsx toast, so a+ * `toast.custom` body gets none however `<Toaster />` is configured. The gate+ * is per-body, not per-layout, so the card supplies its own on every outcome.+ *+ * A 20px circle pinned to the inline-start corner and offset out over the+ * border, matching where sonner puts its own at the time of writing, so this+ * toast dismisses from the same place as the app's ordinary toasts. The offset+ * is a negative logical margin rather than a translate: `buttonVariants` drives+ * its press feedback through `translate-y`, and a positioning translate on the+ * same custom property loses to the higher-specificity `:active` rule.+ *+ * First in source as well as first on screen, so the control at the reading+ * origin is also the one focus reaches first.+ */+function ToastCard({+ icon,+ onDismiss,+ children,+}: {+ icon: ReactNode;+ onDismiss: () => void;+ children: ReactNode;+}) {+ const { t } = useLingui();return (- <div className="flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg">+ <div className="relative flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg">+ <Button+ type="button"+ variant="ghost"+ className="-ms-[0.4375rem] -mt-[0.4375rem] absolute start-0 top-0 size-5 rounded-full border-border bg-popover p-0 text-popover-foreground"+ aria-label={t`Close`}+ onClick={onDismiss}+ >+ <XIcon className="size-3" aria-hidden="true" />+ </Button>{icon}<div className="flex min-w-0 flex-1 flex-col gap-1.5">{children}</div></div>@@ -106,6 +139,7 @@ function SendingLayout({return (<ToastCardicon={<Spinner className="mt-0.5 size-4 shrink-0 text-primary" aria-hidden="true" />}+ onDismiss={actions.dismiss}><div className="flex items-baseline gap-2"><p id={titleId} className="font-medium text-sm">@@ -128,11 +162,6 @@ function SendingLayout({aria-labelledby={titleId}className="h-1.5 bg-secondary"/>- <ActionRow>- <Button size="sm" variant="ghost" onClick={actions.dismiss}>- <Trans>Dismiss</Trans>- </Button>- </ActionRow></ToastCard>);}@@ -147,6 +176,7 @@ function SentLayout({return (<ToastCardicon={<CheckIcon className="mt-0.5 size-4 shrink-0 text-primary" aria-hidden="true" />}+ onDismiss={actions.dismiss}><p className="font-medium text-sm"><Trans>Thanks for the report!</Trans>@@ -184,6 +214,7 @@ function EmailDraftLayout({return (<ToastCardicon={<MailIcon className="mt-0.5 size-4 shrink-0 text-primary" aria-hidden="true" />}+ onDismiss={actions.dismiss}><p className="font-medium text-sm"><Trans>Send your report by email</Trans>@@ -225,6 +256,7 @@ function FailedLayout({icon={<AlertCircleIcon className="mt-0.5 size-4 shrink-0 text-destructive" aria-hidden="true" />}+ onDismiss={actions.dismiss}><p className="font-medium text-sm"><Trans>Couldn't send the report</Trans>@@ -257,6 +289,7 @@ function AlreadySendingLayout({ actions }: { actions: BugReportSendToastActionsreturn (<ToastCardicon={<InfoIcon className="mt-0.5 size-4 shrink-0 text-primary" aria-hidden="true" />}+ onDismiss={actions.dismiss}><p className="font-medium text-sm"><Trans>Already sending this report</Trans>@@ -269,11 +302,6 @@ function AlreadySendingLayout({ actions }: { actions: BugReportSendToastActionsThis report is already on its way. Its result will appear in your bug report history.</Trans></p>- <ActionRow>- <Button size="sm" variant="ghost" onClick={actions.dismiss}>- <Trans>Dismiss</Trans>- </Button>- </ActionRow></ToastCard>);}diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.poindex d6dabe99c..e87ac3608 100644--- a/packages/app/src/locales/ar/messages.po+++ b/packages/app/src/locales/ar/messages.po@@ -2816,6 +2816,7 @@ msgstr "يجري استنساخ {repoName}..."msgid "Cloning..."msgstr "يجري الاستنساخ..."+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4771,7 +4772,6 @@ msgid "Disconnecting"msgstr "يجري قطع الاتصال"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.poindex 42fdec870..6b8a4c51e 100644--- a/packages/app/src/locales/bn/messages.po+++ b/packages/app/src/locales/bn/messages.po@@ -2812,6 +2812,7 @@ msgstr "{repoName} ক্লোন করা হচ্ছে…"msgid "Cloning..."msgstr "ক্লোন করা হচ্ছে…"+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4767,7 +4768,6 @@ msgid "Disconnecting"msgstr "সংযোগ বিচ্ছিন্ন করা হচ্ছে"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.poindex 6b3315b04..6113f39c3 100644--- a/packages/app/src/locales/en/messages.po+++ b/packages/app/src/locales/en/messages.po@@ -2816,6 +2816,7 @@ msgstr "Cloning {repoName}..."msgid "Cloning..."msgstr "Cloning..."+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4771,7 +4772,6 @@ msgid "Disconnecting"msgstr "Disconnecting"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.poindex 6b7636f06..f47ccc0c1 100644--- a/packages/app/src/locales/es/messages.po+++ b/packages/app/src/locales/es/messages.po@@ -2816,6 +2816,7 @@ msgstr "Clonando {repoName}..."msgid "Cloning..."msgstr "Clonando..."+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4771,7 +4772,6 @@ msgid "Disconnecting"msgstr "Desconectando"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.poindex 7b9b63500..bbd505604 100644--- a/packages/app/src/locales/fr/messages.po+++ b/packages/app/src/locales/fr/messages.po@@ -2816,6 +2816,7 @@ msgstr "Clonage de {repoName}…"msgid "Cloning..."msgstr "Clonage…"+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4771,7 +4772,6 @@ msgid "Disconnecting"msgstr "Déconnexion"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.poindex a77f917fb..50e8e8e59 100644--- a/packages/app/src/locales/hi/messages.po+++ b/packages/app/src/locales/hi/messages.po@@ -2812,6 +2812,7 @@ msgstr "{repoName} क्लोन किया जा रहा है…"msgid "Cloning..."msgstr "क्लोन किया जा रहा है…"+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4767,7 +4768,6 @@ msgid "Disconnecting"msgstr "कनेक्शन तोड़ा जा रहा है"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.poindex 44221a95c..ee7e2a2d1 100644--- a/packages/app/src/locales/id/messages.po+++ b/packages/app/src/locales/id/messages.po@@ -2812,6 +2812,7 @@ msgstr "Mengkloning {repoName}..."msgid "Cloning..."msgstr "Mengkloning..."+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4767,7 +4768,6 @@ msgid "Disconnecting"msgstr "Memutus koneksi"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/ko/messages.po b/packages/app/src/locales/ko/messages.poindex 6e03ab2ab..76c6887c8 100644--- a/packages/app/src/locales/ko/messages.po+++ b/packages/app/src/locales/ko/messages.po@@ -2816,6 +2816,7 @@ msgstr "{repoName} 클론 중…"msgid "Cloning..."msgstr "클론 중…"+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4771,7 +4772,6 @@ msgid "Disconnecting"msgstr "연결 해제 중"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.poindex 10b2efee8..7801c0fc3 100644--- a/packages/app/src/locales/pseudo/messages.po+++ b/packages/app/src/locales/pseudo/messages.po@@ -2812,6 +2812,7 @@ msgstr ""msgid "Cloning..."msgstr ""+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4767,7 +4768,6 @@ msgid "Disconnecting"msgstr ""#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.poindex cc97161d1..afdffc1b0 100644--- a/packages/app/src/locales/pt-BR/messages.po+++ b/packages/app/src/locales/pt-BR/messages.po@@ -2812,6 +2812,7 @@ msgstr "Clonando {repoName}..."msgid "Cloning..."msgstr "Clonando..."+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4767,7 +4768,6 @@ msgid "Disconnecting"msgstr "Desconectando"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.poindex 2dc8335d8..b8b4d0e21 100644--- a/packages/app/src/locales/ur/messages.po+++ b/packages/app/src/locales/ur/messages.po@@ -2816,6 +2816,7 @@ msgstr "{repoName} کلون کیا جا رہا ہے..."msgid "Cloning..."msgstr "کلون کیا جا رہا ہے..."+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4771,7 +4772,6 @@ msgid "Disconnecting"msgstr "منقطع کیا جا رہا ہے"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.poindex 2599672e2..77eb817be 100644--- a/packages/app/src/locales/zh-Hans/messages.po+++ b/packages/app/src/locales/zh-Hans/messages.po@@ -2816,6 +2816,7 @@ msgstr "正在克隆 {repoName}…"msgid "Cloning..."msgstr "正在克隆…"+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4771,7 +4772,6 @@ msgid "Disconnecting"msgstr "正在断开连接"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsxdiff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.poindex 9b9b9621c..1da5ed4b2 100644--- a/packages/app/src/locales/zh-Hant/messages.po+++ b/packages/app/src/locales/zh-Hant/messages.po@@ -2816,6 +2816,7 @@ msgstr "正在複製 {repoName}…"msgid "Cloning..."msgstr "正在複製…"+#: src/components/BugReportSendToast.tsx#: src/components/EditorTabs.tsx#: src/components/FeedbackForm.tsx#: src/components/InstallInClaudeDesktopDialog.tsx@@ -4771,7 +4772,6 @@ msgid "Disconnecting"msgstr "正在中斷連接"#: src/components/BranchRecycleBanner.tsx-#: src/components/BugReportSendToast.tsx#: src/components/NavigatorApp.tsx#: src/components/OnboardingCard.tsx#: src/components/settings/SharingSection.tsx