Add groups with shared goals, objectives and chat; drop the water tracker

Groups let people keep each other honest: create one or join with a
six-letter invite code. Each group has shared goals split into measurable
objectives (km, sessions, words) that every member logs toward, a
leaderboard of kept rate and streak with nudges, and a group chat where
check-ins and nudges appear as cards beside the talk. The open chat polls
for new messages.

Reached from a new Groups tab (Training moves into the day rail), a Home
"Your groups" rail that opens the chat, and a Group tile in the add sheet.
Mock mode seeds two groups, a joinable one and members who reply.

The water tracker is removed; it did not fit the app. Bottom sheets are
now square app-wide via the theme.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KhQh614DMeYoQEH9SoMRUw
This commit is contained in:
alvocool
2026-11-03 11:46:41 +03:00
parent 4548e1f164
commit 4b71257429
51 changed files with 3871 additions and 157 deletions

View File

@@ -1,5 +1,6 @@
import '../../about/external/data/Commitment.dart';
import '../../about/external/data/ExcuseCluster.dart';
import '../../about/external/data/Group.dart';
import '../../about/external/data/ReportCard.dart';
import '../../about/external/data/RoutineChain.dart';
import '../../about/external/data/pages/request/CommitmentsRequest.dart';
@@ -35,10 +36,10 @@ class ViewHome extends ParentViewModel {
loadTodos();
loadWater();
loadWeek();
loadGroups();
loadPlan();
}
@@ -61,12 +62,20 @@ class ViewHome extends ParentViewModel {
}
}
void loadWater() async {
connection.onWaterLoaded(await getDataManager().getWaterToday());
}
/// The groups rail. Quiet on failure: the rail just stays hidden.
void loadGroups() async {
try {
final response = await getDataManager().getMyGroups(HistoryRequest(
query: PageAndSort(
sort: Sort('desc', 'lastMessageAt'),
page: Pageable(0, 0, 20, 0),
),
));
void saveWater(int ml) async {
await getDataManager().setWaterToday(ml);
connection.onGroupsLoaded(getGroupList(response.data));
} catch (e) {
connection.onGroupsLoaded(<Group>[]);
}
}
void loadTodos() async {