Add Coach, take the reference's colours and copy its nav and motion
Coach is the centre tab: questions about routines, slips, streak, today, active time and debt, answered on the device from the user's own data, with a target bar chart and buttons that start routines or open the right screen. The palette moves to neutral grey, near-black and one orange accent, and Home's header becomes a light panel. The nav is now overlapping frosted circles whose active disc pops forward, and tabs fade and rise in on switch. Goals leaves the nav for Coach and stays one tap away in Home's category row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KhQh614DMeYoQEH9SoMRUw
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import 'CoachActionKind.dart';
|
||||
|
||||
class CoachAction {
|
||||
String label;
|
||||
|
||||
CoachActionKind kind;
|
||||
|
||||
/// For [CoachActionKind.StartRoutine].
|
||||
String routineId;
|
||||
|
||||
/// For [CoachActionKind.Ask].
|
||||
String question;
|
||||
|
||||
/// The filled button; the rest are outlined.
|
||||
bool primary;
|
||||
|
||||
CoachAction({
|
||||
required this.label,
|
||||
required this.kind,
|
||||
this.routineId = "",
|
||||
this.question = "",
|
||||
this.primary = false,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/// What a button under a coach answer does. Every action does something real
|
||||
/// in the app; the coach never offers a button that only talks.
|
||||
enum CoachActionKind {
|
||||
/// Run a routine now.
|
||||
StartRoutine,
|
||||
|
||||
/// Open the overdue queue.
|
||||
OpenOverdue,
|
||||
|
||||
/// Open the Targets & reminders setup.
|
||||
OpenTargets,
|
||||
|
||||
/// Open the progress screen.
|
||||
OpenProgress,
|
||||
|
||||
/// Ask a follow-up question.
|
||||
Ask,
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/// A small bar chart inside a coach answer: one bar per day against a dashed
|
||||
/// target outline.
|
||||
class CoachChart {
|
||||
/// "Target · 3 a day"
|
||||
String title;
|
||||
|
||||
List<String> labels;
|
||||
|
||||
List<double> values;
|
||||
|
||||
/// Per-bar target; the dashed outline is drawn to this height.
|
||||
List<double> targets;
|
||||
|
||||
/// A bar to call out with [callout] above it, or -1.
|
||||
int highlight;
|
||||
|
||||
String callout;
|
||||
|
||||
/// Bars after this index have not happened yet (today and beyond).
|
||||
int lastComplete;
|
||||
|
||||
CoachChart({
|
||||
required this.title,
|
||||
required this.labels,
|
||||
required this.values,
|
||||
required this.targets,
|
||||
this.highlight = -1,
|
||||
this.callout = "",
|
||||
int? lastComplete,
|
||||
}) : lastComplete = lastComplete ?? labels.length - 1;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import '../../external/data/Commitment.dart';
|
||||
import '../../external/data/RoutineChain.dart';
|
||||
import 'ProgressTargets.dart';
|
||||
import 'RoutineRunRecord.dart';
|
||||
|
||||
/// Everything the coach may answer from. Nothing outside this is used, so
|
||||
/// every answer is traceable to the user's own data.
|
||||
class CoachContext {
|
||||
List<RoutineRunRecord> runs;
|
||||
|
||||
List<RoutineChain> routines;
|
||||
|
||||
ProgressTargets targets;
|
||||
|
||||
List<Commitment> plan;
|
||||
|
||||
List<Commitment> overdue;
|
||||
|
||||
double debtScore;
|
||||
|
||||
CoachContext({
|
||||
required this.runs,
|
||||
required this.routines,
|
||||
required this.targets,
|
||||
required this.plan,
|
||||
required this.overdue,
|
||||
required this.debtScore,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'CoachAction.dart';
|
||||
import 'CoachChart.dart';
|
||||
|
||||
/// One turn in the coach thread. Answers carry **bold** markup in [body] and
|
||||
/// [followUp], an optional chart between them, and actions under them.
|
||||
class CoachMessage {
|
||||
bool mine;
|
||||
|
||||
String body;
|
||||
|
||||
CoachChart? chart;
|
||||
|
||||
String followUp;
|
||||
|
||||
List<CoachAction> actions;
|
||||
|
||||
DateTime at;
|
||||
|
||||
CoachMessage({
|
||||
required this.mine,
|
||||
required this.body,
|
||||
this.chart,
|
||||
this.followUp = "",
|
||||
List<CoachAction>? actions,
|
||||
DateTime? at,
|
||||
}) : actions = actions ?? <CoachAction>[],
|
||||
at = at ?? DateTime.now();
|
||||
}
|
||||
Reference in New Issue
Block a user