Skip to content

fix: unified dialog/toast UI for all confirm and alert popups#474

Open
cinderzhan wants to merge 1 commit intomainfrom
fix/unified-dialogs
Open

fix: unified dialog/toast UI for all confirm and alert popups#474
cinderzhan wants to merge 1 commit intomainfrom
fix/unified-dialogs

Conversation

@cinderzhan
Copy link
Copy Markdown
Collaborator

Summary

  • Users were seeing browser-default confirm() / alert() popups (session delete, model connectivity test, file upload errors, etc.) that broke visual consistency with the rest of the app.
  • Introduces a unified dialog/toast system so every notification uses the Clawith UI, and migrates all 46 native call sites across 9 files.

What changed

  • DialogProvider + useDialog(): centered modal with Promise-based confirm() and alert() API. Supports info / success / warning / error types and collapsible details for long error payloads (e.g. the LLM connectivity test's raw 429 response).
  • ToastProvider + useToast(): top-right, auto-dismissing notifications with the same type/details support for non-critical errors.
  • Migration rule: destructive or must-acknowledge → dialog (session/tool/trigger/agent delete, connectivity test result, import failure); non-critical → toast (save failure, upload failure, file-count limit, etc.).

Test plan

  • Verified in dev: session delete now opens the centered Clawith-styled modal with red 删除 button (was browser default).
  • Verified Toast renders at top-right with icon and collapsible details.
  • Click through LLM connectivity test (enterprise settings → model pool → test) and confirm error payload is collapsible.
  • Click through a destructive delete (trigger / tool / agent) and confirm danger variant renders.
  • Trigger a toast-level error (upload failure, save failure) and confirm it auto-dismisses.

🤖 Generated with Claude Code

…dal/toast

Users were seeing browser-default confirm() and alert() popups (session delete,
model connectivity test, etc.) that broke visual consistency with the rest of
the app. Introduces a unified dialog/toast system so every notification uses
the Clawith UI.

- DialogProvider + useDialog(): centered modal with Promise-based confirm()
  and alert() API, info/success/warning/error types, collapsible details for
  long error payloads (e.g. LLM connectivity test raw errors).
- ToastProvider + useToast(): top-right auto-dismissing notifications with
  the same type/details support for non-critical errors.
- Migrated all 46 native alert/confirm call sites across 9 files following
  the split: destructive or must-acknowledge -> dialog; non-critical -> toast.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e9ab1273c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

)}
{existingProvider && (
<button className="btn btn-ghost btn-sm" style={{ color: 'var(--error)' }} onClick={() => confirm('Are you sure you want to delete this configuration?') && deleteProvider.mutate(existingProvider.id)}>
<button className="btn btn-ghost btn-sm" style={{ color: 'var(--error)' }} onClick={async () => { const ok = await dialog.confirm('确定要删除此配置吗?', { title: '删除配置', danger: true, confirmLabel: '删除' }); if (ok) deleteProvider.mutate(existingProvider.id); }}>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Define dialog hook in OrgTab before calling confirm

The delete-configuration button now calls dialog.confirm(...) inside OrgTab, but OrgTab does not create a dialog instance (the hook is only initialized in other components). Clicking this button will throw a runtime ReferenceError and the delete flow will break for identity-provider configs.

Useful? React with 👍 / 👎.

return (
<div
role="status"
onMouseEnter={pause}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore toast dismissal after hover pause

The toast timer is cleared on onMouseEnter, but there is no corresponding restart on mouse leave, so any toast the cursor touches can remain indefinitely instead of auto-dismissing. This causes notification buildup during normal use near the top-right corner and contradicts the expected transient behavior.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant