Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Desktop: the Humans leaderboard follows the design system's Numbers and rankings (#1929)

0xken15212e0f4d5532
diff --git a/desktop/lib/shared/theme/app_icons.dart b/desktop/lib/shared/theme/app_icons.dart
index d737b4517..c8e2f54a1 100644
--- a/desktop/lib/shared/theme/app_icons.dart
+++ b/desktop/lib/shared/theme/app_icons.dart
@@ -11,6 +11,10 @@ abstract final class AppIcons {
static const double controlSize = 20;
static const double featureSize = 24;
+ /// Dense pane actions and metadata beside 12pt text, as the icon design
+ /// system's 14pt role.
+ static const double metadataSize = 14;
+
/// The close mark in tabs and pane headers, inside the full click target.
/// 14: its stroke matches the 13pt regular text beside it (1.1pt, measured),
/// as the native tab's × takes the title's size and weight.
diff --git a/desktop/lib/super_tabs/leaderboard/goal_line.dart b/desktop/lib/super_tabs/leaderboard/goal_line.dart
index 20cbe4177..11d624973 100644
--- a/desktop/lib/super_tabs/leaderboard/goal_line.dart
+++ b/desktop/lib/super_tabs/leaderboard/goal_line.dart
@@ -1,13 +1,12 @@
import 'package:flutter/material.dart';
-import '../../shared/theme/app_theme.dart' as grid;
import '../../widgets/desktop_chrome.dart';
import 'format.dart';
import 'model.dart';
-/// The shared reward at the top of Humans: a small "🚀 N shipped" chip for
-/// the week shown (Dee, 2026-10-28: no open count). The week before and the
-/// median time to ship are on hover.
+/// The team's total at the top of Humans, as quiet text: "N shipped this
+/// week" for the week shown (Dee, 2026-10-28: no open count). The week before
+/// and the median time to ship are on hover.
class LeaderboardGoalLine extends StatelessWidget {
const LeaderboardGoalLine({
super.key,
@@ -25,24 +24,22 @@ class LeaderboardGoalLine extends StatelessWidget {
final earlier = weekName == 'this week' ? 'last week' : 'the week before';
final median = _median(now.medianAskToShipMs, before.medianAskToShipMs);
return Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 4),
+ key: const ValueKey('leaderboard-goal'),
+ padding: const EdgeInsets.fromLTRB(
+ DesktopChrome.groupGap,
+ 0,
+ DesktopChrome.groupGap,
+ DesktopChrome.controlGap / 2,
+ ),
child: Align(
alignment: Alignment.centerLeft,
child: Tooltip(
message: ['${before.shipped} shipped $earlier', ?median].join('\n'),
- child: Container(
- key: const ValueKey('leaderboard-goal'),
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
- decoration: BoxDecoration(
- color: grid.AppSurface.hoverFill,
- borderRadius: BorderRadius.circular(10),
- ),
- child: Text(
- '🚀 ${now.shipped} shipped $weekName',
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(color: DesktopChrome.foreground),
- ),
+ child: Text(
+ '${now.shipped} shipped $weekName',
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(),
),
),
),
diff --git a/desktop/lib/super_tabs/leaderboard/person_row.dart b/desktop/lib/super_tabs/leaderboard/person_row.dart
index 812bdd4e6..b8a7454e1 100644
--- a/desktop/lib/super_tabs/leaderboard/person_row.dart
+++ b/desktop/lib/super_tabs/leaderboard/person_row.dart
@@ -12,12 +12,32 @@ import '../until.dart';
import 'format.dart';
import 'model.dart';
-/// Where the name and the quiet line start: after the avatar (24) and its gap (8).
-const _nameInset = 32.0;
+/// The gap between a row's columns, and half of it: the spacing scale's 8
+/// and 4.
+const _gap = grid.AppDesktop.controlGap;
+const _halfGap = _gap / 2;
-/// Figures of one width, so the numbers of one column line up row under row.
-TextStyle _figures(TextStyle style) =>
- style.copyWith(fontFeatures: const [FontFeature.tabularFigures()]);
+/// The avatar the Agents rows below draw, so without a rank column a person's
+/// name starts where an agent's does.
+const _avatarSize = 24.0;
+
+/// Numbers and rankings (desktop design system): the rank a bold numeral in
+/// secondary ink, the points the one emphasized number, every figure in a
+/// column of one width so the column holds row under row.
+TextStyle _rankStyle() => grid.AppType.label(
+ fontWeight: FontWeight.w700,
+ color: grid.AppPalette.textSecondary,
+ fontFeatures: grid.AppFont.tabularFigures,
+);
+TextStyle _pointsStyle() => grid.AppType.label(
+ fontWeight: grid.AppFont.semibold,
+ color: grid.AppPalette.textPrimary,
+ fontFeatures: grid.AppFont.tabularFigures,
+);
+
+TextStyle _trendStyle(Color color) =>
+ DesktopChrome.metadata(color: color)
+ .copyWith(fontFeatures: grid.AppFont.tabularFigures);
/// A person as the leaderboard names them: the board's display name, else the
/// email's first part, as before the board had names.
@@ -33,232 +53,281 @@ String? leaderboardTrend(SuperTabPersonScore score) {
return '${change > 0 ? 'up' : 'down'} ${change.abs()} from last week';
}
-/// The cup's colour and name, by place.
-(Color, String) _cup(SuperTabMedal medal) => switch (medal) {
- SuperTabMedal.gold => (grid.AppPalette.brandBolt, 'Gold cup: 1st'),
- SuperTabMedal.silver => (
- grid.AppTheme.pick(const Color(0xFF6E7681), const Color(0xFFC0C6CF)),
- 'Silver cup: 2nd',
- ),
- SuperTabMedal.bronze => (
- grid.AppTheme.pick(const Color(0xFF8C5A2B), const Color(0xFFD08A4E)),
- 'Bronze cup: 3rd',
- ),
-};
+/// "16 shipped", "1 unblocked", "43 hours lent": each number that would not
+/// read zero, in words; empty when all would.
+List<String> leaderboardNumbers(SuperTabPersonScore score) {
+ final hours = leaderboardHours(score.lentMs);
+ return [
+ if (score.shipped > 0) '${score.shipped} shipped',
+ if (score.unblocked > 0) '${score.unblocked} unblocked',
+ if (hours != '0') '${plural(int.parse(hours), 'hour')} lent',
+ ];
+}
+
+/// The board's fixed numeric columns, each as wide as its widest value at
+/// the current text size, so rank, trend and points line up on every row.
+class LeaderboardColumns {
+ const LeaderboardColumns({
+ required this.rank,
+ required this.points,
+ this.trend,
+ });
+
+ factory LeaderboardColumns.of(
+ BuildContext context,
+ List<SuperTabPersonScore> scores,
+ ) {
+ final scaler = MediaQuery.textScalerOf(context);
+ double width(String text, TextStyle style) {
+ final painter = TextPainter(
+ text: TextSpan(text: text, style: style),
+ textDirection: TextDirection.ltr,
+ textScaler: scaler,
+ )..layout();
+ final width = painter.width;
+ painter.dispose();
+ return width;
+ }
+
+ // Digits are of one width, so the longest number is the widest.
+ String widest(Iterable<int> values) => values
+ .map((value) => '$value')
+ .fold('0', (a, b) => b.length > a.length ? b : a);
+ final changes = [
+ for (final score in scores)
+ if (score.prevWeekPoints case final before? when before != score.points)
+ (score.points - before).abs(),
+ ];
+ return LeaderboardColumns(
+ rank: width(widest(scores.map((score) => score.rank)), _rankStyle()),
+ points: width(
+ widest(scores.map((score) => score.points)),
+ _pointsStyle(),
+ ),
+ trend: changes.isEmpty
+ ? null
+ : AppIcons.metadataSize +
+ width(widest(changes), _trendStyle(DesktopChrome.muted)),
+ );
+ }
-/// One person in the Humans section: avatar, name, status, their cup and
-/// their change against last week, and this week's points in fixed columns,
-/// with Shipped, Unblocked and Lent as icons on a quiet line beneath. Without
-/// a [score] (no board yet, or a server without one) only the name and status.
+ final double rank, points;
+
+ /// Null when no one on the board moved against last week.
+ final double? trend;
+}
+
+/// One person in the Humans section: their rank as a bold numeral in its own
+/// column, avatar, name and status, and a quiet line of their non-zero
+/// numbers beneath; at the right the change against last week, then their
+/// points, the one emphasized number. The viewer's own row carries
+/// the selected fill. Without a [score] (no board yet, or a server without
+/// one) only the name and status.
class LeaderboardPersonRow extends StatelessWidget {
const LeaderboardPersonRow({
super.key,
required this.person,
required this.score,
required this.onTap,
+ this.columns,
+ this.own = false,
});
final SuperTabPerson person;
final SuperTabPersonScore? score;
final VoidCallback onTap;
+ /// The numeric columns, the same on every row; null without a board.
+ final LeaderboardColumns? columns;
+
+ /// Whether this is the viewer's own row.
+ final bool own;
+
@override
Widget build(BuildContext context) {
- final scale = MediaQuery.textScalerOf(context);
final score = this.score;
- final quiet = _figures(DesktopChrome.metadata());
- Widget cell(double width, String text, String label) => SizedBox(
- width: scale.scale(width),
- child: Align(
- alignment: Alignment.centerLeft,
- child: Tooltip(
- message: label,
- child: Text(
- text,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: quiet,
- ),
- ),
+ final columns = this.columns;
+ final numbers = score == null
+ ? const <String>[]
+ : leaderboardNumbers(score);
+ final trend = score == null ? null : leaderboardTrend(score);
+ final radius = BorderRadius.circular(DesktopChrome.rowRadius);
+ Widget column(String kind, double width, Widget? child) => Padding(
+ padding: const EdgeInsets.only(left: _gap),
+ child: SizedBox(
+ key: ValueKey('leaderboard-$kind-${person.id}'),
+ width: width,
+ child: Align(alignment: Alignment.centerRight, child: child),
),
);
- final medal = score?.medal;
- final trend = score == null ? null : leaderboardTrend(score);
- return InkWell(
- key: ValueKey('super-person-${person.id}'),
- onTap: onTap,
- child: ConstrainedBox(
- // A phone's row is a finger's height; a mouse keeps 36.
- constraints: BoxConstraints(
- minHeight: fingerHeight(36, enabled: workspaceIsCompact(context)),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: _gap),
+ child: Material(
+ color: own ? grid.AppSurface.selectedFill : Colors.transparent,
+ borderRadius: radius,
+ clipBehavior: Clip.antiAlias,
+ child: InkWell(
+ key: ValueKey('super-person-${person.id}'),
+ onTap: onTap,
+ // Hover and focus keep their treatment over the viewer's own fill.
+ hoverColor: grid.AppSurface.hoverFill,
+ focusColor: grid.AppSurface.hoverFill,
+ borderRadius: radius,
+ child: ConstrainedBox(
+ // A phone's row is a finger's height; a mouse keeps a field's.
+ constraints: BoxConstraints(
+ minHeight: fingerHeight(
+ grid.AppControl.heightField,
+ enabled: workspaceIsCompact(context),
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: _gap,
+ vertical: _halfGap,
+ ),
+ child: Row(
children: [
- SuperTabAvatar.person(person, size: 24),
- const SizedBox(width: _nameInset - 24),
+ if (columns != null) ...[
+ SizedBox(
+ key: ValueKey('leaderboard-rank-${person.id}'),
+ width: columns.rank,
+ child: score == null
+ ? null
+ : Text(
+ '${score.rank}',
+ maxLines: 1,
+ textAlign: TextAlign.right,
+ style: _rankStyle(),
+ ),
+ ),
+ const SizedBox(width: _gap),
+ ],
+ SuperTabAvatar.person(person, size: _avatarSize),
+ const SizedBox(width: _gap),
Expanded(
- child: Tooltip(
- message: person.email,
- child: SuperTabUntil(
- until: person.status?.until,
- builder: (context) => Text.rich(
- TextSpan(
- text: leaderboardName(person, score),
- children: [
- if (person.statusAt(clock.now())
- case final status?)
- TextSpan(
- text: ' ${status.text}',
- style: DesktopChrome.metadata(),
- ),
- ],
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ _name(),
+ if (numbers.isNotEmpty)
+ _Numbers(
+ key: ValueKey('leaderboard-meta-${person.id}'),
+ parts: numbers,
),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.control(),
- ),
- ),
+ ],
),
),
- if (medal != null) ...[
- const SizedBox(width: 6),
- _Cup(personId: person.id, medal: medal),
- ],
- if (trend != null && score != null) ...[
- const SizedBox(width: 6),
- _Trend(personId: person.id, score: score, trend: trend),
- ],
- if (score != null)
- SizedBox(
- width: scale.scale(64),
- child: Text(
- '${score.points} pts',
- maxLines: 1,
- textAlign: TextAlign.right,
- style: _figures(DesktopChrome.control(medium: true)),
+ if (columns?.trend case final width?)
+ column(
+ 'trend-column',
+ width,
+ trend == null || score == null
+ ? null
+ : _Trend(
+ personId: person.id,
+ score: score,
+ trend: trend,
+ ),
+ ),
+ if (columns != null && score != null)
+ column(
+ 'points',
+ columns.points,
+ Semantics(
+ label: '${score.points} points',
+ excludeSemantics: true,
+ child: Text(
+ '${score.points}',
+ maxLines: 1,
+ style: _pointsStyle(),
+ ),
),
),
],
),
- if (score != null)
- Padding(
- padding: const EdgeInsets.only(left: _nameInset, top: 2),
- child: Row(
- children: [
- cell(
- 56,
- '🚀 ${score.shipped}',
- '${score.shipped} shipped',
- ),
- cell(
- 56,
- '🔓 ${score.unblocked}',
- '${score.unblocked} unblocked',
- ),
- cell(
- 72,
- '💻 ${leaderboardHours(score.lentMs)} h',
- '${leaderboardHours(score.lentMs)} agent-hours lent',
- ),
- ],
- ),
- ),
- ],
+ ),
),
),
),
);
}
+
+ /// The name, then the status quietly; the email on hover.
+ Widget _name() => Tooltip(
+ message: person.email,
+ child: SuperTabUntil(
+ until: person.status?.until,
+ builder: (context) => Text.rich(
+ TextSpan(
+ text: leaderboardName(person, score),
+ children: [
+ if (person.statusAt(clock.now()) case final status?)
+ TextSpan(
+ text: ' ${status.text}',
+ style: DesktopChrome.metadata(),
+ ),
+ ],
+ ),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.control(),
+ ),
+ ),
+ );
}
-/// A top-three cup in its place's colour; #1's sparkles once as the board
-/// opens, never with Reduce Motion.
-class _Cup extends StatelessWidget {
- const _Cup({required this.personId, required this.medal});
- final String personId;
- final SuperTabMedal medal;
+/// A person's numbers joined by a spaced middle dot. Where the line does not
+/// fit, whole items fall off its end, never part of a word; the whole line,
+/// lent in agent-hours, is on hover.
+class _Numbers extends StatelessWidget {
+ const _Numbers({super.key, required this.parts});
+ final List<String> parts;
@override
Widget build(BuildContext context) {
- final (color, name) = _cup(medal);
- final cup = Icon(AppIcons.trophy, size: 14, color: color);
+ final style = DesktopChrome.metadata();
+ final scaler = MediaQuery.textScalerOf(context);
return Tooltip(
- key: ValueKey('leaderboard-cup-$personId'),
- message: '$name this week',
- excludeFromSemantics: true,
- child: Semantics(
- label: '$name this week',
- child:
- medal == SuperTabMedal.gold &&
- !MediaQuery.disableAnimationsOf(context)
- ? _Sparkle(color: color, child: cup)
- : cup,
+ message: parts
+ .map((part) => part.replaceFirst(' hour', ' agent-hour'))
+ .join(' · '),
+ child: LayoutBuilder(
+ builder: (context, constraints) {
+ bool fits(String text) {
+ final painter = TextPainter(
+ text: TextSpan(text: text, style: style),
+ textDirection: TextDirection.ltr,
+ textScaler: scaler,
+ maxLines: 1,
+ )..layout(maxWidth: constraints.maxWidth);
+ final fits = !painter.didExceedMaxLines;
+ painter.dispose();
+ return fits;
+ }
+
+ var shown = parts.length;
+ while (shown > 1 && !fits(parts.take(shown).join(' · '))) {
+ shown--;
+ }
+ final text = parts.take(shown).join(' · ');
+ // A first item too wide even alone (enlarged text in a narrow
+ // pane) wraps between its words rather than losing one.
+ final wraps = !fits(text);
+ return Text(
+ text,
+ maxLines: wraps ? 2 : 1,
+ overflow: TextOverflow.ellipsis,
+ style: style,
+ );
+ },
),
);
}
}
-/// A light sparkle over [child] that plays once and then is gone.
-class _Sparkle extends StatefulWidget {
- const _Sparkle({required this.color, required this.child});
- final Color color;
- final Widget child;
-
- @override
- State<_Sparkle> createState() => _SparkleState();
-}
-
-class _SparkleState extends State<_Sparkle>
- with SingleTickerProviderStateMixin {
- late final _controller = AnimationController(
- vsync: this,
- duration: const Duration(milliseconds: 1400),
- )..forward();
-
- @override
- void dispose() {
- _controller.dispose();
- super.dispose();
- }
-
- @override
- Widget build(BuildContext context) => AnimatedBuilder(
- animation: _controller,
- child: widget.child,
- builder: (context, child) {
- if (_controller.isCompleted) return child!;
- // Up and back down: a glint, not a blink.
- final t = Curves.easeInOut.transform(_controller.value);
- final glint = 1 - (2 * t - 1).abs();
- return Stack(
- clipBehavior: Clip.none,
- children: [
- child!,
- Positioned(
- right: -7,
- top: -7,
- child: Opacity(
- key: const ValueKey('leaderboard-sparkle'),
- opacity: glint,
- child: Transform.scale(
- scale: .6 + .4 * glint,
- child: Icon(AppIcons.sparkles, size: 11, color: widget.color),
- ),
- ),
- ),
- ],
- );
- },
- );
-}
-
-/// An arrow and the change against last week: up in green, down quietly.
+/// An arrow and the change against last week, by shape and colour both: up in
+/// the online green, down in the theme's error ink.
class _Trend extends StatelessWidget {
const _Trend({
required this.personId,
@@ -272,7 +341,9 @@ class _Trend extends StatelessWidget {
@override
Widget build(BuildContext context) {
final up = score.points > score.prevWeekPoints!;
- final color = up ? grid.AppPalette.online : DesktopChrome.muted;
+ final color = up
+ ? grid.AppPalette.online
+ : Theme.of(context).colorScheme.error;
return Tooltip(
key: ValueKey('leaderboard-trend-$personId'),
message: capitalized(trend),
@@ -285,12 +356,13 @@ class _Trend extends StatelessWidget {
children: [
Icon(
up ? AppIcons.arrowUp : AppIcons.arrowDown,
- size: 12,
+ size: AppIcons.metadataSize,
color: color,
),
Text(
'${(score.points - score.prevWeekPoints!).abs()}',
- style: _figures(DesktopChrome.metadata(color: color)),
+ style: DesktopChrome.metadata(color: color)
+ .copyWith(fontFeatures: grid.AppFont.tabularFigures),
),
],
),
@@ -345,28 +417,30 @@ class LeaderboardPersonWeek extends StatelessWidget {
: '${plural(score.streakDays, 'day')} shipping',
),
];
- return Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
+ // Labels take their natural width, so a longer word never clips.
+ return Table(
+ columnWidths: const {0: IntrinsicColumnWidth(), 1: FlexColumnWidth()},
children: [
for (final (label, value) in rows)
- Padding(
- padding: const EdgeInsets.symmetric(vertical: 2),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox(
- width: 88,
- child: Text(
- label,
- style: DesktopChrome.metadata(
- color: DesktopChrome.foreground,
- ),
+ TableRow(
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(
+ right: _gap * 2,
+ bottom: _halfGap,
+ ),
+ child: Text(
+ label,
+ style: DesktopChrome.metadata(
+ color: DesktopChrome.foreground,
),
),
- Expanded(child: Text(value, style: DesktopChrome.metadata())),
- ],
- ),
+ ),
+ Padding(
+ padding: const EdgeInsets.only(bottom: _halfGap),
+ child: Text(value, style: DesktopChrome.metadata()),
+ ),
+ ],
),
],
);
@@ -385,7 +459,7 @@ class _LeaderboardPersonDetails extends StatelessWidget {
final trend = leaderboardTrend(score);
final quiet = DesktopChrome.metadata();
Widget section(String title, String empty, List<Widget> items) => Padding(
- padding: const EdgeInsets.only(top: 12),
+ padding: const EdgeInsets.only(top: _gap + _halfGap),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -396,20 +470,24 @@ class _LeaderboardPersonDetails extends StatelessWidget {
medium: true,
),
),
- const SizedBox(height: 4),
+ const SizedBox(height: _halfGap),
if (items.isEmpty) Text(empty, style: quiet) else ...items,
],
),
);
+ // Items stand the spacing scale's smallest step apart.
Widget item(Widget title, String trailing) => Padding(
- padding: const EdgeInsets.symmetric(vertical: 3),
+ padding: const EdgeInsets.symmetric(vertical: _halfGap / 2),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: title),
if (trailing.isNotEmpty) ...[
- const SizedBox(width: 12),
- Text(trailing, style: _figures(quiet)),
+ const SizedBox(width: _gap + _halfGap),
+ Text(
+ trailing,
+ style: quiet.copyWith(fontFeatures: grid.AppFont.tabularFigures),
+ ),
],
],
),
@@ -419,8 +497,9 @@ class _LeaderboardPersonDetails extends StatelessWidget {
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * .5,
),
+ // The small form's width, less the dialog's own content inset.
child: SizedBox(
- width: 380,
+ width: grid.AppDesktop.formWidth - 2 * grid.AppDesktop.panelPadding,
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
@@ -432,7 +511,7 @@ class _LeaderboardPersonDetails extends StatelessWidget {
: '${score.points} pts · $trend',
style: quiet,
),
- section('🚀 Shipped', 'No pull requests merged yet', [
+ section('Shipped', 'No pull requests merged yet', [
for (final shipped in details.shipped)
item(switch (Uri.tryParse(shipped.prUrl ?? '')) {
// Only a web page opens: a link from the server is data,
@@ -455,14 +534,14 @@ class _LeaderboardPersonDetails extends StatelessWidget {
_ => Text(shipped.title, style: text),
}, ''),
]),
- section('🔓 Unblocked', 'No questions answered yet', [
+ section('Unblocked', 'No questions answered yet', [
for (final unblocked in details.unblocked)
item(
Text(unblocked.title, style: text),
'waited ${leaderboardDuration(unblocked.waitedMinutes * 60000)}',
),
]),
- section('💻 Lent', 'No machines lent yet', [
+ section('Lent', 'No machines lent yet', [
for (final lent in details.lent)
item(
Text(superTabMachineName(lent.machineName), style: text),
diff --git a/desktop/lib/super_tabs/leaderboard/waiting_line.dart b/desktop/lib/super_tabs/leaderboard/waiting_line.dart
index 0f51235d2..c3aa996a4 100644
--- a/desktop/lib/super_tabs/leaderboard/waiting_line.dart
+++ b/desktop/lib/super_tabs/leaderboard/waiting_line.dart
@@ -1,11 +1,13 @@
import 'package:flutter/material.dart';
import '../../widgets/desktop_chrome.dart';
+import 'format.dart';
import 'model.dart';
-/// "Agents waiting on a person now": who and how many, in name order, never a
-/// ranking or blame. Answer goes straight to the viewer's own waiting item, or
-/// to the first one when none waits on them.
+/// Who agents wait on now, in words: "3 agents are waiting on Ken", "1 agent
+/// is waiting on you", in name order, never a ranking or blame. Answer goes
+/// straight to the viewer's own waiting item, or to the first one when none
+/// waits on them.
class LeaderboardWaitingLine extends StatelessWidget {
const LeaderboardWaitingLine({
super.key,
@@ -27,42 +29,41 @@ class LeaderboardWaitingLine extends StatelessWidget {
@override
Widget build(BuildContext context) {
final target = _target;
- return Container(
+ // The team total's quiet hierarchy and inset.
+ return Padding(
key: const ValueKey('leaderboard-waiting'),
- padding: const EdgeInsets.fromLTRB(16, 10, 12, 12),
- decoration: BoxDecoration(
- border: Border(top: BorderSide(color: DesktopChrome.rim)),
+ padding: const EdgeInsets.fromLTRB(
+ DesktopChrome.groupGap,
+ DesktopChrome.controlGap,
+ DesktopChrome.controlGap,
+ DesktopChrome.controlGap,
),
child: waiting.total == 0
? Text(
'No agent is waiting on a person.',
style: DesktopChrome.metadata(),
)
- : Column(
- crossAxisAlignment: CrossAxisAlignment.start,
+ : Row(
children: [
- // The whole width, so the count never wraps beside Answer.
- Text(
- '⏳ Agents waiting on a person now: ${waiting.total}',
- style: DesktopChrome.control(),
- ),
- Row(
- children: [
- Expanded(
- child: Text(
- waiting.people
- .map((p) => '${nameOf(p.personId)} ${p.count}')
- .join(' · '),
- style: DesktopChrome.metadata(),
- ),
- ),
- if (target != null)
- TextButton(
- onPressed: () => onAnswer(target),
- child: const Text('Answer'),
- ),
- ],
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ for (final person in waiting.people)
+ Text(
+ '${plural(person.count, 'agent')} '
+ '${person.count == 1 ? 'is' : 'are'} waiting on '
+ '${person.personId == viewerId ? 'you' : nameOf(person.personId)}',
+ style: DesktopChrome.metadata(),
+ ),
+ ],
+ ),
),
+ if (target != null)
+ TextButton(
+ onPressed: () => onAnswer(target),
+ child: const Text('Answer'),
+ ),
],
),
);
diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dart
index 62ec526a8..0a24f8707 100644
--- a/desktop/lib/super_tabs/roster.dart
+++ b/desktop/lib/super_tabs/roster.dart
@@ -523,6 +523,10 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
...people.where((p) => !scores.containsKey(p.id)),
];
final current = leaderboardWeekOf(widget.now());
+ // One set of numeric columns for every row.
+ final columns = board == null || board.people.isEmpty
+ ? null
+ : LeaderboardColumns.of(context, board.people);
return [
SuperTabSectionHeading(
'Humans',
@@ -557,13 +561,20 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
),
if (_board.error case final error?)
Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 4),
+ padding: const EdgeInsets.fromLTRB(
+ DesktopChrome.groupGap,
+ 0,
+ DesktopChrome.groupGap,
+ DesktopChrome.controlGap / 2,
+ ),
child: Text(error, style: DesktopChrome.metadata()),
),
for (final person in ranked)
LeaderboardPersonRow(
person: person,
score: scores[person.id],
+ columns: columns,
+ own: person.id == c.accountId,
onTap: () => _person(person, scores[person.id]),
),
if (board != null && board.waiting.total > 0)
@@ -578,7 +589,7 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
},
onAnswer: widget.onAnswer,
),
- const SizedBox(height: 16),
+ const SizedBox(height: DesktopChrome.groupGap),
SuperTabSectionHeading(
'Agents',
// An agent joins the Product Managers' conversation by leading a project,
diff --git a/desktop/test/super_tab_humans_test.dart b/desktop/test/super_tab_humans_test.dart
index 197b82e0a..8cb96189d 100644
--- a/desktop/test/super_tab_humans_test.dart
+++ b/desktop/test/super_tab_humans_test.dart
@@ -1,19 +1,26 @@
+import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_icons.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/super_tabs/controller.dart';
+import 'package:harness/super_tabs/identity.dart';
+import 'package:harness/super_tabs/roster.dart';
import 'package:harness/super_tabs/view.dart';
import 'support/humans_fixture.dart';
import 'support/super_tab_fixture.dart';
-/// The leaderboard lives in the right pane's Humans section (Dee, 2026-10-27):
-/// a small "🚀 N shipped" chip with a small week picker, then everyone, most
-/// points first, by display name, each one aligned row with a quiet line of
-/// their three numbers as icons. The top three have cups, #1 a sparkle as the
-/// board opens, and each an arrow against last week; a tap shows what the
-/// numbers are made of (Dee, 2026-10-28). There is no separate leaderboard view.
+/// The leaderboard lives in the right pane's Humans section (Dee, 2026-10-27),
+/// built to the desktop design system (2026-10-28): the team total as quiet
+/// text with a small week picker, then everyone, most points first, by display
+/// name. Each row is a bold rank in its own column, avatar, name, a quiet line
+/// of the non-zero numbers in words, and the points as the one emphasized,
+/// right-aligned number with the change against last week beside it. No emoji,
+/// cups or medal colours. A tap shows what the numbers are made of. There is
+/// no separate leaderboard view.
void main() {
Finder person(String id) => find.byKey(ValueKey('super-person-$id'));
@@ -89,35 +96,86 @@ void main() {
await close(tester, controller);
});
+ Finder within(String id, String text) =>
+ find.descendant(of: person(id), matching: find.text(text));
+ Finder part(String kind, String id) =>
+ find.byKey(ValueKey('leaderboard-$kind-$id'));
+ TextStyle styleOf(WidgetTester tester, Finder text) =>
+ tester.widget<Text>(text).style!;
+
testWidgets(
- 'gives each person their points on the right and a quiet line of their three numbers',
+ 'ranks each person with a bold numeral in its own right-aligned column',
(tester) async {
final controller = await show(tester, humansSwarm());
- Finder within(String id, String text) =>
- find.descendant(of: person(id), matching: find.text(text));
- expect(within('peer', '21 pts'), findsOneWidget);
- expect(within('peer', '🚀 6'), findsOneWidget);
- expect(within('peer', '🔓 3'), findsOneWidget);
- expect(within('peer', '💻 0 h'), findsOneWidget);
- expect(within('owner', '13 pts'), findsOneWidget);
- expect(within('owner', '💻 20 h'), findsOneWidget);
- // Each icon says what it counts on hover.
- expect(find.byTooltip('6 shipped'), findsOneWidget);
- expect(find.byTooltip('3 unblocked'), findsOneWidget);
- expect(find.byTooltip('20 agent-hours lent'), findsOneWidget);
- // Fixed columns: points end at one edge, and each number starts where
- // the one above it does.
- final right = tester.getTopRight(within('peer', '21 pts')).dx;
- expect(tester.getTopRight(within('owner', '13 pts')).dx, right);
- expect(tester.getTopRight(within('huy', '0 pts')).dx, right);
- expect(
- tester.getTopLeft(within('owner', '🔓 4')).dx,
- tester.getTopLeft(within('peer', '🔓 3')).dx,
+ final ranks = {
+ 'peer': '1',
+ 'owner': '2',
+ 'tony': '3',
+ 'scholes': '4',
+ 'diego': '5',
+ 'huy': '6',
+ 'maximilian.alexander.longname': '6',
+ };
+ for (final MapEntry(key: id, value: rank) in ranks.entries) {
+ expect(
+ find.descendant(of: part('rank', id), matching: find.text(rank)),
+ findsOneWidget,
+ reason: id,
+ );
+ }
+ final right = tester.getTopRight(part('rank', 'peer')).dx;
+ for (final id in ranks.keys) {
+ expect(tester.getTopRight(part('rank', id)).dx, right, reason: id);
+ }
+ // The rank stands before the avatar, in its own column.
+ final avatar = find.descendant(
+ of: person('peer'),
+ matching: find.byType(SuperTabAvatar),
);
- expect(
- tester.getTopLeft(within('owner', '💻 20 h')).dx,
- tester.getTopLeft(within('peer', '💻 0 h')).dx,
+ expect(right, lessThanOrEqualTo(tester.getTopLeft(avatar).dx));
+ final rank = styleOf(
+ tester,
+ find.descendant(of: part('rank', 'peer'), matching: find.text('1')),
+ );
+ expect(rank.fontWeight, FontWeight.w700);
+ expect(rank.fontFeatures, grid.AppFont.tabularFigures);
+ await close(tester, controller);
+ },
+ );
+
+ testWidgets(
+ 'gives each person their points as the one emphasized number, right-aligned',
+ (tester) async {
+ final semantics = tester.ensureSemantics();
+ final controller = await show(tester, humansSwarm());
+ expect(within('peer', '21'), findsOneWidget);
+ expect(within('owner', '13'), findsOneWidget);
+ // No unit repeated on every row; it is said once to a screen reader.
+ expect(find.textContaining('pts'), findsNothing);
+ expect(find.bySemanticsLabel(RegExp(r'\b21 points\b')), findsOneWidget);
+ semantics.dispose();
+ // A fixed column, as wide as the board's widest points.
+ final width = tester.getSize(part('points', 'peer')).width;
+ final right = tester.getTopRight(part('points', 'peer')).dx;
+ expect(tester.getSize(part('points', 'huy')).width, width);
+ for (final id in [
+ 'owner',
+ 'tony',
+ 'huy',
+ 'maximilian.alexander.longname',
+ ]) {
+ expect(tester.getTopRight(part('points', id)).dx, right, reason: id);
+ }
+ final points = styleOf(tester, within('peer', '21'));
+ expect(points.fontWeight, grid.AppFont.semibold);
+ expect(points.fontFeatures, grid.AppFont.tabularFigures);
+ expect(points.color, grid.AppPalette.textPrimary);
+ // The rank is quieter than the points.
+ final rank = styleOf(
+ tester,
+ find.descendant(of: part('rank', 'peer'), matching: find.text('1')),
);
+ expect(rank.color, grid.AppPalette.textSecondary);
// A long name is cut short rather than pushing the points out.
final name = tester.widget<Text>(
within(
@@ -126,42 +184,293 @@ void main() {
),
);
expect(name.overflow, TextOverflow.ellipsis);
- expect(
- tester.getTopRight(within('maximilian.alexander.longname', '0 pts')).dx,
- right,
- );
expect(tester.takeException(), isNull);
await close(tester, controller);
},
);
testWidgets(
- 'puts a small shipped chip above the people, with no open count',
+ 'writes the three numbers as one quiet line under the name, hiding zeros',
(tester) async {
final controller = await show(tester, humansSwarm());
- final goal = find.byKey(const ValueKey('leaderboard-goal'));
+ // Each person's whole line, in full words on hover.
+ final lines = {
+ 'peer': '6 shipped · 3 unblocked',
+ 'owner': '1 shipped · 4 unblocked · 20 agent-hours lent',
+ 'tony': '2 shipped',
+ 'scholes': '2 unblocked · 10 agent-hours lent',
+ 'diego': '1 unblocked · 10 agent-hours lent',
+ };
+ String shown(String id) => tester
+ .widget<Text>(
+ find.descendant(of: part('meta', id), matching: find.byType(Text)),
+ )
+ .data!;
+ for (final MapEntry(key: id, value: line) in lines.entries) {
+ expect(find.byTooltip(line), findsOneWidget, reason: id);
+ // What fits is whole items from the start, never part of a word.
+ final full = line.replaceAll('agent-hours', 'hours');
+ final text = shown(id);
+ expect(full.startsWith(text), isTrue, reason: '$id: $text');
+ expect(
+ text == full || full.substring(text.length).startsWith(' · '),
+ isTrue,
+ reason: '$id: $text',
+ );
+ final paragraph = tester.renderObject<RenderParagraph>(
+ find.descendant(
+ of: part('meta', id),
+ matching: find.byType(RichText),
+ ),
+ );
+ expect(paragraph.didExceedMaxLines, isFalse, reason: id);
+ }
+ expect(shown('tony'), '2 shipped');
+ // Ken's line is too long for the pane: whole items fall off its end.
expect(
- find.descendant(
- of: goal,
- matching: find.text('🚀 7 shipped this week'),
- ),
- findsOneWidget,
+ shown('owner'),
+ isNot(lines['owner']!.replaceAll('agent-hours', 'hours')),
);
- expect(find.textContaining('open'), findsNothing);
- expect(find.textContaining('Team goal'), findsNothing);
- // The week before and the median are on hover.
+ // Nothing to say, no line at all.
+ expect(part('meta', 'huy'), findsNothing);
+ final style = styleOf(
+ tester,
+ find.descendant(of: part('meta', 'peer'), matching: find.byType(Text)),
+ );
+ expect(style.fontSize, grid.AppType.captionSize);
+ expect(style.color, grid.AppPalette.textSecondary);
+ // The line starts where the name does.
expect(
- find.byTooltip('4 shipped last week\nMedian ask to ship 2 h'),
- findsOneWidget,
+ tester.getTopLeft(part('meta', 'peer')).dx,
+ tester.getTopLeft(within('peer', 'Dee')).dx,
);
+ await close(tester, controller);
+ },
+ );
+
+ testWidgets('draws no emoji, cups, sparkles or medal colours', (
+ tester,
+ ) async {
+ final controller = await show(tester, humansSwarm(), settle: false);
+ final emoji = RegExp(
+ '[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{231A}-\u{23FF}]',
+ unicode: true,
+ );
+ final roster = find.byType(SuperTabRoster);
+ final texts = [
+ for (final widget in tester.widgetList<RichText>(
+ find.descendant(of: roster, matching: find.byType(RichText)),
+ ))
+ widget.text.toPlainText(),
+ ];
+ expect(texts.where(emoji.hasMatch), isEmpty);
+ expect(find.byIcon(AppIcons.trophy), findsNothing);
+ expect(find.byIcon(AppIcons.sparkles), findsNothing);
+ expect(find.byKey(const ValueKey('leaderboard-sparkle')), findsNothing);
+ expect(find.byKey(const ValueKey('leaderboard-cup-peer')), findsNothing);
+ await tester.pumpAndSettle();
+ await close(tester, controller);
+ });
+
+ testWidgets("fills the viewer's own row as the selected row, and no other", (
+ tester,
+ ) async {
+ final controller = await show(tester, humansSwarm());
+ Color? fill(String id) => tester
+ .widget<Material>(
+ find.ancestor(of: person(id), matching: find.byType(Material)).first,
+ )
+ .color;
+ // The viewer is Dee.
+ expect(fill('peer'), grid.AppSurface.selectedFill);
+ expect(fill('owner'), Colors.transparent);
+ await close(tester, controller);
+ });
+
+ testWidgets('keeps every column with enlarged text', (tester) async {
+ // Wide enough that the people stay beside the chat at double size.
+ await tester.binding.setSurfaceSize(const Size(2400, 1400));
+ final controller = humansSwarm().controller(
+ account: 'peer',
+ initial: {'tabId': 'tab', 'accountId': 'peer', 'selectedId': 'lead'},
+ );
+ await controller.refresh();
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.light),
+ builder: (context, child) => MediaQuery(
+ data: MediaQuery.of(context)
+ .copyWith(textScaler: const TextScaler.linear(2)),
+ child: child!,
+ ),
+ home: Scaffold(
+ body: SuperTabView(
+ controller: controller,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ machineName: (_) => 'Studio',
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ expect(tester.takeException(), isNull);
+ final right = tester.getTopRight(part('rank', 'peer')).dx;
+ expect(tester.getTopRight(part('rank', 'huy')).dx, right);
+ final points = tester.getTopRight(part('points', 'peer')).dx;
+ expect(tester.getTopRight(part('points', 'owner')).dx, points);
+ await close(tester, controller);
+ await tester.binding.setSurfaceSize(null);
+ });
+
+ testWidgets('says the team total as plain metadata text above the people', (
+ tester,
+ ) async {
+ final controller = await show(tester, humansSwarm());
+ final goal = find.byKey(const ValueKey('leaderboard-goal'));
+ final text = find.descendant(
+ of: goal,
+ matching: find.text('7 shipped this week'),
+ );
+ expect(text, findsOneWidget);
+ expect(find.textContaining('open'), findsNothing);
+ expect(find.textContaining('Team goal'), findsNothing);
+ // No chip: nothing drawn behind it.
+ expect(
+ find.descendant(of: goal, matching: find.byType(DecoratedBox)),
+ findsNothing,
+ );
+ expect(
+ tester
+ .widgetList<Container>(
+ find.descendant(of: goal, matching: find.byType(Container)),
+ )
+ .where((c) => c.decoration != null),
+ isEmpty,
+ );
+ final style = styleOf(tester, text);
+ expect(style.fontSize, grid.AppType.captionSize);
+ expect(style.color, grid.AppPalette.textSecondary);
+ // The week before and the median are on hover.
+ expect(
+ find.byTooltip('4 shipped last week\nMedian ask to ship 2 h'),
+ findsOneWidget,
+ );
+ expect(
+ tester.getTopLeft(goal).dy,
+ lessThan(tester.getTopLeft(person('peer')).dy),
+ );
+ await close(tester, controller);
+ });
+
+ testWidgets(
+ 'puts the waiting line in the same quiet hierarchy as the team total',
+ (tester) async {
+ final controller = await show(tester, humansSwarm());
+ final waiting = find.byKey(const ValueKey('leaderboard-waiting'));
+ final heading = find.descendant(
+ of: waiting,
+ matching: find.text('1 agent is waiting on you'),
+ );
+ expect(heading, findsOneWidget);
+ expect(styleOf(tester, heading).fontSize, grid.AppType.captionSize);
+ expect(styleOf(tester, heading).color, grid.AppPalette.textSecondary);
+ expect(find.textContaining('Dee 1'), findsNothing);
+ expect(styleOf(tester, heading).fontSize, grid.AppType.captionSize);
+ final goal = find.text('7 shipped this week');
+ expect(tester.getTopLeft(heading).dx, tester.getTopLeft(goal).dx);
+ await close(tester, controller);
+ },
+ );
+
+ testWidgets('says in words how many agents wait on whom, the viewer as you', (
+ tester,
+ ) async {
+ final server = humansSwarm();
+ server.leaderboard!['waiting'] = {
+ 'total': 4,
+ 'people': [
+ {
+ 'personId': 'owner',
+ 'count': 3,
+ 'conversationIds': ['g1'],
+ },
+ {
+ 'personId': 'peer',
+ 'count': 1,
+ 'conversationIds': ['offline'],
+ },
+ ],
+ };
+ final controller = await show(tester, server);
+ final waiting = find.byKey(const ValueKey('leaderboard-waiting'));
+ Finder line(String text) =>
+ find.descendant(of: waiting, matching: find.text(text));
+ expect(line('3 agents are waiting on Ken'), findsOneWidget);
+ expect(line('1 agent is waiting on you'), findsOneWidget);
+ await close(tester, controller);
+ });
+
+ testWidgets(
+ 'keeps a row with no points in rank order, its 0 in the points style',
+ (tester) async {
+ final controller = await show(tester, humansSwarm());
+ final zero = styleOf(
+ tester,
+ find.descendant(of: part('points', 'huy'), matching: find.text('0')),
+ );
+ final points = styleOf(tester, within('tony', '6'));
+ // One rule for every points value (Numbers and rankings).
+ expect(zero.color, grid.AppPalette.textPrimary);
+ expect(zero.fontWeight, grid.AppFont.semibold);
+ expect(zero.fontFeatures, grid.AppFont.tabularFigures);
+ expect(zero, points);
expect(
- tester.getTopLeft(goal).dy,
- lessThan(tester.getTopLeft(person('peer')).dy),
+ tester.getTopLeft(person('huy')).dy,
+ greaterThan(tester.getTopLeft(person('diego')).dy),
);
await close(tester, controller);
},
);
+ testWidgets(
+ "shows hover and keyboard focus over the viewer's own row's fill",
+ (tester) async {
+ final controller = await show(tester, humansSwarm());
+ // The viewer's row: its fill, under the ink of hover and focus.
+ final ink = Material.of(tester.element(person('peer'))) as RenderObject;
+ expect(ink, isNot(paints..rrect(color: grid.AppSurface.hoverFill)));
+
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: tester.getCenter(person('peer')));
+ addTearDown(mouse.removePointer);
+ await tester.pumpAndSettle();
+ expect(ink, paints..rrect(color: grid.AppSurface.hoverFill));
+
+ await mouse.moveTo(Offset.zero);
+ await tester.pumpAndSettle();
+ expect(ink, isNot(paints..rrect(color: grid.AppSurface.hoverFill)));
+
+ FocusManager.instance.highlightStrategy =
+ FocusHighlightStrategy.alwaysTraditional;
+ addTearDown(
+ () => FocusManager.instance.highlightStrategy =
+ FocusHighlightStrategy.automatic,
+ );
+ Focus.of(
+ tester.element(
+ find
+ .descendant(of: person('peer'), matching: find.byType(Padding))
+ .first,
+ ),
+ ).requestFocus();
+ await tester.pumpAndSettle();
+ expect(ink, paints..rrect(color: grid.AppSurface.hoverFill));
+ await close(tester, controller);
+ },
+ );
+
testWidgets(
"names each person by display name, else their email's first part",
(tester) async {
@@ -175,78 +484,58 @@ void main() {
expect(find.text('dee'), findsNothing);
// The email stays on hover.
expect(find.byTooltip('[email protected]'), findsOneWidget);
- // Who agents wait on reads the same name.
- expect(find.text('Dee 1'), findsOneWidget);
+
await close(tester, controller);
},
);
testWidgets(
- 'shows an up or down arrow against last week, and none when level or unknown',
+ 'shows an up or down arrow against last week, by shape and colour, and none when level or unknown',
(tester) async {
final controller = await show(tester, humansSwarm());
- Finder trend(String id) => find.byKey(ValueKey('leaderboard-trend-$id'));
+ Finder trend(String id) => part('trend', id);
+ Icon arrow(String id) => tester.widget<Icon>(
+ find.descendant(of: trend(id), matching: find.byType(Icon)),
+ );
// Dee 21 from 15, Ken 13 from 20.
expect(
find.descendant(of: trend('peer'), matching: find.text('6')),
findsOneWidget,
);
expect(find.byTooltip('Up 6 from last week'), findsOneWidget);
+ expect(arrow('peer').icon, AppIcons.arrowUp);
+ expect(arrow('peer').color, grid.AppPalette.online);
expect(
find.descendant(of: trend('owner'), matching: find.text('7')),
findsOneWidget,
);
expect(find.byTooltip('Down 7 from last week'), findsOneWidget);
- // Tony level at 6; Scholes from a server without last week.
- expect(trend('tony'), findsNothing);
- expect(trend('scholes'), findsNothing);
- await close(tester, controller);
- },
- );
-
- testWidgets('gives the top three gold, silver and bronze cups', (
- tester,
- ) async {
- final controller = await show(tester, humansSwarm());
- Finder cup(String id) => find.byKey(ValueKey('leaderboard-cup-$id'));
- expect(
- find.descendant(of: person('peer'), matching: cup('peer')),
- findsOneWidget,
- );
- expect(find.byTooltip('Gold cup: 1st this week'), findsOneWidget);
- expect(find.byTooltip('Silver cup: 2nd this week'), findsOneWidget);
- expect(find.byTooltip('Bronze cup: 3rd this week'), findsOneWidget);
- expect({
- for (final id in ['peer', 'owner', 'tony'])
+ expect(arrow('owner').icon, AppIcons.arrowDown);
+ expect(
+ arrow('owner').color,
+ Theme.of(tester.element(trend('owner'))).colorScheme.error,
+ );
+ expect(
tester
- .widget<Icon>(
- find.descendant(of: cup(id), matching: find.byType(Icon)),
+ .widget<Text>(
+ find.descendant(of: trend('peer'), matching: find.text('6')),
)
- .color,
- }, hasLength(3));
- expect(cup('scholes'), findsNothing);
- await close(tester, controller);
- });
-
- testWidgets(
- 'sparkles #1 once as the board opens, and never with Reduce Motion',
- (tester) async {
- final sparkle = find.byKey(const ValueKey('leaderboard-sparkle'));
- var controller = await show(tester, humansSwarm(), settle: false);
+ .style!
+ .fontFeatures,
+ grid.AppFont.tabularFigures,
+ );
+ // The change has its own right-aligned column, just before the points.
expect(
- find.descendant(of: person('peer'), matching: sparkle),
- findsOneWidget,
+ tester.getTopRight(trend('peer')).dx,
+ tester.getTopRight(trend('owner')).dx,
);
- await tester.pumpAndSettle();
- expect(sparkle, findsNothing);
- await close(tester, controller);
- controller = await show(
- tester,
- humansSwarm(),
- settle: false,
- reduceMotion: true,
+ expect(
+ tester.getTopRight(trend('peer')).dx,
+ lessThan(tester.getTopLeft(part('points', 'peer')).dx),
);
- expect(sparkle, findsNothing);
+ // Tony level at 6; Scholes from a server without last week.
+ expect(trend('tony'), findsNothing);
+ expect(trend('scholes'), findsNothing);
await close(tester, controller);
},
);
@@ -303,9 +592,9 @@ void main() {
find.descendant(of: dialog, matching: find.text(text));
expect(inDialog('Dee'), findsOneWidget);
expect(inDialog('21 pts · up 6 from last week'), findsOneWidget);
- expect(inDialog('🚀 Shipped'), findsOneWidget);
- expect(inDialog('🔓 Unblocked'), findsOneWidget);
- expect(inDialog('💻 Lent'), findsOneWidget);
+ expect(inDialog('Shipped'), findsOneWidget);
+ expect(inDialog('Unblocked'), findsOneWidget);
+ expect(inDialog('Lent'), findsOneWidget);
expect(inDialog('Which sign-in page ships first?'), findsOneWidget);
expect(inDialog('waited 1.6 h'), findsOneWidget);
// Dee lent nothing this week.
@@ -349,7 +638,7 @@ void main() {
find.descendant(of: dialog, matching: find.text(text));
expect(inDialog('scholes'), findsOneWidget);
expect(inDialog('Nothing landed yet'), findsOneWidget);
- expect(inDialog('🚀 Shipped'), findsNothing);
+ expect(inDialog('No pull requests merged yet'), findsNothing);
expect(find.textContaining('last week'), findsNothing);
await close(tester, controller);
},
@@ -446,7 +735,8 @@ void main() {
final server = humansSwarm()..leaderboard = null;
final controller = await show(tester, server);
expect(person('peer'), findsOneWidget);
- expect(find.textContaining('pts'), findsNothing);
+ expect(part('points', 'peer'), findsNothing);
+ expect(part('rank', 'peer'), findsNothing);
expect(find.textContaining('leaderboard'), findsNothing);
await close(tester, controller);
},
diff --git a/desktop/test/super_tab_leaderboard_shots_test.dart b/desktop/test/super_tab_leaderboard_shots_test.dart
index ccf3b4f04..17df794fb 100644
--- a/desktop/test/super_tab_leaderboard_shots_test.dart
+++ b/desktop/test/super_tab_leaderboard_shots_test.dart
@@ -12,11 +12,7 @@ import 'support/humans_fixture.dart';
/// real right pane over the in-memory Swarm, never a backend or the live app.
final shots = Platform.environment['SUPER_TAB_LEADERBOARD_SHOTS'];
-Future<void> showHumans(
- WidgetTester tester,
- Brightness brightness, {
- bool settle = true,
-}) async {
+Future<void> showHumans(WidgetTester tester, Brightness brightness) async {
await tester.binding.setSurfaceSize(const Size(1300, 900));
addTearDown(() => tester.binding.setSurfaceSize(null));
// The app sets the design tokens' brightness from its theme at startup.
@@ -43,15 +39,7 @@ Future<void> showHumans(
),
),
);
- if (settle) {
- await tester.pumpAndSettle();
- return;
- }
- // The board's read lands, and #1's sparkle is at its brightest.
- for (var i = 0; i < 5; i++) {
- await tester.pump();
- }
- await tester.pump(const Duration(milliseconds: 650));
+ await tester.pumpAndSettle();
}
void main() {
@@ -68,10 +56,6 @@ void main() {
await tester.pumpAndSettle();
await captureWindow(tester, shots, 'person-$name');
await tester.pumpWidget(const SizedBox());
- await showHumans(tester, brightness, settle: false);
- await captureWindow(tester, shots, 'humans-$name-sparkle');
- await tester.pumpAndSettle();
- await tester.pumpWidget(const SizedBox());
}
}, skip: shots == null);
}
diff --git a/desktop/test/super_tab_leaderboard_test.dart b/desktop/test/super_tab_leaderboard_test.dart
index 8ece32ec5..3b9ed0e35 100644
--- a/desktop/test/super_tab_leaderboard_test.dart
+++ b/desktop/test/super_tab_leaderboard_test.dart
@@ -4,6 +4,7 @@ import 'package:fake_async/fake_async.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/super_tabs/controller.dart';
import 'package:harness/super_tabs/leaderboard/model.dart';
+import 'package:harness/super_tabs/leaderboard/person_row.dart';
import 'package:harness/super_tabs/leaderboard/reader.dart';
// Monday 2026-10-26 00:00 UTC.
@@ -234,6 +235,21 @@ void main() {
expect(ken.details!.lent, isEmpty);
});
+ test('writes the numbers in words, lent in hours, zeros left out', () {
+ final board = SuperTabLeaderboard.fromJson(answer());
+ expect(leaderboardNumbers(board.people[0]), [
+ '9 shipped',
+ '14 unblocked',
+ '31 hours lent',
+ ]);
+ expect(leaderboardNumbers(board.people[1]), ['6 shipped', '5 unblocked']);
+ expect(leaderboardNumbers(board.people[3]), isEmpty);
+ final one = SuperTabPersonScore.fromJson(
+ score('a', points: 1, rank: 1, lentMs: hour),
+ );
+ expect(leaderboardNumbers(one), ['1 hour lent']);
+ });
+
test('asks for the project and, once chosen, the week', () async {
final requests = FakeRequests();
final reader = SuperTabLeaderboardReader(