Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion frontend/packages/react-form-wizard/src/review/ReviewStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,10 @@ function renderCollapsedBadgesFromNodes(
const collapsedInputContent = child.error ? (
child.label ?? child.path
) : child.value === true ? (
<CheckIcon aria-hidden />
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 4 }}>
<CheckIcon aria-hidden />
{reviewBooleanCheckCompanionText(child)}
</span>
) : (
renderReviewInputDescriptionContent(child)
)
Expand Down Expand Up @@ -712,6 +715,39 @@ function isReviewValueUnset(value: unknown): boolean {
return false
}

/** Collapsed review badge only: text beside the checkmark for boolean or unset inputs (short label, else path-derived). */
function reviewBooleanCheckCompanionText(node: WizardInputDomNode): string {
const { path, label, value } = node
if (!(typeof value === 'boolean' || isReviewValueUnset(value))) {
return label ?? path
}
if (label && label.length < 32) {
return label
}
if (!path) {
return label ?? ''
}
const hashKeyMatch = path.match(/#\[([^=]+)=([^\]]+)\]\s*$/)
if (hashKeyMatch) {
return hashKeyMatch[1]!
}
const semicolonIdMatch = path.match(/;([^;=]+)=([^;]+)$/)
if (semicolonIdMatch) {
return semicolonIdMatch[2]!
}
const segments = path.split('.')
const lastSeg = segments[segments.length - 1] ?? path
if (lastSeg === 'enabled' || lastSeg === 'disabled') {
const parent = segments.length >= 2 ? segments[segments.length - 2]! : ''
const valuePart = typeof value === 'boolean' ? String(value) : ''
if (parent) {
return valuePart ? `${parent}.${lastSeg} = ${valuePart}` : `${parent}.${lastSeg}`
}
return valuePart ? `${lastSeg} = ${valuePart}` : lastSeg
}
return lastSeg
}

/** True when the review row should be omitted: no user-visible value (still show rows with errors). */
function isReviewInputRowValueHidden(value: unknown): boolean {
if (value === false) return true
Expand Down
Loading