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:
40
frontend/lib/Grounded/about/external/initial/GroupGoalRequest.dart
vendored
Normal file
40
frontend/lib/Grounded/about/external/initial/GroupGoalRequest.dart
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'ObjectiveDraft.dart';
|
||||
|
||||
/// Creates a shared goal in a group, objectives and all.
|
||||
class GroupGoalRequest {
|
||||
String groupId;
|
||||
|
||||
String? id;
|
||||
|
||||
String title;
|
||||
|
||||
String description;
|
||||
|
||||
String targetDate;
|
||||
|
||||
String colourHex;
|
||||
|
||||
List<ObjectiveDraft> objectives;
|
||||
|
||||
GroupGoalRequest({
|
||||
this.groupId = "",
|
||||
this.id,
|
||||
this.title = "",
|
||||
this.description = "",
|
||||
this.targetDate = "",
|
||||
this.colourHex = "",
|
||||
List<ObjectiveDraft>? objectives,
|
||||
}) : objectives = objectives ?? <ObjectiveDraft>[];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['groupId'] = groupId;
|
||||
data['id'] = id;
|
||||
data['title'] = title;
|
||||
data['description'] = description;
|
||||
data['targetDate'] = targetDate;
|
||||
data['colourHex'] = colourHex;
|
||||
data['objectives'] = objectives.map((item) => item.toJson()).toList();
|
||||
return data;
|
||||
}
|
||||
}
|
||||
18
frontend/lib/Grounded/about/external/initial/GroupMessageRequest.dart
vendored
Normal file
18
frontend/lib/Grounded/about/external/initial/GroupMessageRequest.dart
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/// Posts a message to a group chat.
|
||||
class GroupMessageRequest {
|
||||
String groupId;
|
||||
|
||||
String body;
|
||||
|
||||
String kind;
|
||||
|
||||
GroupMessageRequest({this.groupId = "", this.body = "", this.kind = "Text"});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['groupId'] = groupId;
|
||||
data['body'] = body;
|
||||
data['kind'] = kind;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
21
frontend/lib/Grounded/about/external/initial/GroupRequest.dart
vendored
Normal file
21
frontend/lib/Grounded/about/external/initial/GroupRequest.dart
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/// Creates a group, or renames one when [id] is set.
|
||||
class GroupRequest {
|
||||
String? id;
|
||||
|
||||
String name;
|
||||
|
||||
String description;
|
||||
|
||||
String colourHex;
|
||||
|
||||
GroupRequest({this.id, this.name = "", this.description = "", this.colourHex = ""});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['name'] = name;
|
||||
data['description'] = description;
|
||||
data['colourHex'] = colourHex;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
12
frontend/lib/Grounded/about/external/initial/JoinGroupRequest.dart
vendored
Normal file
12
frontend/lib/Grounded/about/external/initial/JoinGroupRequest.dart
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/// Joins a group by the code a friend shared.
|
||||
class JoinGroupRequest {
|
||||
String inviteCode;
|
||||
|
||||
JoinGroupRequest({this.inviteCode = ""});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['inviteCode'] = inviteCode;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
15
frontend/lib/Grounded/about/external/initial/NudgeRequest.dart
vendored
Normal file
15
frontend/lib/Grounded/about/external/initial/NudgeRequest.dart
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/// Nudges one member, or everyone when [memberId] is empty.
|
||||
class NudgeRequest {
|
||||
String groupId;
|
||||
|
||||
String memberId;
|
||||
|
||||
NudgeRequest({this.groupId = "", this.memberId = ""});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['groupId'] = groupId;
|
||||
data['memberId'] = memberId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
18
frontend/lib/Grounded/about/external/initial/ObjectiveDraft.dart
vendored
Normal file
18
frontend/lib/Grounded/about/external/initial/ObjectiveDraft.dart
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/// One objective as typed into the shared-goal editor.
|
||||
class ObjectiveDraft {
|
||||
String title;
|
||||
|
||||
String unit;
|
||||
|
||||
double target;
|
||||
|
||||
ObjectiveDraft({this.title = "", this.unit = "", this.target = 0});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['title'] = title;
|
||||
data['unit'] = unit;
|
||||
data['target'] = target;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
24
frontend/lib/Grounded/about/external/initial/ObjectiveProgressRequest.dart
vendored
Normal file
24
frontend/lib/Grounded/about/external/initial/ObjectiveProgressRequest.dart
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/// Logs an amount against one objective of a shared goal.
|
||||
class ObjectiveProgressRequest {
|
||||
String groupId;
|
||||
|
||||
String goalId;
|
||||
|
||||
String objectiveId;
|
||||
|
||||
double amount;
|
||||
|
||||
String note;
|
||||
|
||||
ObjectiveProgressRequest({this.groupId = "", this.goalId = "", this.objectiveId = "", this.amount = 0, this.note = ""});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['groupId'] = groupId;
|
||||
data['goalId'] = goalId;
|
||||
data['objectiveId'] = objectiveId;
|
||||
data['amount'] = amount;
|
||||
data['note'] = note;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user