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:
43
frontend/lib/Grounded/see/group/ViewGroupEditor.dart
Normal file
43
frontend/lib/Grounded/see/group/ViewGroupEditor.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import '../../about/external/data/Group.dart';
|
||||
import '../../about/external/initial/GroupRequest.dart';
|
||||
import '../../about/external/initial/JoinGroupRequest.dart';
|
||||
import '../parent/ParentViewModel.dart';
|
||||
import 'ConnectGroupEditor.dart';
|
||||
|
||||
class ViewGroupEditor extends ParentViewModel {
|
||||
ConnectGroupEditor connection;
|
||||
|
||||
ViewGroupEditor(super.context, this.connection);
|
||||
|
||||
void create(GroupRequest request) async {
|
||||
if (!await hasNetwork(() => create(request))) return;
|
||||
|
||||
showLoading("Creating the group");
|
||||
|
||||
try {
|
||||
final response = await getDataManager().saveGroupEntry(request);
|
||||
|
||||
closeLoading();
|
||||
|
||||
connection.onGroupReady(Group.fromJson(response.data));
|
||||
} catch (e) {
|
||||
handleError(e, () => create(request), () => dismissError(), "Retry");
|
||||
}
|
||||
}
|
||||
|
||||
void join(JoinGroupRequest request) async {
|
||||
if (!await hasNetwork(() => join(request))) return;
|
||||
|
||||
showLoading("Joining");
|
||||
|
||||
try {
|
||||
final response = await getDataManager().joinGroupEntry(request);
|
||||
|
||||
closeLoading();
|
||||
|
||||
connection.onGroupReady(Group.fromJson(response.data));
|
||||
} catch (e) {
|
||||
handleError(e, () => join(request), () => dismissError(), "Retry");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user