Repository navigation
ui: host-controlled decision toggle and status tag on question cards - #1744
Merged
Merged
Conversation
QuestionBlock gains decisionRecording / onToggleDecisionRecording (the
"Records a decision" tag becomes an aria-pressed toggle; off dims it with
a dotted outline and hides the decision row) and statusTag ('none' hides
the card's own status tag). Threaded through BlockRenderer and Viewer as
questionDecisionRecording(question), onToggleQuestionDecisionRecording and
questionStatusTag. Plannotator passes none; markup unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
60% opacity on primary text put the off "Records a decision" tag at 2.92:1 in the default light theme and under 3:1 in most bundled themes. The theme's muted-foreground is the token every palette tunes for secondary text (8.9:1 / 7.4:1 in the default light / dark theme), so the dimmed tag stays legible while still reading as off.
1 task
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.
Why
Workspaces (and the upcoming Plannotator Inbox) need two things on question cards that
@plannotator/uicould not do yet:Decision: when answeredquestion's decision recording off and on from the card itself.Both are optional props, cut for ui 0.52.0. Plannotator's own app passes none of them and renders exactly as before.
Props
QuestionBlock(packages/ui/components/blocks/QuestionBlock.tsx):decisionRecording?: boolean(defaulttrue)onToggleDecisionRecording?: (key: string, next: boolean) => voidstatusTag?: 'card' | 'none'(default'card')Viewer(forwarded throughBlockRendererthe same wayrenderQuestionFooteris):questionDecisionRecording?: (question: IndexedQuestion) => boolean | undefinedonToggleQuestionDecisionRecording?: (key: string, next: boolean) => voidquestionStatusTag?: 'card' | 'none'BlockRenderertakesquestionDecisionRecording?: boolean,onToggleQuestionDecisionRecordingandquestionStatusTag.Behavior
These props affect only a
Decision: when answeredquestion (decisionOnAnswer) whose decision is not recorded yet:<button type="button" aria-pressed>withdata-question-decision-toggle. It works from the keyboard and shows a focus ring. A ring is used, not an outline, because the dotted outline is what draws the off state. A click callsonToggleDecisionRecording(question.key, !on). The card keeps no state of its own: the host stores the value and passes it back.data-question-decision-row) is removed, not dimmed.decisionRecording: falsewithout a handler is honored. The card shows a static dimmed tag and hides the row, for a state the reviewer may not change.Viewerdrops the handler underreadOnly, and a card with no answer handler shows a static tag in its current state.Decision: [statement](url)) and a question with no decision line are never affected.data-question-decisionkeeps its current values (on-answer/recorded). A separatedata-question-decision-recording="on" | "off"is added only when the host passesdecisionRecordingor the handler.statusTag: 'none'hides Open / Answered / Settled / Skipped. The decision tags stay, anddata-question-statusstill holds the status.No stylesheet change: the toggle uses utility classes the package already ships. The guides.show viewer manifest stays in sync (
check:manifestpasses), so no guides.show deploy is needed.Plannotator unchanged
With none of the props, the rendered markup (interactive and read-only) is byte-identical to main. I checked this with
renderToStaticMarkupover decision-on-answer, recorded-decision and plain questions, rendered with the main and branch components.Tests
packages/ui/components/blocks/QuestionBlock.decisionToggle.test.tsxis DOM-gated and has been added to theDOM_TESTS=1step intest.yml. It covers:aria-pressedbutton that calls the handler with the key and the next statedecisionRecording: falsewithout a handlerstatusTag: 'none'hides the status tag and keeps the decision tagViewerthreading, includingreadOnlyWith the component change reverted, 5 of the 8 tests fail.
Verified:
bun test packages/ui: 0 fail--isolate: 139 passbun run typecheck: passesbuild:viewer+check:manifest: in syncapps/review build && build:hook: both buildsmoke:packagefails on main for an unrelated reason: the UI imports@plannotator/core/server-session, which is not in the published core 0.25.11. The core 0.25.12 bump in #1743 fixes it. This PR does not touch core or imports.No version bumps.