feat(studio): approval payload — explain absence, cap height, accurate label
Some checks failed
Security / Security check (push) Failing after 1s

The approval card only rendered the payload section when a preview
existed, so a step with no 'show:' showed nothing and the reviewer
could not tell why. Now always show the section: a present payload
scrolls inside a height-capped, copyable box; an absent one shows an
explanatory hint (the flow's approval step chooses what to surface via
its 'show:' field). Relabel 'data to be released' -> 'data to review'
(the payload is review context, accurate to its source).

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-06-19 02:29:20 +02:00
parent 8a40e8e315
commit 97f3cb8560
6 changed files with 75 additions and 23 deletions

View file

@ -585,19 +585,44 @@ class _ApprovalCard extends StatelessWidget {
),
],
),
if (approval.payloadPreview != null) ...[
const SizedBox(height: ChainSpace.md),
Padding(
padding: const EdgeInsets.only(bottom: 4),
child: Text(
l.approvalsPayloadPreview,
style: theme.textTheme.labelSmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
letterSpacing: 0.6,
fontSize: 10,
),
const SizedBox(height: ChainSpace.md),
Padding(
padding: const EdgeInsets.only(bottom: 4),
child: Text(
l.approvalsPayloadPreview,
style: theme.textTheme.labelSmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
letterSpacing: 0.6,
fontSize: 10,
),
),
),
if (approval.payloadPreview != null)
Container(
width: double.infinity,
// Cap the height so a large payload scrolls inside the
// card instead of stretching it off-screen; still fully
// readable + copyable (SelectableText).
constraints: const BoxConstraints(maxHeight: 280),
padding: const EdgeInsets.all(ChainSpace.md),
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(ChainRadius.sm),
border: Border.all(color: theme.colorScheme.outlineVariant),
),
child: SingleChildScrollView(
child: SelectableText(
_prettyPreview(approval.payloadPreview!),
style: ChainTheme.mono(
size: 11,
color: theme.colorScheme.onSurface,
),
),
),
)
else
// No `show:` on the approval step explain where the data
// would come from instead of rendering nothing.
Container(
width: double.infinity,
padding: const EdgeInsets.all(ChainSpace.md),
@ -606,15 +631,26 @@ class _ApprovalCard extends StatelessWidget {
borderRadius: BorderRadius.circular(ChainRadius.sm),
border: Border.all(color: theme.colorScheme.outlineVariant),
),
child: SelectableText(
_prettyPreview(approval.payloadPreview!),
style: ChainTheme.mono(
size: 11,
color: theme.colorScheme.onSurface,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
Icons.info_outline,
size: 14,
color: theme.colorScheme.onSurfaceVariant,
),
const SizedBox(width: ChainSpace.sm),
Expanded(
child: Text(
l.approvalsNoPayload,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
),
),
],
),
),
],
const SizedBox(height: ChainSpace.lg),
Row(
children: [