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.

Web UX: Store usable on phones (B1, P3 Store line) (#1673)

Jacob Pham1324cb28346a
diff --git a/desktop/lib/store/store_category.dart b/desktop/lib/store/store_category.dart
index bce1e8ecf..9dea4d50f 100644
--- a/desktop/lib/store/store_category.dart
+++ b/desktop/lib/store/store_category.dart
@@ -9,6 +9,7 @@ import 'store_listing.dart';
import 'store_featured_art.dart';
import 'store_exploration.dart';
import 'store_explore_widgets.dart';
+import 'store_host.dart';
import 'store_models.dart';
/// A short invitation and an icon-led catalog. Product details and examples
@@ -70,6 +71,8 @@ class _StoreCategoryState extends State<StoreCategory> {
grid.AppTheme.watch(context);
final name = widget.name;
final loaded = widget.loaded;
+ // A browser runs no harness, so it has no computer to ask.
+ final runsNoHarness = storeRunsNoHarness(context);
final ratingFor = widget.ratingFor;
final installed = widget.installed;
final onOpen = widget.onOpen;
@@ -159,11 +162,13 @@ class _StoreCategoryState extends State<StoreCategory> {
),
)
else if (entries.isEmpty)
- loaded
+ loaded || runsNoHarness
? Padding(
padding: const EdgeInsets.symmetric(vertical: 36),
child: Text(
- 'Nothing here yet.',
+ runsNoHarness
+ ? kStoreOnAComputer
+ : 'Nothing here yet.',
style: TextStyle(
color: grid.AppPalette.textSecondary,
),
diff --git a/desktop/lib/store/store_compact_nav.dart b/desktop/lib/store/store_compact_nav.dart
new file mode 100644
index 000000000..1e4180439
--- /dev/null
+++ b/desktop/lib/store/store_compact_nav.dart
@@ -0,0 +1,336 @@
+import 'dart:async';
+
+import 'package:flutter/gestures.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+
+import '../shared/theme/app_theme.dart' as grid;
+
+/// The smallest box a finger can reliably hit on a phone (audit finding S1).
+const double kStoreMinHit = 44;
+
+/// How far each end of the chip row fades over the chips behind it.
+const double _fadeWidth = 32;
+
+/// A [kStoreMinHit] box around a smaller control, for phones: the ring
+/// outside the control does what the control does, and a screen reader finds
+/// one button the size of the box. The control keeps its own look.
+class StoreHitArea extends StatelessWidget {
+ const StoreHitArea({
+ super.key,
+ required this.onTap,
+ required this.child,
+ this.selected,
+ this.onHover,
+ });
+
+ final VoidCallback? onTap;
+ final Widget child;
+ final bool? selected;
+ final ValueChanged<bool>? onHover;
+
+ @override
+ Widget build(BuildContext context) {
+ return MergeSemantics(
+ child: Semantics(
+ button: true,
+ selected: selected,
+ child: MouseRegion(
+ cursor: onTap == null
+ ? SystemMouseCursors.basic
+ : SystemMouseCursors.click,
+ onEnter: onHover == null ? null : (_) => onHover!(true),
+ onExit: onHover == null ? null : (_) => onHover!(false),
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: onTap,
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(
+ minWidth: kStoreMinHit,
+ minHeight: kStoreMinHit,
+ ),
+ child: Center(widthFactor: 1, heightFactor: 1, child: child),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+/// One shelf in the phone Store's chip row.
+class StoreChip {
+ const StoreChip({
+ required this.id,
+ required this.label,
+ required this.icon,
+ required this.selected,
+ required this.onTap,
+ this.count,
+ });
+
+ /// Keys the chip as `store-chip:<id>`.
+ final String id;
+ final String label;
+ final IconData icon;
+ final bool selected;
+ final VoidCallback onTap;
+ final int? count;
+}
+
+/// The Store's rail as a phone has room for it (audit finding B1): one row of
+/// chips above the content. A mouse wheel rolls it sideways, each end fades
+/// while chips are hidden past it, and the selected chip is scrolled into
+/// view when the row opens and whenever the selection moves.
+class StoreChipRow extends StatefulWidget {
+ const StoreChipRow({super.key, required this.chips});
+
+ final List<StoreChip> chips;
+
+ @override
+ State<StoreChipRow> createState() => _StoreChipRowState();
+}
+
+class _StoreChipRowState extends State<StoreChipRow> {
+ final _scroll = ScrollController();
+ final _chipKeys = <String, GlobalKey>{};
+
+ @override
+ void initState() {
+ super.initState();
+ _scroll.addListener(_changed);
+ // The row has no extent until it has laid out once.
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ _changed();
+ _revealSelected(animate: false);
+ });
+ }
+
+ @override
+ void didUpdateWidget(StoreChipRow oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (_selectedOf(oldWidget.chips) == _selectedOf(widget.chips)) return;
+ WidgetsBinding.instance.addPostFrameCallback(
+ (_) => _revealSelected(animate: true),
+ );
+ }
+
+ static String? _selectedOf(List<StoreChip> chips) =>
+ chips.where((chip) => chip.selected).firstOrNull?.id;
+
+ /// Scrolls the least distance that shows the selected chip whole and clear
+ /// of the fades; a chip already in view does not move the row.
+ void _revealSelected({required bool animate}) {
+ final id = _selectedOf(widget.chips);
+ final chip = id == null ? null : _chipKeys[id]?.currentContext;
+ if (!mounted || chip == null || !_scroll.hasClients) return;
+ final box = chip.findRenderObject()!;
+ final viewport = RenderAbstractViewport.of(box);
+ final position = _scroll.position;
+ final atStart = viewport.getOffsetToReveal(box, 0).offset - _fadeWidth;
+ final atEnd = viewport.getOffsetToReveal(box, 1).offset + _fadeWidth;
+ final target = position.pixels > atStart
+ ? atStart
+ : position.pixels < atEnd
+ ? atEnd
+ : null;
+ if (target == null) return;
+ final clamped = target.clamp(
+ position.minScrollExtent,
+ position.maxScrollExtent,
+ );
+ if (!animate || MediaQuery.disableAnimationsOf(context)) {
+ position.jumpTo(clamped);
+ return;
+ }
+ unawaited(
+ position.animateTo(
+ clamped,
+ // As the tab row pages its tabs.
+ duration: const Duration(milliseconds: 220),
+ curve: Curves.easeOutCubic,
+ ),
+ );
+ }
+
+ @override
+ void dispose() {
+ _scroll.dispose();
+ super.dispose();
+ }
+
+ void _changed() {
+ if (mounted) setState(() {});
+ }
+
+ /// A wheel sends vertical deltas, which a horizontal list ignores; the
+ /// larger of the two axes rolls the row.
+ void _wheel(PointerSignalEvent event) {
+ if (event is! PointerScrollEvent || !_scroll.hasClients) return;
+ final position = _scroll.position;
+ final delta = event.scrollDelta.dx.abs() > event.scrollDelta.dy.abs()
+ ? event.scrollDelta.dx
+ : event.scrollDelta.dy;
+ if (delta == 0) return;
+ GestureBinding.instance.pointerSignalResolver.register(event, (_) {
+ position.jumpTo(
+ (position.pixels + delta).clamp(
+ position.minScrollExtent,
+ position.maxScrollExtent,
+ ),
+ );
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ final position = _scroll.hasClients ? _scroll.position : null;
+ final hasExtent = position?.hasContentDimensions ?? false;
+ final atStart = !hasExtent || position!.pixels <= position.minScrollExtent;
+ final atEnd = !hasExtent || position!.pixels >= position.maxScrollExtent;
+ return NotificationListener<ScrollMetricsNotification>(
+ onNotification: (_) {
+ _changed();
+ return false;
+ },
+ child: Listener(
+ onPointerSignal: _wheel,
+ child: SizedBox(
+ key: const ValueKey('store-chips'),
+ height: kStoreMinHit,
+ child: Stack(
+ children: [
+ // Every chip is built, not only the visible ones, so a screen
+ // reader can reach the ones past the edge.
+ SingleChildScrollView(
+ controller: _scroll,
+ scrollDirection: Axis.horizontal,
+ // The content's own gutter on a phone, so the first chip
+ // lines up with the page under it.
+ padding: const EdgeInsets.symmetric(horizontal: 20),
+ child: Row(
+ children: [
+ for (final (i, chip) in widget.chips.indexed) ...[
+ if (i > 0) const SizedBox(width: 6),
+ KeyedSubtree(
+ key: _chipKeys.putIfAbsent(chip.id, GlobalKey.new),
+ child: _ChipButton(chip: chip),
+ ),
+ ],
+ ],
+ ),
+ ),
+ if (!atStart)
+ const _EdgeFade(
+ key: ValueKey('store-chips-fade-start'),
+ start: true,
+ ),
+ if (!atEnd)
+ const _EdgeFade(
+ key: ValueKey('store-chips-fade-end'),
+ start: false,
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+/// The page's own colour washing over the chips at one end of the row.
+class _EdgeFade extends StatelessWidget {
+ const _EdgeFade({super.key, required this.start});
+
+ final bool start;
+
+ @override
+ Widget build(BuildContext context) {
+ final page = grid.AppPalette.windowBg;
+ return Positioned(
+ top: 0,
+ bottom: 0,
+ left: start ? 0 : null,
+ right: start ? null : 0,
+ width: _fadeWidth,
+ child: IgnorePointer(
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ begin: start ? Alignment.centerLeft : Alignment.centerRight,
+ end: start ? Alignment.centerRight : Alignment.centerLeft,
+ colors: [page, page.withValues(alpha: 0)],
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+class _ChipButton extends StatefulWidget {
+ const _ChipButton({required this.chip});
+
+ final StoreChip chip;
+
+ @override
+ State<_ChipButton> createState() => _ChipButtonState();
+}
+
+class _ChipButtonState extends State<_ChipButton> {
+ bool _hovered = false;
+
+ @override
+ Widget build(BuildContext context) {
+ final chip = widget.chip;
+ final ink = chip.selected
+ ? grid.AppPalette.textPrimary
+ : grid.AppPalette.textSecondary;
+ return StoreHitArea(
+ key: ValueKey('store-chip:${chip.id}'),
+ onTap: chip.onTap,
+ selected: chip.selected,
+ onHover: (hovered) => setState(() => _hovered = hovered),
+ child: AnimatedContainer(
+ duration: MediaQuery.disableAnimationsOf(context)
+ ? Duration.zero
+ : grid.AppMotion.hover,
+ curve: grid.AppMotion.curve,
+ height: 32,
+ padding: const EdgeInsets.symmetric(horizontal: 12),
+ decoration: BoxDecoration(
+ color: chip.selected
+ ? grid.AppSurface.selectedFill
+ : _hovered
+ ? grid.AppSurface.hoverFill
+ : Colors.transparent,
+ border: Border.all(
+ color: chip.selected ? Colors.transparent : grid.AppPalette.divider,
+ ),
+ borderRadius: BorderRadius.circular(16),
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(chip.icon, size: 15, color: ink),
+ const SizedBox(width: 6),
+ Text(
+ chip.label,
+ maxLines: 1,
+ softWrap: false,
+ style: grid.AppType.label(color: ink),
+ ),
+ if (chip.count != null) ...[
+ const SizedBox(width: 6),
+ Text(
+ '${chip.count}',
+ style: grid.AppType.caption(color: grid.AppPalette.textFaint),
+ ),
+ ],
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/desktop/lib/store/store_discover.dart b/desktop/lib/store/store_discover.dart
index bd4763c41..7fcf0e784 100644
--- a/desktop/lib/store/store_discover.dart
+++ b/desktop/lib/store/store_discover.dart
@@ -11,6 +11,7 @@ import 'store_editorial.dart';
import 'store_exploration.dart';
import 'store_explore_widgets.dart';
import 'store_featured_art.dart';
+import 'store_host.dart';
import 'store_listing.dart';
import 'store_models.dart';
@@ -276,6 +277,16 @@ class StoreDiscover extends StatelessWidget {
color: grid.AppPalette.textSecondary,
),
),
+ ] else if (storeRunsNoHarness(context)) ...[
+ // A browser runs no harness: no computer will answer.
+ const SizedBox(height: 32),
+ Text(
+ 'Open the Harness app on a computer to see more harnesses.',
+ style: grid.AppType.body(
+ height: 1.5,
+ color: grid.AppPalette.textSecondary,
+ ),
+ ),
] else if (!loaded) ...[
const SizedBox(height: 32),
const SkeletonBlock(
diff --git a/desktop/lib/store/store_explore_widgets.dart b/desktop/lib/store/store_explore_widgets.dart
index ff4bd3ca1..f670979fe 100644
--- a/desktop/lib/store/store_explore_widgets.dart
+++ b/desktop/lib/store/store_explore_widgets.dart
@@ -6,8 +6,10 @@ import '../core/dsh_catalog.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../widgets/engine_identity.dart';
import 'store_editorial.dart';
+import 'store_compact_nav.dart';
import 'store_cover_art.dart';
import 'store_exploration.dart';
+import 'store_host.dart';
class StoreExploreHeading extends StatelessWidget {
const StoreExploreHeading({
@@ -57,6 +59,9 @@ class StoreExploreHeading extends StatelessWidget {
onPressed: onAction,
style: TextButton.styleFrom(
foregroundColor: grid.AppPalette.accentOnSurface,
+ minimumSize: storeIsCompact(context)
+ ? const Size.square(kStoreMinHit)
+ : null,
),
child: Text(action!),
),
diff --git a/desktop/lib/store/store_host.dart b/desktop/lib/store/store_host.dart
new file mode 100644
index 000000000..5ca266d49
--- /dev/null
+++ b/desktop/lib/store/store_host.dart
@@ -0,0 +1,21 @@
+import 'package:flutter/widgets.dart';
+
+import '../state/workspace_chrome.dart';
+
+/// Whether the Store lays itself out for a phone: below the host chrome's
+/// [WorkspaceChrome.compactBelow]. Desktop has no chrome, so its threshold is
+/// zero and the Store keeps its rail at any window width.
+bool storeIsCompact(BuildContext context) =>
+ MediaQuery.sizeOf(context).width < WorkspaceChrome.of(context).compactBelow;
+
+/// Whether the device showing the Store runs no harness of its own — a
+/// browser — so there is no "this computer" for its copy to name. The host
+/// says so by choosing where New Harness starts
+/// ([WorkspaceChrome.newHarnessMachine]); Desktop never does.
+bool storeRunsNoHarness(BuildContext context) =>
+ WorkspaceChrome.of(context).newHarnessMachine != null;
+
+/// What a shelf whose harnesses come from a computer says where
+/// [storeRunsNoHarness]: why it is empty and what to do, never that there is
+/// nothing.
+const kStoreOnAComputer = 'Open the Harness app on a computer to see these.';
diff --git a/desktop/lib/store/store_screen.dart b/desktop/lib/store/store_screen.dart
index 316e0da7d..dd04dcc85 100644
--- a/desktop/lib/store/store_screen.dart
+++ b/desktop/lib/store/store_screen.dart
@@ -30,10 +30,12 @@ import '../widgets/open_harness_intent.dart';
import 'experimental_harnesses.dart';
import 'store_category.dart';
import 'store_collections.dart';
+import 'store_compact_nav.dart';
import 'store_controller.dart';
import 'store_discover.dart';
import 'store_editorial.dart';
import 'store_harness_actions.dart';
+import 'store_host.dart';
import 'store_listing.dart';
import 'store_models.dart';
import 'store_search.dart';
@@ -468,140 +470,126 @@ class _StoreTabState extends State<StoreTab> {
final category = selected != null
? storeCategoryFor(selected)
: (_shelf is _Category ? (_shelf as _Category).name : null);
+ final compact = storeIsCompact(context);
+ final nav = _Nav(
+ shelf: _shelf,
+ selectedCategory: category,
+ hasProduct: selected != null,
+ sessionCount: storeRecordedSessions(catalog.values).length,
+ counts: {
+ for (final name in _categories)
+ name: catalog.values
+ .where(
+ (e) =>
+ !e.isViewerPackage && storeCategoryFor(e) == name,
+ )
+ .length,
+ },
+ categories: _categories,
+ onSelect: _show,
+ );
+ final search = StoreSearch(
+ controller: _search,
+ focusNode: _searchFocus,
+ onChanged: _searchChanged,
+ autofocus: _selected == null,
+ onClear: _clearSearch,
+ onBack: _canGoBack ? _goBack : null,
+ onForward: _place.forward.isEmpty ? null : _goForward,
+ compact: compact,
+ );
+ final page = Expanded(
+ child: PageStorage(
+ bucket: _place.scroll,
+ child: KeyedSubtree(
+ key: PageStorageKey(
+ 'store-location:${_shelfKey(_shelf)}:${_selected ?? ''}',
+ ),
+ child: selected != null
+ ? _ProductPage(
+ key: ValueKey('store-page:${selected.id}'),
+ entry: selected,
+ notifier: widget.notifier,
+ recentHarnesses: widget.recentHarnesses,
+ store: _store,
+ )
+ : _shelf is _Viewers
+ ? StoreViewers(
+ viewers: _shelved(const _Viewers()),
+ agents:
+ widget
+ .notifier
+ .localMachineState
+ ?.dsh
+ .entries ??
+ const [],
+ installedOn: (id) => _installedOn(id)
+ .map((machine) => machine.machine.displayName)
+ .toList(),
+ onOpenAgent: _openPage,
+ loaded:
+ widget.notifier.localMachineState?.dsh.loaded ??
+ false,
+ )
+ : _shelf is _Sessions
+ ? StoreSessions(
+ sessions: storeRecordedSessions(
+ _shelved(const _Sessions()),
+ ),
+ onOpen: _openPage,
+ )
+ : _shelf is _Discover
+ ? StoreDiscover(
+ entries: _shelved(const _Discover()),
+ loaded:
+ widget.notifier.localMachineState?.dsh.loaded ??
+ false,
+ ratingFor: (entry) =>
+ _store.ratingOf(StoreController.keyFor(entry)),
+ onOpen: _openPage,
+ onCategory: (name) => _show(_Category(name)),
+ onAll: () => _show(const _All()),
+ onEngines: () => _show(const _Category('Coding')),
+ essentialLabel: (id) =>
+ widget.notifier.essential(id)?.exists == true
+ ? 'Open'
+ : 'Create',
+ onEssential: (id) => unawaited(_openEssential(id)),
+ )
+ : _Shelf$View(
+ shelf: _shelf as _Listed,
+ categories: _categories,
+ onCategory: (name) => _show(_Category(name)),
+ entries: _shelved(_shelf),
+ store: _store,
+ installedOn: _installedOn,
+ loaded:
+ widget.notifier.localMachineState?.dsh.loaded ??
+ false,
+ onOpen: _openPage,
+ ),
+ ),
+ ),
+ );
+ if (compact) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ search,
+ _StoreChips(nav: nav),
+ page,
+ ],
+ );
+ }
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- _StoreNav(
- shelf: _shelf,
- selectedCategory: category,
- hasProduct: selected != null,
- sessionCount: storeRecordedSessions(catalog.values).length,
- counts: {
- for (final name in _categories)
- name: catalog.values
- .where(
- (e) =>
- !e.isViewerPackage &&
- storeCategoryFor(e) == name,
- )
- .length,
- },
- categories: _categories,
- onSelect: _show,
- ),
+ _StoreNav(nav: nav),
VerticalDivider(width: 1, color: grid.AppPalette.divider),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- StoreSearch(
- controller: _search,
- focusNode: _searchFocus,
- onChanged: _searchChanged,
- autofocus: _selected == null,
- onClear: _clearSearch,
- onBack: _canGoBack ? _goBack : null,
- onForward: _place.forward.isEmpty ? null : _goForward,
- ),
- Expanded(
- child: PageStorage(
- bucket: _place.scroll,
- child: KeyedSubtree(
- key: PageStorageKey(
- 'store-location:${_shelfKey(_shelf)}:${_selected ?? ''}',
- ),
- child: selected != null
- ? _ProductPage(
- key: ValueKey(
- 'store-page:${selected.id}',
- ),
- entry: selected,
- notifier: widget.notifier,
- recentHarnesses: widget.recentHarnesses,
- store: _store,
- )
- : _shelf is _Viewers
- ? StoreViewers(
- viewers: _shelved(const _Viewers()),
- agents:
- widget
- .notifier
- .localMachineState
- ?.dsh
- .entries ??
- const [],
- installedOn: (id) => _installedOn(id)
- .map(
- (machine) =>
- machine.machine.displayName,
- )
- .toList(),
- onOpenAgent: _openPage,
- loaded:
- widget
- .notifier
- .localMachineState
- ?.dsh
- .loaded ??
- false,
- )
- : _shelf is _Sessions
- ? StoreSessions(
- sessions: storeRecordedSessions(
- _shelved(const _Sessions()),
- ),
- onOpen: _openPage,
- )
- : _shelf is _Discover
- ? StoreDiscover(
- entries: _shelved(const _Discover()),
- loaded:
- widget
- .notifier
- .localMachineState
- ?.dsh
- .loaded ??
- false,
- ratingFor: (entry) => _store.ratingOf(
- StoreController.keyFor(entry),
- ),
- onOpen: _openPage,
- onCategory: (name) =>
- _show(_Category(name)),
- onAll: () => _show(const _All()),
- onEngines: () =>
- _show(const _Category('Coding')),
- essentialLabel: (id) =>
- widget.notifier
- .essential(id)
- ?.exists ==
- true
- ? 'Open'
- : 'Create',
- onEssential: (id) =>
- unawaited(_openEssential(id)),
- )
- : _Shelf$View(
- shelf: _shelf as _Listed,
- categories: _categories,
- onCategory: (name) =>
- _show(_Category(name)),
- entries: _shelved(_shelf),
- store: _store,
- installedOn: _installedOn,
- loaded:
- widget
- .notifier
- .localMachineState
- ?.dsh
- .loaded ??
- false,
- onOpen: _openPage,
- ),
- ),
- ),
- ),
- ],
+ children: [search, page],
),
),
],
@@ -616,8 +604,9 @@ class _StoreTabState extends State<StoreTab> {
// ─── the rail ────────────────────────────────────────────────────────────────
-class _StoreNav extends StatelessWidget {
- const _StoreNav({
+/// What the rail, or a phone's chip row, offers and which entry is open.
+class _Nav {
+ const _Nav({
required this.shelf,
required this.categories,
required this.selectedCategory,
@@ -635,10 +624,96 @@ class _StoreNav extends StatelessWidget {
final Map<String, int> counts;
final ValueChanged<_Shelf> onSelect;
+ /// Every shelf the Store offers, in order: the rail and a phone's chip row
+ /// both draw this list.
+ List<_ShelfChoice> get choices => [
+ _ShelfChoice(
+ id: 'discover',
+ kind: _ShelfKind.browse,
+ icon: AppIcons.sparkles,
+ label: 'Discover',
+ selected: !hasProduct && shelf is _Discover,
+ onTap: () => onSelect(const _Discover()),
+ ),
+ _ShelfChoice(
+ id: 'all',
+ kind: _ShelfKind.browse,
+ icon: AppIcons.layoutGrid,
+ label: 'All harnesses',
+ selected: !hasProduct && shelf is _All,
+ onTap: () => onSelect(const _All()),
+ ),
+ if (sessionCount > 0 || shelf is _Sessions)
+ _ShelfChoice(
+ id: 'sessions',
+ kind: _ShelfKind.browse,
+ icon: AppIcons.play,
+ label: 'Featured',
+ tooltip: '$sessionCount recorded runs',
+ selected: !hasProduct && shelf is _Sessions,
+ onTap: () => onSelect(const _Sessions()),
+ ),
+ for (final name in categories)
+ _ShelfChoice(
+ id: 'category:$name',
+ kind: _ShelfKind.discipline,
+ icon: _categoryIcon(name),
+ label: name,
+ tooltip: name,
+ count: counts[name],
+ selected: selectedCategory == name,
+ onTap: () => onSelect(_Category(name)),
+ ),
+ _ShelfChoice(
+ id: 'viewers',
+ kind: _ShelfKind.viewers,
+ icon: AppIcons.panelsTopLeft,
+ label: 'Viewers',
+ selected: shelf is _Viewers,
+ onTap: () => onSelect(const _Viewers()),
+ ),
+ ];
+}
+
+/// Where the rail puts a shelf: the browse entries, the disciplines under
+/// their heading, and Viewers at its foot.
+enum _ShelfKind { browse, discipline, viewers }
+
+class _ShelfChoice {
+ const _ShelfChoice({
+ required this.id,
+ required this.kind,
+ required this.icon,
+ required this.label,
+ required this.selected,
+ required this.onTap,
+ this.tooltip,
+ this.count,
+ });
+
+ /// Keys the rail's entry `store-shelf-<id>` and the chip `store-chip:<id>`.
+ final String id;
+ final _ShelfKind kind;
+ final IconData icon;
+ final String label;
+ final bool selected;
+ final VoidCallback onTap;
+ final String? tooltip;
+ final int? count;
+}
+
+class _StoreNav extends StatelessWidget {
+ const _StoreNav({required this.nav});
+
+ final _Nav nav;
+
@override
Widget build(BuildContext context) {
TerminalFontScope.watch(context);
- final shelf = this.shelf;
+ final choices = nav.choices;
+ Iterable<_ShelfChoice> of(_ShelfKind kind) =>
+ choices.where((choice) => choice.kind == kind);
+ final viewers = of(_ShelfKind.viewers).single;
final textScale = grid.appTextScaleOf(context).clamp(1.0, 1.5);
return Container(
width:
@@ -651,28 +726,14 @@ class _StoreNav extends StatelessWidget {
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 22),
children: [
- SidebarItem(
- key: const ValueKey('store-shelf-discover'),
- icon: AppIcons.sparkles,
- label: 'Discover',
- selected: !hasProduct && shelf is _Discover,
- onTap: () => onSelect(const _Discover()),
- ),
- SidebarItem(
- key: const ValueKey('store-shelf-all'),
- icon: AppIcons.layoutGrid,
- label: 'All harnesses',
- selected: !hasProduct && shelf is _All,
- onTap: () => onSelect(const _All()),
- ),
- if (sessionCount > 0 || shelf is _Sessions)
+ for (final choice in of(_ShelfKind.browse))
SidebarItem(
- key: const ValueKey('store-shelf-sessions'),
- icon: AppIcons.play,
- label: 'Featured',
- tooltip: '$sessionCount recorded runs',
- selected: !hasProduct && shelf is _Sessions,
- onTap: () => onSelect(const _Sessions()),
+ key: ValueKey('store-shelf-${choice.id}'),
+ icon: choice.icon,
+ label: choice.label,
+ tooltip: choice.tooltip,
+ selected: choice.selected,
+ onTap: choice.onTap,
),
const SizedBox(height: 22),
Padding(
@@ -685,13 +746,13 @@ class _StoreNav extends StatelessWidget {
),
),
),
- for (final name in categories)
+ for (final choice in of(_ShelfKind.discipline))
SidebarItem(
- key: ValueKey('store-shelf-category:$name'),
- icon: _categoryIcon(name),
- label: name,
- tooltip: name,
- selected: selectedCategory == name,
+ key: ValueKey('store-shelf-${choice.id}'),
+ icon: choice.icon,
+ label: choice.label,
+ tooltip: choice.tooltip,
+ selected: choice.selected,
trailingAlwaysVisible: true,
trailingWidth: 22,
trailing: textScale > 1.2
@@ -699,13 +760,13 @@ class _StoreNav extends StatelessWidget {
: Align(
alignment: Alignment.centerRight,
child: Text(
- '${counts[name]}',
+ '${choice.count}',
style: grid.AppType.caption(
color: grid.AppPalette.textFaint,
),
),
),
- onTap: () => onSelect(_Category(name)),
+ onTap: choice.onTap,
),
],
),
@@ -716,13 +777,13 @@ class _StoreNav extends StatelessWidget {
alignment: Alignment.centerLeft,
child: AppIconButton(
key: const ValueKey('store-viewers-button'),
- icon: AppIcons.panelsTopLeft,
+ icon: viewers.icon,
size: 17,
- color: shelf is _Viewers
+ color: viewers.selected
? grid.AppPalette.textPrimary
: grid.AppPalette.textFaint,
- tooltip: 'Viewers',
- onPressed: () => onSelect(const _Viewers()),
+ tooltip: viewers.label,
+ onPressed: viewers.onTap,
),
),
),
@@ -732,6 +793,28 @@ class _StoreNav extends StatelessWidget {
}
}
+/// The rail as a row of chips above the content, for a phone.
+class _StoreChips extends StatelessWidget {
+ const _StoreChips({required this.nav});
+
+ final _Nav nav;
+
+ @override
+ Widget build(BuildContext context) => StoreChipRow(
+ chips: [
+ for (final choice in nav.choices)
+ StoreChip(
+ id: choice.id,
+ icon: choice.icon,
+ label: choice.label,
+ count: choice.count,
+ selected: choice.selected,
+ onTap: choice.onTap,
+ ),
+ ],
+ );
+}
+
IconData _categoryIcon(String category) => switch (category) {
'Design' => AppIcons.box,
'Engineering' => AppIcons.cpu,
@@ -823,6 +906,8 @@ class _Shelf$View extends StatelessWidget {
child: Text(
shelf is _Search
? 'No matching harnesses. Try a name or something you want to make.'
+ : storeRunsNoHarness(context)
+ ? kStoreOnAComputer
: loaded
? 'Nothing here yet.'
: 'Asking this computer…',
@@ -1482,7 +1567,9 @@ class _ProductPageState extends State<_ProductPage> {
Center(
child: local == null
? Text(
- 'Connecting to this computer…',
+ storeRunsNoHarness(context)
+ ? 'Get it in the Harness app on a computer.'
+ : 'Connecting to this computer…',
style: grid.AppType.body(
color: grid.AppPalette.textFaint,
),
@@ -1800,6 +1887,13 @@ class _QuietLinkState extends State<_QuietLink> {
),
);
if (tap == null) return content;
+ if (storeIsCompact(context)) {
+ return StoreHitArea(
+ onTap: tap,
+ onHover: (hovering) => setState(() => _hovering = hovering),
+ child: content,
+ );
+ }
return MouseRegion(
cursor: SystemMouseCursors.click,
onEnter: (_) => setState(() => _hovering = true),
diff --git a/desktop/lib/store/store_search.dart b/desktop/lib/store/store_search.dart
index 76ceac258..1cc0522f2 100644
--- a/desktop/lib/store/store_search.dart
+++ b/desktop/lib/store/store_search.dart
@@ -9,11 +9,19 @@ import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_icon_button.dart';
import '../shortcuts/app_keymap.dart';
+import 'store_compact_nav.dart';
/// Where "Create harness" goes: the ten-minute guide to a first DSH.
const kCreateHarnessGuide =
'https://github.com/autonomous-ai/openharness#your-first-dsh-in-ten-minutes';
+void _openCreateHarnessGuide() => unawaited(
+ launchUrl(
+ Uri.parse(kCreateHarnessGuide),
+ mode: LaunchMode.externalApplication,
+ ),
+);
+
/// The Store's toolbar, laid out like Safari's: history on the left, a compact
/// search field centred on the pane, and the way to make your own on the right.
///
@@ -29,6 +37,7 @@ class StoreSearch extends StatelessWidget {
required this.onClear,
required this.onBack,
required this.onForward,
+ this.compact = false,
});
final TextEditingController controller;
@@ -39,6 +48,10 @@ class StoreSearch extends StatelessWidget {
final VoidCallback? onBack;
final VoidCallback? onForward;
+ /// A phone's toolbar: each button answers a finger across [kStoreMinHit],
+ /// while the controls keep the size they are drawn at.
+ final bool compact;
+
@override
Widget build(BuildContext context) {
return LayoutBuilder(
@@ -49,6 +62,13 @@ class StoreSearch extends StatelessWidget {
grid.AppControl.height,
MediaQuery.textScalerOf(context).scale(grid.AppType.bodySize) + 18,
);
+ final field = _Field(
+ controller: controller,
+ focusNode: focusNode,
+ onChanged: onChanged,
+ autofocus: autofocus,
+ onClear: onClear,
+ );
return Container(
key: const ValueKey('store-search-header'),
color: grid.AppPalette.windowBg,
@@ -57,29 +77,32 @@ class StoreSearch extends StatelessWidget {
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 1440),
child: SizedBox(
- height: height,
+ height: compact ? math.max(height, kStoreMinHit) : height,
child: CustomMultiChildLayout(
delegate: _ToolbarLayout(),
children: [
LayoutId(
id: _Slot.history,
- child: _History(onBack: onBack, onForward: onForward),
+ child: _History(
+ onBack: onBack,
+ onForward: onForward,
+ compact: compact,
+ ),
),
LayoutId(
id: _Slot.search,
- child: _Field(
- controller: controller,
- focusNode: focusNode,
- onChanged: onChanged,
- autofocus: autofocus,
- onClear: onClear,
- ),
+ child: compact
+ ? Center(
+ child: SizedBox(height: height, child: field),
+ )
+ : field,
),
LayoutId(
id: _Slot.create,
child: _CreateHarness(
height: height,
labelled: box.maxWidth >= 520,
+ compact: compact,
),
),
],
@@ -134,27 +157,36 @@ class _ToolbarLayout extends MultiChildLayoutDelegate {
/// Back and forward in one capsule, split by a hairline, as Safari draws them.
class _History extends StatelessWidget {
- const _History({required this.onBack, required this.onForward});
+ const _History({
+ required this.onBack,
+ required this.onForward,
+ required this.compact,
+ });
final VoidCallback? onBack;
final VoidCallback? onForward;
+ /// Each button inside a [StoreHitArea] taller than the capsule drawn
+ /// behind them.
+ final bool compact;
+
@override
Widget build(BuildContext context) {
TerminalFontScope.watch(context);
final back = effectiveCommandHint(context, 'navigation.back');
final forward = effectiveCommandHint(context, 'navigation.forward');
- return Container(
- height: grid.AppControl.height,
- padding: const EdgeInsets.symmetric(horizontal: 4),
- decoration: BoxDecoration(
- color: grid.AppSurface.recess,
- border: Border.all(color: grid.AppPalette.divider),
- borderRadius: BorderRadius.circular(grid.AppControl.radius),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
+ Widget button(String id, Widget control, VoidCallback? onPressed) => compact
+ ? StoreHitArea(
+ key: ValueKey('store-$id-hit'),
+ onTap: onPressed,
+ child: control,
+ )
+ : control;
+ final buttons = Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ button(
+ 'back',
AppIconButton(
key: const ValueKey('store-back'),
icon: AppIcons.chevronLeft,
@@ -162,12 +194,16 @@ class _History extends StatelessWidget {
onPressed: onBack,
size: 17,
),
- Container(
- width: 1,
- height: 14,
- margin: const EdgeInsets.symmetric(horizontal: 3),
- color: grid.AppPalette.divider,
- ),
+ onBack,
+ ),
+ Container(
+ width: 1,
+ height: 14,
+ margin: const EdgeInsets.symmetric(horizontal: 3),
+ color: grid.AppPalette.divider,
+ ),
+ button(
+ 'forward',
AppIconButton(
key: const ValueKey('store-nav-forward'),
icon: AppIcons.chevronRight,
@@ -175,8 +211,36 @@ class _History extends StatelessWidget {
onPressed: onForward,
size: 17,
),
- ],
- ),
+ onForward,
+ ),
+ ],
+ );
+ final capsule = BoxDecoration(
+ color: grid.AppSurface.recess,
+ border: Border.all(color: grid.AppPalette.divider),
+ borderRadius: BorderRadius.circular(grid.AppControl.radius),
+ );
+ if (!compact) {
+ return Container(
+ height: grid.AppControl.height,
+ padding: const EdgeInsets.symmetric(horizontal: 4),
+ decoration: capsule,
+ child: buttons,
+ );
+ }
+ return Stack(
+ alignment: Alignment.center,
+ children: [
+ Positioned.fill(
+ child: Center(
+ child: Container(
+ height: grid.AppControl.height,
+ decoration: capsule,
+ ),
+ ),
+ ),
+ buttons,
+ ],
);
}
}
@@ -307,25 +371,27 @@ class _Field extends StatelessWidget {
/// action (Resume Harness, New Harness), so it reads before the chrome around
/// it. It opens the guide in the browser; the tooltip says so.
class _CreateHarness extends StatelessWidget {
- const _CreateHarness({required this.height, required this.labelled});
+ const _CreateHarness({
+ required this.height,
+ required this.labelled,
+ required this.compact,
+ });
final double height;
/// Too narrow a pane keeps a plus alone, with the words in its tooltip.
final bool labelled;
+ /// Inside a [StoreHitArea], for a finger.
+ final bool compact;
+
@override
Widget build(BuildContext context) {
- return Tooltip(
+ final button = Tooltip(
message: 'Your first harness in ten minutes, on GitHub',
child: FilledButton(
key: const ValueKey('store-create-harness'),
- onPressed: () => unawaited(
- launchUrl(
- Uri.parse(kCreateHarnessGuide),
- mode: LaunchMode.externalApplication,
- ),
- ),
+ onPressed: _openCreateHarnessGuide,
style: FilledButton.styleFrom(
minimumSize: Size(height, height),
padding: EdgeInsets.symmetric(horizontal: labelled ? 14 : 0),
@@ -341,5 +407,11 @@ class _CreateHarness extends StatelessWidget {
: const Icon(AppIcons.plus, size: 16),
),
);
+ if (!compact) return button;
+ return StoreHitArea(
+ key: const ValueKey('store-create-hit'),
+ onTap: _openCreateHarnessGuide,
+ child: button,
+ );
}
}
diff --git a/desktop/lib/store/store_viewers.dart b/desktop/lib/store/store_viewers.dart
index 1e999a05e..9ae3c9199 100644
--- a/desktop/lib/store/store_viewers.dart
+++ b/desktop/lib/store/store_viewers.dart
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import '../core/dsh_catalog.dart';
import '../shared/theme/app_theme.dart' as grid;
+import 'store_host.dart';
/// Shared packages are inspected here, separately from browsing harnesses.
class StoreViewers extends StatelessWidget {
@@ -39,7 +40,9 @@ class StoreViewers extends StatelessWidget {
const SizedBox(height: 24),
if (viewers.isEmpty)
Text(
- loaded
+ storeRunsNoHarness(context)
+ ? kStoreOnAComputer
+ : loaded
? 'No viewers reported by this computer.'
: 'Asking this computer…',
style: TextStyle(color: grid.AppPalette.textSecondary),
diff --git a/desktop/test/store_compact_test.dart b/desktop/test/store_compact_test.dart
new file mode 100644
index 000000000..fd21b36f9
--- /dev/null
+++ b/desktop/test/store_compact_test.dart
@@ -0,0 +1,579 @@
+// The Store on a phone (audit finding B1): below the web chrome's compactBelow
+// its rail becomes a row of chips above full-width content, the row scrolls
+// with a mouse wheel and fades where chips are hidden, and every Store control
+// keeps a 44 px hit area. Desktop, which has no chrome, keeps its rail at any
+// window width, and so does the web at tablet width. In a browser, which runs
+// no harness, the Store never says "this computer" (finding P3).
+import 'package:flutter/gestures.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/auth/auth_session.dart';
+import 'package:harness/core/config.dart';
+import 'package:harness/core/dsh_catalog.dart';
+import 'package:harness/core/models.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/state/app_state.dart';
+import 'package:harness/state/workspace_chrome.dart';
+import 'package:harness/shared/widgets/skeleton.dart';
+import 'package:harness/store/store_category.dart';
+import 'package:harness/store/store_controller.dart';
+import 'package:harness/store/store_discover.dart';
+import 'package:harness/store/store_models.dart';
+import 'package:harness/store/store_screen.dart';
+import 'package:harness/web/shell/web_chrome.dart';
+
+final _catalog = [
+ for (final (id, name, category) in [
+ ('blender', 'Blender', '3D'),
+ ('autonomous-circuit', 'Autonomous Circuit', 'PCB'),
+ ('phaser', 'Phaser', 'Games'),
+ ('strudel', 'Strudel', 'Music'),
+ ('mujoco', 'MuJoCo', 'Simulation'),
+ ('marp', 'Marp', 'Slides'),
+ ('manim', 'Manim', 'Math animation'),
+ ('marimo', 'marimo', 'Notebooks'),
+ ('ollama', 'Ollama', 'Local AI'),
+ ])
+ DshEntry(
+ id: 'autonomous/$id',
+ name: name,
+ engine: 'claude',
+ category: category,
+ ),
+];
+
+class _App extends AppNotifier {
+ _App()
+ : super(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ );
+
+ @override
+ Future<void> probeDsh(
+ String machineId, {
+ bool force = false,
+ bool userAction = false,
+ }) async {}
+
+ @override
+ Future<void> probeEngines(String machineId, {bool force = false}) async {}
+}
+
+class _Api implements StoreApi {
+ @override
+ Future<List<StoreRating>> ratings() async => const [];
+
+ @override
+ Future<StoreReviews> reviews(String harnessId) async => StoreReviews(
+ rating: StoreRating.none(harnessId),
+ reviews: const [],
+ mine: null,
+ );
+
+ @override
+ Future<void> deleteReview(String harnessId) async {}
+
+ @override
+ Future<StoreReview> putReview(
+ String harnessId, {
+ required int rating,
+ String? title,
+ String? body,
+ }) => throw UnimplementedError();
+}
+
+/// The Store at [size], inside the web's workspace chrome when [web], else
+/// with none, as on Desktop. [local] gives it a computer with the catalogue;
+/// a browser has none.
+Future<void> _open(
+ WidgetTester tester, {
+ required Size size,
+ required bool web,
+ bool local = true,
+ String? initialHarness,
+}) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = size;
+ addTearDown(tester.view.reset);
+ final app = _App();
+ addTearDown(app.dispose);
+ if (local) {
+ final machine =
+ MachineState(
+ const Machine(
+ machineId: 'local',
+ authMode: MachineAuthMode.remote,
+ name: 'Studio',
+ ),
+ )
+ ..localOnly = true
+ ..nodeOnline = true;
+ machine.dsh.replace(_catalog);
+ app.machineStates['local'] = machine;
+ }
+ final store = StoreTab(
+ notifier: app,
+ api: _Api(),
+ initialHarness: initialHarness,
+ );
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ home: Scaffold(
+ body: web
+ ? WorkspaceChromeScope(
+ chrome: webWorkspaceChrome(app),
+ child: store,
+ )
+ : store,
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+}
+
+const _phone = Size(390, 844);
+const _smallPhone = Size(360, 740);
+
+/// Narrower than any real Desktop window (its minimum is 880) and than the
+/// web's 720 px phone threshold, so a layout keyed on width would go compact.
+const _narrowDesktop = Size(700, 560);
+
+final _rail = find.byKey(const ValueKey('store-shelf-discover'));
+final _chips = find.byKey(const ValueKey('store-chips'));
+Finder _chip(String id) => find.byKey(ValueKey('store-chip:$id'));
+
+ScrollPosition _chipScroll(WidgetTester tester) => tester
+ .state<ScrollableState>(
+ find.descendant(of: _chips, matching: find.byType(Scrollable)),
+ )
+ .position;
+
+const _onAComputer = 'Open the Harness app on a computer to see these.';
+
+/// One of the Store's pages on its own, inside the web's chrome when [web],
+/// else with none, as on Desktop.
+Future<void> _mount(
+ WidgetTester tester, {
+ required bool web,
+ required Widget page,
+}) async {
+ final app = _App();
+ addTearDown(app.dispose);
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: web
+ ? WorkspaceChromeScope(chrome: webWorkspaceChrome(app), child: page)
+ : page,
+ ),
+ ),
+ );
+ await tester.pump();
+}
+
+/// An empty discipline, before ([loaded] false) or after a computer answered.
+Future<void> _openEmptyDiscipline(
+ WidgetTester tester, {
+ required bool web,
+ required bool loaded,
+}) => _mount(
+ tester,
+ web: web,
+ page: StoreCategory(
+ name: 'Music',
+ categories: const ['Music'],
+ onCategory: (_) {},
+ entries: const [],
+ loaded: loaded,
+ ratingFor: (entry) => StoreRating.none(entry.id),
+ installed: (_) => false,
+ onOpen: (_) {},
+ ),
+);
+
+/// Discover with only the built-in engines, as a browser has it, while no
+/// computer has answered.
+Future<void> _openEnginesOnlyDiscover(
+ WidgetTester tester, {
+ required bool web,
+}) => _mount(
+ tester,
+ web: web,
+ page: StoreDiscover(
+ entries: [
+ for (final id in ['claude', 'codex'])
+ DshEntry(id: id, name: id, engine: id, kind: 'engine'),
+ ],
+ loaded: false,
+ ratingFor: (entry) => StoreRating.none(entry.id),
+ onOpen: (_) {},
+ onCategory: (_) {},
+ onAll: () {},
+ onEngines: () {},
+ ),
+);
+
+/// [chip] lies wholly inside the screen's width, clear of the row's fades.
+void _expectFullyShown(WidgetTester tester, Finder chip) {
+ final rect = tester.getRect(chip);
+ final width = tester.view.physicalSize.width / tester.view.devicePixelRatio;
+ expect(rect.left, greaterThanOrEqualTo(0), reason: '$chip');
+ expect(rect.right, lessThanOrEqualTo(width), reason: '$chip');
+}
+
+void _expectHitArea(WidgetTester tester, Finder target) {
+ final rect = tester.getSemantics(target).rect;
+ expect(rect.width, greaterThanOrEqualTo(44), reason: '$target');
+ expect(rect.height, greaterThanOrEqualTo(44), reason: '$target');
+}
+
+final _thisComputer = find.textContaining(
+ RegExp('this computer', caseSensitive: false),
+);
+
+void main() {
+ testWidgets('on a phone the Store trades its rail for chips above full-width '
+ 'content', (tester) async {
+ await _open(tester, size: _phone, web: true);
+
+ expect(_rail, findsNothing);
+ expect(_chips, findsOneWidget);
+ expect(tester.getSize(find.byType(StoreDiscover)).width, _phone.width);
+ expect(
+ tester.getTopLeft(find.byType(StoreDiscover)).dy,
+ greaterThanOrEqualTo(tester.getBottomLeft(_chips).dy),
+ );
+ for (final id in ['discover', 'all', 'category:Design', 'viewers']) {
+ expect(_chip(id), findsOneWidget, reason: id);
+ }
+ expect(
+ tester.getSemantics(_chip('discover')),
+ isSemantics(isSelected: true, isButton: true),
+ );
+
+ await tester.tap(_chip('all'));
+ await tester.pumpAndSettle();
+
+ expect(
+ find.text('Find something you have always wanted to make.'),
+ findsOneWidget,
+ );
+ expect(tester.getSemantics(_chip('all')), isSemantics(isSelected: true));
+ expect(
+ tester.getSemantics(_chip('discover')),
+ isSemantics(isSelected: false),
+ );
+ });
+
+ testWidgets('a product page on a phone selects its discipline chip and '
+ 'takes the full width', (tester) async {
+ await _open(
+ tester,
+ size: _smallPhone,
+ web: true,
+ initialHarness: 'autonomous/strudel',
+ );
+
+ expect(_rail, findsNothing);
+ expect(
+ tester.getSemantics(_chip('category:Music')),
+ isSemantics(isSelected: true),
+ );
+ final page = find.byKey(const ValueKey('store-page:autonomous/strudel'));
+ expect(tester.getSize(page).width, _smallPhone.width);
+ });
+
+ testWidgets('a product page in a discipline past the edge scrolls its chip '
+ 'into view', (tester) async {
+ await _open(
+ tester,
+ size: _smallPhone,
+ web: true,
+ initialHarness: 'autonomous/ollama',
+ );
+ final chip = _chip('category:Local AI');
+
+ expect(tester.getSemantics(chip), isSemantics(isSelected: true));
+ _expectFullyShown(tester, chip);
+ });
+
+ testWidgets('going back to a shelf past the edge scrolls its chip into '
+ 'view', (tester) async {
+ await _open(
+ tester,
+ size: _smallPhone,
+ web: true,
+ initialHarness: 'autonomous/ollama',
+ );
+ final mouse = TestPointer(1, PointerDeviceKind.mouse);
+ await tester.sendEventToBinding(mouse.hover(tester.getCenter(_chips)));
+ await tester.sendEventToBinding(mouse.scroll(const Offset(0, 5000)));
+ await tester.pumpAndSettle();
+ expect(tester.getRect(_chip('discover')).right, lessThan(0));
+
+ await tester.tap(find.byKey(const ValueKey('store-back-hit')));
+ await tester.pumpAndSettle();
+
+ expect(
+ tester.getSemantics(_chip('discover')),
+ isSemantics(isSelected: true),
+ );
+ _expectFullyShown(tester, _chip('discover'));
+ });
+
+ testWidgets('the chips offer the rail\'s shelves, in the rail\'s order', (
+ tester,
+ ) async {
+ await _open(tester, size: const Size(1440, 900), web: true);
+ final rail = [
+ for (final element
+ in find
+ .byWidgetPredicate(
+ (widget) =>
+ widget.key is ValueKey<String> &&
+ ((widget.key! as ValueKey<String>).value.startsWith(
+ 'store-shelf-',
+ ) ||
+ (widget.key! as ValueKey<String>).value ==
+ 'store-viewers-button'),
+ )
+ .evaluate())
+ (element.widget.key! as ValueKey<String>).value
+ .replaceFirst('store-shelf-', '')
+ .replaceFirst('store-viewers-button', 'viewers'),
+ ];
+
+ await _open(tester, size: _phone, web: true);
+ final chips = [
+ for (final element
+ in find
+ .byWidgetPredicate(
+ (widget) =>
+ widget.key is ValueKey<String> &&
+ (widget.key! as ValueKey<String>).value.startsWith(
+ 'store-chip:',
+ ),
+ )
+ .evaluate())
+ (element.widget.key! as ValueKey<String>).value.replaceFirst(
+ 'store-chip:',
+ '',
+ ),
+ ];
+
+ expect(rail, [
+ 'discover',
+ 'all',
+ for (final name in [
+ 'Coding',
+ 'Design',
+ 'Engineering',
+ 'Media',
+ 'Music',
+ 'Productivity',
+ 'Science & Data',
+ 'Simulation',
+ 'Games',
+ 'Local AI',
+ ])
+ 'category:$name',
+ 'viewers',
+ ]);
+ expect(chips, rail);
+ });
+
+ testWidgets('Desktop keeps its rail in a window narrower than the web\'s '
+ 'phone layout', (tester) async {
+ await _open(tester, size: _narrowDesktop, web: false);
+
+ expect(_rail, findsOneWidget);
+ expect(_chips, findsNothing);
+ });
+
+ testWidgets('the web keeps the rail at tablet width', (tester) async {
+ await _open(tester, size: const Size(768, 1024), web: true);
+
+ expect(_rail, findsOneWidget);
+ expect(_chips, findsNothing);
+ });
+
+ testWidgets('a mouse wheel scrolls the chip row sideways, and its edges '
+ 'fade only where chips are hidden', (tester) async {
+ await _open(tester, size: _smallPhone, web: true);
+ final start = find.byKey(const ValueKey('store-chips-fade-start'));
+ final end = find.byKey(const ValueKey('store-chips-fade-end'));
+
+ expect(_chipScroll(tester).pixels, 0);
+ expect(_chipScroll(tester).maxScrollExtent, greaterThan(0));
+ expect(start, findsNothing);
+ expect(end, findsOneWidget);
+
+ final mouse = TestPointer(1, PointerDeviceKind.mouse);
+ await tester.sendEventToBinding(mouse.hover(tester.getCenter(_chips)));
+ await tester.sendEventToBinding(mouse.scroll(const Offset(0, 120)));
+ await tester.pumpAndSettle();
+
+ expect(_chipScroll(tester).pixels, 120);
+ expect(start, findsOneWidget);
+
+ await tester.sendEventToBinding(mouse.scroll(const Offset(0, 5000)));
+ await tester.pumpAndSettle();
+
+ expect(_chipScroll(tester).pixels, _chipScroll(tester).maxScrollExtent);
+ expect(end, findsNothing);
+ });
+
+ testWidgets('on a phone every chip and toolbar button has a 44 px hit area', (
+ tester,
+ ) async {
+ await _open(tester, size: _phone, web: true);
+
+ for (final target in [
+ _chip('discover'),
+ _chip('all'),
+ find.byKey(const ValueKey('store-back-hit')),
+ find.byKey(const ValueKey('store-forward-hit')),
+ find.byKey(const ValueKey('store-create-hit')),
+ ]) {
+ _expectHitArea(tester, target);
+ }
+ });
+
+ testWidgets('on a phone a heading\'s text button has a 44 px hit area', (
+ tester,
+ ) async {
+ await _open(tester, size: _phone, web: true);
+ final engines = find.text('All coding agents');
+ await tester.ensureVisible(engines);
+
+ _expectHitArea(tester, engines);
+ });
+
+ testWidgets('on a phone a product page\'s links have a 44 px hit area', (
+ tester,
+ ) async {
+ await _open(tester, size: _phone, web: true, initialHarness: 'claude');
+
+ _expectHitArea(tester, find.text('Website'));
+ });
+
+ testWidgets('Desktop keeps its text links as they are', (tester) async {
+ await _open(
+ tester,
+ size: _narrowDesktop,
+ web: false,
+ initialHarness: 'claude',
+ );
+
+ expect(tester.getSemantics(find.text('Website')).rect.height, lessThan(44));
+ });
+
+ testWidgets('the outer edge of a phone Back hit area goes back', (
+ tester,
+ ) async {
+ await _open(tester, size: _phone, web: true);
+ await tester.tap(_chip('all'));
+ await tester.pumpAndSettle();
+
+ await tester.tapAt(
+ tester.getTopLeft(find.byKey(const ValueKey('store-back-hit'))) +
+ const Offset(2, 2),
+ );
+ await tester.pumpAndSettle();
+
+ expect(
+ tester.getSemantics(_chip('discover')),
+ isSemantics(isSelected: true),
+ );
+ });
+
+ testWidgets('Desktop keeps its toolbar buttons as they are', (tester) async {
+ await _open(tester, size: _narrowDesktop, web: false);
+
+ expect(find.byKey(const ValueKey('store-back-hit')), findsNothing);
+ expect(tester.getSize(find.byKey(const ValueKey('store-back'))).height, 30);
+ });
+
+ testWidgets('in a browser the Viewers shelf does not name this computer', (
+ tester,
+ ) async {
+ await _open(tester, size: const Size(1440, 900), web: true, local: false);
+ await tester.tap(find.byKey(const ValueKey('store-viewers-button')));
+ await tester.pumpAndSettle();
+
+ expect(_thisComputer, findsNothing);
+ expect(find.text(_onAComputer), findsOneWidget);
+ });
+
+ testWidgets('in a browser a product page says where to get it, not that it '
+ 'is connecting to this computer', (tester) async {
+ await _open(
+ tester,
+ size: const Size(1440, 900),
+ web: true,
+ local: false,
+ initialHarness: 'claude',
+ );
+
+ expect(_thisComputer, findsNothing);
+ expect(
+ find.text('Get it in the Harness app on a computer.'),
+ findsOneWidget,
+ );
+ });
+
+ testWidgets('in a browser an empty discipline says where its harnesses are, '
+ 'instead of waiting on a computer', (tester) async {
+ await _openEmptyDiscipline(tester, web: true, loaded: false);
+
+ expect(_thisComputer, findsNothing);
+ expect(find.text(_onAComputer), findsOneWidget);
+ expect(find.byType(SkeletonBlock), findsNothing);
+ });
+
+ testWidgets('on Desktop an empty discipline waits for this computer, then '
+ 'says nothing is here', (tester) async {
+ await _openEmptyDiscipline(tester, web: false, loaded: false);
+ expect(find.text('Asking this computer…'), findsOneWidget);
+
+ await _openEmptyDiscipline(tester, web: false, loaded: true);
+ expect(find.text('Nothing here yet.'), findsOneWidget);
+ });
+
+ testWidgets('in a browser Discover does not wait on a computer', (
+ tester,
+ ) async {
+ await _openEnginesOnlyDiscover(tester, web: true);
+
+ expect(find.byType(SkeletonBlock), findsNothing);
+ expect(
+ find.text('Open the Harness app on a computer to see more harnesses.'),
+ findsOneWidget,
+ );
+ });
+
+ testWidgets('Desktop Discover still waits for this computer', (tester) async {
+ await _openEnginesOnlyDiscover(tester, web: false);
+
+ expect(find.byType(SkeletonBlock), findsOneWidget);
+ expect(find.text(_onAComputer), findsNothing);
+ });
+
+ testWidgets('Desktop still says it is connecting to this computer', (
+ tester,
+ ) async {
+ await _open(
+ tester,
+ size: const Size(1440, 900),
+ web: false,
+ local: false,
+ initialHarness: 'claude',
+ );
+
+ expect(find.text('Connecting to this computer…'), findsOneWidget);
+ });
+}
diff --git a/desktop/tool/web_ux/flows/store.mjs b/desktop/tool/web_ux/flows/store.mjs
index 37dd8d62c..08c2e93d6 100644
--- a/desktop/tool/web_ux/flows/store.mjs
+++ b/desktop/tool/web_ux/flows/store.mjs
@@ -7,6 +7,10 @@ const toStore = {
compact: [['exact', 'Menu'], ['exact', 'Store']],
};
const claude = ['text', 'Work with Claude directly'];
+// The rail's entry on a computer and a tablet, its chip on a phone.
+const allHarnesses = ['exact', 'All harnesses'];
+// A shelf a browser has no computer to fill: it says where to see it.
+const viewers = ['exact', 'Viewers'];
export const FLOWS = [
{ name: 'store', scenario: 'workspace', ...toStore },
@@ -16,4 +20,16 @@ export const FLOWS = [
wide: [...toStore.wide, claude],
compact: [...toStore.compact, claude],
},
+ {
+ name: 'store-all',
+ scenario: 'workspace',
+ wide: [...toStore.wide, allHarnesses],
+ compact: [...toStore.compact, allHarnesses],
+ },
+ {
+ name: 'store-viewers',
+ scenario: 'workspace',
+ wide: [...toStore.wide, viewers],
+ compact: [...toStore.compact, viewers],
+ },
];