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:
66
frontend/lib/Grounded/about/external/data/GroupMessage.dart
vendored
Normal file
66
frontend/lib/Grounded/about/external/data/GroupMessage.dart
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/// One line in a group chat. Besides plain text, the app posts check-ins
|
||||
/// (progress logged on an objective), nudges and system notes into the same
|
||||
/// thread so the conversation and the work sit together.
|
||||
class GroupMessage {
|
||||
String id;
|
||||
|
||||
String groupId;
|
||||
|
||||
String authorId;
|
||||
|
||||
String authorName;
|
||||
|
||||
String body;
|
||||
|
||||
/// "Text", "CheckIn", "Nudge" or "System".
|
||||
String kind;
|
||||
|
||||
DateTime? sentAt;
|
||||
|
||||
/// True when the signed-in user wrote it.
|
||||
bool mine;
|
||||
|
||||
GroupMessage({
|
||||
this.id = "",
|
||||
this.groupId = "",
|
||||
this.authorId = "",
|
||||
this.authorName = "",
|
||||
this.body = "",
|
||||
this.kind = "Text",
|
||||
this.sentAt,
|
||||
this.mine = false,
|
||||
});
|
||||
|
||||
bool get isCheckIn => kind == "CheckIn";
|
||||
|
||||
bool get isNudge => kind == "Nudge";
|
||||
|
||||
bool get isSystem => kind == "System";
|
||||
|
||||
factory GroupMessage.fromJson(Map<String, dynamic> json) {
|
||||
return GroupMessage(
|
||||
id: json['id'] ?? "",
|
||||
groupId: json['groupId'] ?? "",
|
||||
authorId: json['authorId'] ?? "",
|
||||
authorName: json['authorName'] ?? "",
|
||||
body: json['body'] ?? "",
|
||||
kind: json['kind'] ?? "Text",
|
||||
sentAt:
|
||||
json['sentAt'] == null ? null : DateTime.tryParse(json['sentAt']),
|
||||
mine: json['mine'] ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['groupId'] = groupId;
|
||||
data['authorId'] = authorId;
|
||||
data['authorName'] = authorName;
|
||||
data['body'] = body;
|
||||
data['kind'] = kind;
|
||||
data['sentAt'] = sentAt?.toIso8601String();
|
||||
data['mine'] = mine;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user