feat(logic): click-to-edit logic cards (2/2)#9786
Open
bookwormsuf wants to merge 7 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A new block has nothing persisted, so the untouched short-circuit must not apply to it. Route creates through handleSubmit so an incomplete new block blocks the switch with validation errors, matching the Add logic button. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The icon opens the edit view but was labelled Delete logic. Making the whole card clickable promotes the pencil to the primary edit affordance, so the mislabel now matters for screen-reader users. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Tick the box to add this pull request to the merge queue (same as
|
…ic' into feat/clickable-cards-logic # Conflicts: # apps/frontend/src/features/admin-form/create/logic/components/LogicContent/InactiveLogicBlock/InactiveLogicBlock.tsx
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.
Problem
Logic cards lock every other card while one is open — you have to Save or Cancel before you can touch another card. Part 1 (#9781) fixed this for workflow step cards; this PR mirrors the same behaviour onto logic cards.
Stacked on #9781 — please review/merge that first. Base retargets to
developonce Part 1 lands.Closes FRM-2491.
Solution
Behind the existing
editable-cards-mrf-logicflag (default off), the whole logic card becomes clickable with a hover affordance, and clicking another card auto-saves the open one and switches to it. The auto-save runs through the same validated submit path as the Save button, so incomplete data blocks the switch and surfaces validation errors instead of silently losing work.Implementation mirrors Part 1's workflow store and components: a
pendingSwitchTofield plusrequestSwitchTo/cancelPendingSwitch/completeSaveon the logic store, an auto-saveuseEffectthat fires when another card is clicked, andonSuccess: completeSave/onError: cancelPendingSwitchon the save mutations. Flag off = previous behaviour (cards locked while one is open, pencil-only edit).One logic-specific difference from Part 1: logic's
EditLogicBlockis shared by both the create (NewLogicBlock) and edit (ActiveLogicBlock) paths, so the auto-save effect covers both. A new block therefore auto-saves-and-switches through the same validatedAdd logicpath — an incomplete new block blocks the switch with validation errors, exactly like pressingAdd logic.Alternatives considered
Boxwith anonClick, and left the pencil icon button as the keyboard/screen-reader trigger, rather than turning the whole body into a focusable<button>. Making the entire card a button is more keyboard-complete, but the pencil already covers keyboard access and theBoxkeeps the markup simpler; we can revisit if we want full card-body keyboard focus later.Screenshots
Breaking Changes
No - backwards compatible. Feature is gated behind
editable-cards-mrf-logic(default off); flag-off behaviour is unchanged.Tests
TC1: Flag off — no regression
TC2: Flag on — whole card clickable + hover
TC3: Flag on — auto-save-and-switch between existing cards
TC4: Flag on — untouched card switches without a redundant save
TC5: Flag on — new block blocks the switch when incomplete
Add logic, leave it incomplete, click an existing card → switch is blocked and validation errors show on the new block (same as pressingAdd logic).TC6: Flag on — valid new block creates then switches
Add logic, fill it in validly, click an existing card → the new block is created and the clicked card opens.