Files
pipelines/app/lib/features/settings/settings_phone_order.dart
T
alan 545291e04a App: run failure reasons, Run again, labelled tabs, actionable errors, nav fixes
- Run rows show a failed run's reason (else its diagnostic's first line,
  full text in a tooltip) or a short result preview; the Summary leads
  with "Why it failed".
- Run again for succeeded/canceled/interrupted runs opens the New run form
  pre-filled (prompt, workspace, report format) at the latest version with
  the original offered.
- Run detail and stage tabs show their names; touch shows captions on the
  Runs header and artifact viewer actions (desktop keeps tooltips).
- ErrorNotice maps not connected / server too old / permission / timeout
  to what to do, raw detail behind Details (Schedules, create chat, Runs,
  Pipelines banners).
- Settings has no Back arrow; Schedules keeps the rail on wide windows;
  phone Settings leads with Connection and Notifications and has a
  Jump to topic menu.
- Walkthrough: Open Connection (skipped when connected), labelled Copy.
- Pluralised counts; no duplicate status/rail names for screen readers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 20:16:22 +00:00

60 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'settings_section.dart';
/// The sections a phone shows first, in this order: how to reach the server
/// (Connection, Servers, Sign in) and then how it reaches you (the
/// notification sections). The rest keep their order after them.
const settingsPhoneFirstIds = [
'managed-connection',
'connection',
'servers',
'sign-in',
'notifications',
'device-delivery',
'phone-notifications',
];
/// [sections] reordered for a phone: [settingsPhoneFirstIds] first.
List<SettingsSection> settingsPhoneOrder(List<SettingsSection> sections) {
int rank(SettingsSection section) {
final index = settingsPhoneFirstIds.indexOf(section.id);
return index < 0 ? settingsPhoneFirstIds.length : index;
}
final indexed = sections.indexed.toList()
..sort((a, b) {
final byRank = rank(a.$2).compareTo(rank(b.$2));
return byRank != 0 ? byRank : a.$1.compareTo(b.$1);
});
return [for (final (_, section) in indexed) section];
}
const settingsTopicMenuKey = ValueKey<String>('settings.topics');
/// The phone's "Jump to topic" menu beside the search field: every shown
/// section by title; picking one scrolls to it (the wide layout has an index
/// column instead).
class SettingsTopicMenu extends StatelessWidget {
const SettingsTopicMenu({
super.key,
required this.sections,
required this.onJump,
});
final List<SettingsSection> sections;
final ValueChanged<String> onJump;
@override
Widget build(BuildContext context) => PopupMenuButton<String>(
key: settingsTopicMenuKey,
tooltip: 'Jump to topic',
icon: const Icon(Icons.toc),
onSelected: onJump,
itemBuilder: (_) => [
for (final section in sections)
PopupMenuItem(value: section.id, child: Text(section.title)),
],
);
}