Skip to content

Conversation

@bobbykolev
Copy link
Collaborator

@bobbykolev bobbykolev commented Nov 21, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced confirmation dialogs with separate workflows for cancellation and closure, displaying context-specific messages
    • Added internationalization support for cancel button customization
  • Style

    • Refined button styling in dialogs—cancel buttons now appear as text while confirm buttons display as contained for improved visual hierarchy
  • Refactor

    • Standardized translation key naming conventions

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Walkthrough

This PR updates English i18n translation keys (renaming buttons.yes-close to buttons.yesClose, adding buttons.yesCancel, and introducing post.cancelConfirm), enhances the ConfirmationDialog component to support i18n for cancel button text via an optional cancelButtonTextId prop, adjusts button styling (cancel to text, confirm to contained), and updates multiple dialog implementations to use the new cancellation-focused translations and props.

Changes

Cohort / File(s) Summary
Translation key updates
src/core/i18n/en/translation.en.json
Renamed buttons.yes-close to buttons.yesClose; added buttons.yesCancel key; added new post.closeConfirm.cancelConfirm object with title and description for discard confirmation.
ConfirmationDialog component enhancement
src/core/ui/dialogs/ConfirmationDialog.tsx
Added optional cancelButtonTextId?: TranslationKey prop to interface; cancel button variant changed from "contained" to "text"; confirm button variant changed from "text" to "contained" with explicit loading and disabled state passing; cancelButtonText now derives from translation key if provided, else falls back to original prop.
Call-out dialog updates
src/domain/collaboration/callout/CalloutDialogs/CreateCalloutDialog.tsx, src/domain/collaboration/callout/CalloutDialogs/EditCalloutDialog.tsx
Updated confirmation dialog button label key from buttons.yes-close to buttons.yesClose.
Post-related dialog updates
src/domain/collaboration/calloutContributions/post/CalloutContributionDialogPost.tsx, src/domain/collaboration/post/PostCreationDialog/PostCreationDialog.tsx
Switched from close-confirm to cancel-confirm translations; updated titleId and contentId to reference post-edit.cancelConfirm.*; changed confirmButtonTextId to buttons.yesCancel; added cancelButtonTextId with buttons.close.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • ConfirmationDialog component logic: Verify the fallback logic for cancelButtonTextIdcancelButtonText works correctly and button styling changes are intentional
  • Translation key consistency: Confirm all references to old buttons.yes-close key have been updated across dialog implementations
  • Dialog prop mappings: Validate that cancel-confirm translation paths exist and align with the new i18n structure added to the translation file

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly and specifically describes the main change: improving Post cancellation dialog buttons. The changes involve renaming translation keys, adding new button text translations, and updating dialog configurations across multiple files to support better cancellation workflows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch client-8929

Comment @coderabbitai help to get the list of available commands and usage tips.

@bobbykolev bobbykolev requested a review from polibb November 21, 2025 15:23
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 588d812 and 29ba4a2.

📒 Files selected for processing (6)
  • src/core/i18n/en/translation.en.json (2 hunks)
  • src/core/ui/dialogs/ConfirmationDialog.tsx (3 hunks)
  • src/domain/collaboration/callout/CalloutDialogs/CreateCalloutDialog.tsx (1 hunks)
  • src/domain/collaboration/callout/CalloutDialogs/EditCalloutDialog.tsx (1 hunks)
  • src/domain/collaboration/calloutContributions/post/CalloutContributionDialogPost.tsx (1 hunks)
  • src/domain/collaboration/post/PostCreationDialog/PostCreationDialog.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*

⚙️ CodeRabbit configuration file

