Add routines module and full goal management
Routines: workout, meditation and must-do routines with timed, rep and tick steps, sets and rest. A library screen, a builder with templates and drag-to-reorder steps, and a full-screen player that auto-advances timed phases, counts backgrounding and logs broken chains as partial. Goals: a goal editor (deadline, colour, category, default class, archive), routines linked to goals, and a goal field on tasks and routines. Tasks added from inside a goal are now actually attached to it via parentId. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KhQh614DMeYoQEH9SoMRUw
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import '../../about/external/data/Commitment.dart';
|
||||
import '../../about/external/data/pages/request/CommitmentsRequest.dart';
|
||||
import '../../about/external/data/pages/request/HistoryRequest.dart';
|
||||
import '../../about/external/data/pages/request/PageAndSort.dart';
|
||||
import '../../about/external/data/pages/request/Pageable.dart';
|
||||
import '../../about/external/data/pages/request/Sort.dart';
|
||||
@@ -7,6 +8,7 @@ import '../../about/external/data/pages/response/CommitmentPage.dart';
|
||||
import '../../about/external/initial/CommitmentRequest.dart';
|
||||
import '../../about/internal/application/CapacityProfile.dart';
|
||||
import '../../utils/CapacityEngine.dart';
|
||||
import '../../utils/ObjectConvertors.dart';
|
||||
import '../parent/ParentViewModel.dart';
|
||||
import 'ConnectNewCommitment.dart';
|
||||
|
||||
@@ -24,6 +26,28 @@ class ViewNewCommitment extends ParentViewModel {
|
||||
connection.onMultiplierResolved(profile.multiplierFor(category));
|
||||
}
|
||||
|
||||
/// Goals for the picker — loaded on tap, never up front.
|
||||
void loadGoals() async {
|
||||
if (!await hasNetwork(() => loadGoals())) return;
|
||||
|
||||
showLoading("Loading goals");
|
||||
|
||||
try {
|
||||
final response = await getDataManager().getMyGoals(HistoryRequest(
|
||||
query: PageAndSort(
|
||||
sort: Sort('desc', 'startDate'),
|
||||
page: Pageable(0, 0, 50, 0),
|
||||
),
|
||||
));
|
||||
|
||||
closeLoading();
|
||||
|
||||
connection.onGoalsReady(getGoalList(response.data));
|
||||
} catch (e) {
|
||||
handleError(e, () => loadGoals(), () => dismissError(), "Retry");
|
||||
}
|
||||
}
|
||||
|
||||
/// The capacity gate. Chronic overdue is usually overcommitment misdiagnosed
|
||||
/// as laziness, so the plan is checked against what history says actually
|
||||
/// gets done before anything is accepted.
|
||||
|
||||
Reference in New Issue
Block a user