refactor(chat): extract and reuse permission action buttons#55
refactor(chat): extract and reuse permission action buttons#55isYangs wants to merge 3 commits intoxintaofei:mainfrom
Conversation
JiwaniZakir
left a comment
There was a problem hiding this comment.
The refactored PermissionActions component introduces a subtle regression: the fallback button (no detail) uses a fixed className="h-9", but the original code in permission-dialog.tsx used h-auto min-h-9 whitespace-normal break-words to accommodate longer translated labels. With 10+ locales added in this PR, some translations (e.g., Arabic رفض دائمًا) may overflow or get clipped at a fixed h-9 — the max-w-full basis-full treatment is only applied when detail is present.
The t(labelKey as never) cast in permission-actions.tsx suppresses TypeScript's key-safety checks on the translation function. Consider defining a proper union type from KIND_LABEL_KEYS values (or a typed const assertion) so the compiler can verify those keys exist in the message catalog — especially important since this component now shares translation keys across all locales added in this diff.
Finally, extractDetail only runs when labelKey is defined, meaning any unrecognized opt.kind values whose names contain backtick-delimited content will silently render the raw opt.name string without the split label/detail layout. Whether that's intentional should be documented with a comment, since it's a non-obvious branch in the rendering logic.
Thanks for the thorough review! All three points are valid and have been addressed: Fixed height regression — Both button variants now use |
Summary
Refactor the chat permission dialog by extracting permission action buttons into a dedicated component and localizing the action labels.
Changes
PermissionActionscomponent for permission responsesPermissionDialog