**/*: Repository overview:

  • React 19 + TypeScript single-page app for the Alkemio platform. Uses Vite 5, Apollo Client 3, MUI 7, Emotion, Vitest.
  • Large surface (production build transforms ~18k modules). Core implementation lives in src/core, src/domain, and src/main; generated GraphQL hooks reside in src/core/apollo/generated.
  • Authoritative docs: README.md, docs/development-setup.md, .specify/memory/constitution.md, agents.md, .github/copilot-instructions.md.

Environment & bootstrap:

  1. Ensure Node >=20.9.0 (Volta pins 20.15.1) and pnpm >=10.17.1.
  2. Keep .env (checked in) present; override locally via .env.local.
  3. pnpm install (validated 2025-10-30, ~1s with cached deps). pnpm warns about ignored build scripts (@sentry/cli, esbuild, husky, msw); ignore or run pnpm approve-builds if required.

Validation flow (validated 2025-10-30):

  • pnpm lint → runs tsc --noEmit then ESLint on src/**/*.ts(x); completed cleanly.
  • pnpm vitest run --reporter=basic.
  • pnpm build →Rewrites .build/docker/.env.base and public/env-config.js; revert before commit. Emits expected large-chunk warnings.
  • pnpm serve:dev → serves ./build on port 3001 (after pnpm build).
  • pnpm format → Prettier for src/**/*.ts(x).
  • pnpm codegen → requires backend GraphQL endpoint at http://localhost:3000/graphql; regenerates src/core/apollo/generated artifacts.
  • pnpm start → Vite dev server (app reachable via Traefik on http://localhost:3000, Vite listens on 3001). Regenerates public/env-config.js each run.

Layout & architecture:

  • src/index.tsx bootstraps the SPA; src/root.tsx wires Sentry, Apollo, routing, auth, and global state.
  • src/core/ houses shared infrastructure (auth, analytics, routing helpers, UI kit, utilities).
  • src/domain/ contains domain façades/hooks grouped by business context (space, innovationHub, communication, etc.).
  • src/main/ provides routed shells, layouts, notifications, admin flows; keep business rules in `src/domain...

Files:

  • src/domain/collaboration/post/PostCreationDialog/PostCreationDialog.tsx
  • src/core/ui/dialogs/ConfirmationDialog.tsx
  • src/domain/collaboration/callout/CalloutDialogs/EditCalloutDialog.tsx
  • src/domain/collaboration/calloutContributions/post/CalloutContributionDialogPost.tsx
  • src/domain/collaboration/callout/CalloutDialogs/CreateCalloutDialog.tsx
  • src/core/i18n/en/translation.en.json
src/**/*.{ts,tsx,js}

⚙️ CodeRabbit configuration file

src/**/*.{ts,tsx,js}: Review the React/TypeScript code for correctness and alignment with docs/code-guidelines.md.
Rely on global error handling and logging; only flag missing local try/catch or logging when additional mitigation is required.
Non-null assertions are discouraged except when paired with skip guards on GraphQL queries (see existing patterns).
Watch for security issues (XSS, CSRF, sensitive data exposure) and TypeScript typing violations.

Files:

  • src/domain/collaboration/post/PostCreationDialog/PostCreationDialog.tsx
  • src/core/ui/dialogs/ConfirmationDialog.tsx
  • src/domain/collaboration/callout/CalloutDialogs/EditCalloutDialog.tsx
  • src/domain/collaboration/calloutContributions/post/CalloutContributionDialogPost.tsx
  • src/domain/collaboration/callout/CalloutDialogs/CreateCalloutDialog.tsx
src/**/*.json

⚙️ CodeRabbit configuration file

src/**/*.json: Validate structure, schema compliance, and absence of secrets. Keep localization payloads consistent.

Files:

  • src/core/i18n/en/translation.en.json
🧠 Learnings (2)
📚 Learning: 2025-10-07T10:50:35.561Z
Learnt from: ccanos
Repo: alkem-io/client-web PR: 8774
File: src/core/i18n/en/translation.en.json:881-889
Timestamp: 2025-10-07T10:50:35.561Z
Learning: In src/core/i18n/en/translation.en.json, the keys callout.contributions.contributionsItemsCountExpand and callout.contributions.contributionsCollapse are always used in PaginationExpander (src/domain/collaboration/calloutContributions/contributionsCardsExpandable/PaginationExpander.tsx) only when totalContributions > pageSize (typically >= 4). Therefore, they should remain plural-only (no _one/_other variants needed).

Applied to files:

  • src/domain/collaboration/post/PostCreationDialog/PostCreationDialog.tsx
  • src/domain/collaboration/callout/CalloutDialogs/EditCalloutDialog.tsx
  • src/domain/collaboration/calloutContributions/post/CalloutContributionDialogPost.tsx
  • src/domain/collaboration/callout/CalloutDialogs/CreateCalloutDialog.tsx
  • src/core/i18n/en/translation.en.json
📚 Learning: 2024-12-04T12:56:29.595Z
Learnt from: bobbykolev
Repo: alkem-io/client-web PR: 7278
File: src/domain/collaboration/callout/creationDialog/CalloutCreationDialog.tsx:154-154
Timestamp: 2024-12-04T12:56:29.595Z
Learning: When implementing `scrollToTop()` in `CalloutCreationDialog.tsx`, ensure it is only called after a successful callout creation and not executed in the event of an error.

Applied to files:

  • src/domain/collaboration/callout/CalloutDialogs/EditCalloutDialog.tsx
  • src/domain/collaboration/calloutContributions/post/CalloutContributionDialogPost.tsx
  • src/domain/collaboration/callout/CalloutDialogs/CreateCalloutDialog.tsx
🔇 Additional comments (8)
src/domain/collaboration/callout/CalloutDialogs/CreateCalloutDialog.tsx (1)

269-269: LGTM! Translation key updated to camelCase convention.

The rename from buttons.yes-close to buttons.yesClose aligns with the broader i18n key standardization across the codebase. The translation value remains unchanged.

src/domain/collaboration/post/PostCreationDialog/PostCreationDialog.tsx (1)

116-119: LGTM! Improved dialog semantics for post creation cancellation.

The shift from closeConfirm to cancelConfirm keys provides more appropriate messaging for a creation dialog where users are abandoning unsaved work. The addition of cancelButtonTextId enables explicit control over the cancel button label, enhancing UX clarity.

src/domain/collaboration/callout/CalloutDialogs/EditCalloutDialog.tsx (1)

227-227: LGTM! Consistent i18n key update.

The rename to buttons.yesClose maintains consistency with the naming convention applied throughout this PR.

src/domain/collaboration/calloutContributions/post/CalloutContributionDialogPost.tsx (1)

256-259: LGTM! Dialog updated with cancel-focused translations.

The shift to cancelConfirm keys and addition of cancelButtonTextId provides clearer messaging when users abandon post edits with unsaved changes. Consistent with similar dialogs across the codebase.

src/core/ui/dialogs/ConfirmationDialog.tsx (2)

19-19: LGTM! New optional prop for i18n cancel button text.

The cancelButtonTextId prop follows the same pattern as confirmButtonTextId and maintains backward compatibility by being optional.


45-47: LGTM! Cancel button text derivation consistent with confirm button pattern.

The logic properly translates cancelButtonTextId when provided and falls back to cancelButtonText, maintaining consistency with the existing confirmButtonText implementation.

src/core/i18n/en/translation.en.json (2)

126-127: LGTM! Button translations updated with improved naming convention.

The rename to yesClose (camelCase) improves consistency with other button keys like yesContinue and yesReplace. The new yesCancel key provides semantic distinction between closing and canceling operations.


3540-3543: New cancel-focused translations added alongside close-focused ones.

The new cancelConfirm translations provide more appropriate language for abandoning unsaved work ("Are you sure you want to cancel this post?"). Note that closeConfirm (lines 3536-3538) is still present, suggesting both are intentionally maintained for different dialog contexts.

This semantic distinction is valuable:

  • cancelConfirm: For abandoning in-progress work
  • closeConfirm: For closing completed/saved work

Comment on lines +63 to +72
<Button variant="text" onClick={actions.onCancel}>
{cancelButtonText || t('buttons.cancel')}
</Button>
{Boolean(actions.onConfirm) && (
<Button variant="text" loading={state?.isLoading} disabled={state?.isLoading} onClick={actions.onConfirm}>
<Button
variant="contained"
loading={state?.isLoading}
disabled={state?.isLoading}
onClick={actions.onConfirm}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Verify button styling works well for destructive confirmations.

The button variant swap (cancel: text, confirm: contained) emphasizes the confirm action, which is a common UX pattern. However, for destructive confirmations (e.g., delete dialogs), this could make dangerous actions more prominent.

Please verify this change works appropriately across all dialog types, especially destructive ones. Consider whether destructive confirmations might need different styling.

Run the following script to identify confirmation dialogs used for destructive actions:

Additionally, the explicit loading and disabled props on the confirm button are good improvements for state handling.


🏁 Script executed:

#!/bin/bash
# Description: Find ConfirmationDialog usages with destructive actions

# Search for ConfirmationDialog with delete/remove/destroy keywords
rg -n -B5 -A10 'ConfirmationDialog' --type=tsx --type=ts | rg -i 'delete|remove|destroy|destructive'

# Search for confirmButtonTextId with delete/remove
rg -n "confirmButtonTextId.*['\"]buttons\\.(delete|remove|yes.*delete)" --type=tsx --type=ts

Length of output: 55


🏁 Script executed:

#!/bin/bash
# Search for ConfirmationDialog usages with destructive patterns (no --type flags)

echo "=== Searching for ConfirmationDialog imports and destructive action patterns ==="
rg -n 'ConfirmationDialog' -A 15 | head -100

echo ""
echo "=== Searching for delete/remove button text patterns ==="
rg -n "confirmButtonTextId|confirm.*text.*delete|remove|destroy" -i | head -50

Length of output: 15557


🏁 Script executed:

#!/bin/bash
# Find all files that import or use ConfirmationDialog
echo "=== Files using ConfirmationDialog ==="
rg -l 'ConfirmationDialog' | head -20

echo ""
echo "=== Check src/domain for dialog patterns ==="
fd 'Dialog' src/domain --type f | head -20

Length of output: 3269


🏁 Script executed:

#!/bin/bash
# Find and examine specific delete confirmation usages

echo "=== CalendarEventDetailView delete pattern ==="
rg -n -B5 -A15 "confirmButtonTextId: 'buttons.delete'" src/domain/timeline/calendar/views/CalendarEventDetailView.tsx

echo ""
echo "=== CalendarDialog delete pattern ==="
rg -n -B5 -A15 "confirmButtonTextId: 'buttons.delete'" src/domain/timeline/calendar/CalendarDialog.tsx

echo ""
echo "=== ChatWidgetInner clear chat dialog ==="
rg -n -B5 -A20 "handleClearChat\|openClearConfirm" src/main/guidance/chatWidget/ChatWidgetInner.tsx | head -80

Length of output: 1731


🏁 Script executed:

#!/bin/bash
# Check the ConfirmationDialog component itself to see current state
echo "=== ConfirmationDialog implementation (lines 50-75) ==="
sed -n '50,75p' src/core/ui/dialogs/ConfirmationDialog.tsx

echo ""
echo "=== Check if any dialog overrides button styling ==="
rg -n "variant.*contained\|variant.*text" src/domain --type-list-all | head -30

Length of output: 1383


Destructive confirmations need reduced prominence styling.

Verification found that destructive actions do use ConfirmationDialog: delete comment (CalendarEventDetailView.tsx:165), delete event (CalendarDialog.tsx:143), and clear chat (ChatWidgetInner.tsx). The styling change makes these dangerous actions more prominent via the contained variant, which violates UX best practice—destructive actions should be less, not more, prominent to avoid accidental activation.

The confirm button should use a warning/destructive styling (e.g., color="error" or a dedicated destructive variant) rather than the default contained style, particularly for delete and clear confirmations. Consider:

  • Apply color="error" to confirm buttons when confirmButtonTextId contains 'delete', 'remove', or 'clear'
  • Or create a destructive-specific dialog variant that uses warning styling
  • Ensure dialogs with destructive actions (CalendarEventDetailView.tsx, CalendarDialog.tsx, ChatWidgetInner.tsx) are updated accordingly

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.

2 participants