[US-2.3 / OBT-202] Confirm with usage stats before deactivating a language - #27
Conversation
Add a role-gated deactivate affordance to language cards and a confirmation dialog that lists the projects using the language and blocks deactivation while any project still uses it (matching the backend 409). The trash is shown to platform admins on every language and to managers only on languages they created. - languagesAPI.stats / languagesAPI.delete - LanguageResponse.created_by; LanguageProjectRef / LanguageStatsResponse - confirm dialog lists affected projects and disables Deactivate when in use
levigtri
force-pushed
the
levigft/obt-202-us-23-see-a-confirmation-dialog-with-usage-statistics-before
branch
from
July 9, 2026 18:05
fcc9109 to
7a85ad6
Compare
levigtri
force-pushed
the
levigft/obt-199-us-12-click-on-a-language-card-and-edit-its-name-or-code-in
branch
from
July 9, 2026 18:24
b6cff54 to
6e69ffc
Compare
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: QUIET Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a deactivate affordance to language cards with a confirmation dialog that lists the projects using the language (name + count) and blocks deactivation while any project still uses it — for everyone, matching the backend rule (US-2.1 returns
409). The trash affordance follows the role hierarchy: a platform admin sees it on every language, a manager only on languages they created.Changes
src/components/pages/LanguagesPage.tsx: hover trash shown whenisPlatformAdmin || (isManager && lang.created_by === user.id).languagesAPI.stats; whenproject_count > 0it lists the project names and disables the Deactivate button (blocked); when0it confirms a normal soft-delete vialanguagesAPI.delete. Surfaces backend409/403as toasts.src/services/api.ts(languagesAPI.stats,languagesAPI.delete),src/types/language.ts(created_byonLanguageResponse; newLanguageProjectRef,LanguageStatsResponse), reexported insrc/types/index.ts.Type of Change
Testing
npm run typecheck/npm run lint(0 errors, only the pre-existingProjectsPage.tsxwarning) /npm run build— all pass.