Skip to content

feat: enhance AlertDialog and ConfirmDialog providers with customizable message defaults#9

Merged
phev8 merged 2 commits into
mainfrom
con-119-improve-localisation-possibilities-for-c-ui-strings
Apr 30, 2026
Merged

feat: enhance AlertDialog and ConfirmDialog providers with customizable message defaults#9
phev8 merged 2 commits into
mainfrom
con-119-improve-localisation-possibilities-for-c-ui-strings

Conversation

@phev8

@phev8 phev8 commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@greptile-apps

greptile-apps Bot commented Apr 30, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds opt-in messages props to AlertDialogProvider and ConfirmDialogProvider, allowing app-level copy defaults (titles, button labels, confirmation label template) that can be overridden per alert()/confirm() call. ConfirmDialogProvider also gains a defaultVariant prop. The refactor correctly replaces || with ?? so that explicit empty-string call-site values are respected, and moves hardcoded English strings into DEFAULT_*_MESSAGES constants.

Confidence Score: 5/5

Safe to merge; all open concerns are P2 and were flagged in prior review threads.

No new P0 or P1 issues found. The || → ?? migration is correct, DEFAULT_*_MESSAGES constants are well-structured, and the per-call override precedence is implemented correctly throughout. The two previously flagged concerns (missing useMemo on resolvedMessages and the stale JSDoc) remain P2 and are already tracked.

registry/radix-nova/confirm-provider.tsx and registry/radix-nova/alert-provider.tsx — useMemo on resolvedMessages (tracked in prior review thread).

Important Files Changed

Filename Overview
registry/radix-nova/confirm-provider.tsx Adds ConfirmDialogMessages interface, DEFAULT_CONFIRM_MESSAGES constant, and messages/defaultVariant props; switches fallbacks from
registry/radix-nova/alert-provider.tsx Adds AlertDialogMessages interface, DEFAULT_ALERT_MESSAGES constant, and messages prop; resolvedMessages is computed inline (no useMemo), previously flagged.
registry/radix-nova/confirm-dialog.tsx Adds requireConfirmationLabel as a required prop, removes hardcoded default string, and falls back to the provider-supplied label. JSDoc on label still references old hardcoded default (previously flagged).
components/docs/interactive-examples/confirm-dialog.tsx Moves per-call confirmButtonText/cancelButtonText/label to the provider messages prop to showcase the new feature; minor provider-scope mismatch for "Keep item" but acceptable for a demo.
components/docs/interactive-examples/alert-dialog.tsx Moves buttonLabel from per-call to the provider messages prop; clean, no issues.
content/docs/components/confirm.mdx Adds Provider Defaults section, Next.js + next-intl usage guide, and updated configuration tables; accurate and helpful.
content/docs/components/alert-provider.mdx Adds Provider Defaults section and updated configuration table; accurate and well-structured.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["alert(options) / confirm(options)"] --> B{options.field\nnot undefined?}
    B -- Yes --> C["Use per-call value"]
    B -- No --> D{messages prop\nprovided to provider?}
    D -- Yes --> E["Use messages.field"]
    D -- No --> F["Use DEFAULT_*_MESSAGES\nhardcoded fallback"]

    subgraph confirmOnly["ConfirmDialog only"]
        G["requireConfirmationInput.label?"] -- present --> H["Use per-call label"]
        G -- absent --> I["Use resolvedMessages\n.requireConfirmationLabel"]
        I --> J["Split on {{confirmTerm}}\nrender bold placeholder"]
    end

    C & E & F --> confirmOnly
Loading

Reviews (2): Last reviewed commit: "refactor: replace getRequireConfirmation..." | Re-trigger Greptile

Comment thread registry/radix-nova/confirm-dialog.tsx Outdated
Comment thread registry/radix-nova/confirm-provider.tsx
…nLabel for consistent message handling in ConfirmDialog
@phev8 phev8 merged commit 88148ed into main Apr 30, 2026
3 checks passed
@phev8 phev8 deleted the con-119-improve-localisation-possibilities-for-c-ui-strings branch April 30, 2026 08:27
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