chore: add popup to navigate to session analytics (#3852)
This commit is contained in:
parent
4175179144
commit
af8a2c1fbd
5 changed files with 119 additions and 14 deletions
|
|
@ -5265,5 +5265,6 @@
|
|||
"saveToCompletedActivities": "Save to completed activities",
|
||||
"generatingSummary": "Analyzing chat and generating results",
|
||||
"instructionsLanguage": "Instructions language",
|
||||
"findCourse": "Find a course"
|
||||
"findCourse": "Find a course",
|
||||
"activityCompletedDesc": "Your completed activity was added to analytics where you can review and practice the language you used."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ extension ActivityRoomExtension on Room {
|
|||
Future<void> archiveActivity() async {
|
||||
final currentRoles = activityRoles ?? ActivityRolesModel.empty;
|
||||
final role = ownRole;
|
||||
if (role == null || !role.isFinished) return;
|
||||
if (role == null || !role.isFinished || role.isArchived) return;
|
||||
|
||||
role.archivedAt = DateTime.now();
|
||||
currentRoles.updateRole(role);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:fluffychat/config/themes.dart';
|
|||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/pages/chat/chat.dart';
|
||||
import 'package:fluffychat/pangea/activity_sessions/activity_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/activity_sessions/activity_session_chat/saved_activity_analytics_dialog.dart';
|
||||
import 'package:fluffychat/pangea/course_plans/course_plan_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/course_plans/course_plans_repo.dart';
|
||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||
|
|
@ -129,9 +130,18 @@ class ActivityFinishedStatusMessage extends StatelessWidget {
|
|||
);
|
||||
|
||||
if (!resp.isError) {
|
||||
context.go(
|
||||
"/rooms/analytics?mode=activities",
|
||||
final navigate = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const SavedActivityAnalyticsDialog();
|
||||
},
|
||||
);
|
||||
|
||||
if (navigate == true) {
|
||||
context.go(
|
||||
"/rooms/analytics?mode=activities",
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/pangea/analytics_page/analytics_page_constants.dart';
|
||||
|
||||
class SavedActivityAnalyticsDialog extends StatelessWidget {
|
||||
const SavedActivityAnalyticsDialog({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 2.5, sigmaY: 2.5),
|
||||
child: Dialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 300.0,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
spacing: 16.0,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Column(
|
||||
spacing: 10.0,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
L10n.of(context).niceJob,
|
||||
style: const TextStyle(fontSize: 12.0),
|
||||
),
|
||||
Text(
|
||||
L10n.of(context).activityCompletedDesc,
|
||||
style: const TextStyle(fontSize: 8.0),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
CachedNetworkImage(
|
||||
imageUrl:
|
||||
"${AppConfig.assetsBaseURL}/${AnalyticsPageConstants.dinoBotFileName}",
|
||||
errorWidget: (context, e, s) => const SizedBox.shrink(),
|
||||
progressIndicatorBuilder: (context, _, __) =>
|
||||
const SizedBox.shrink(),
|
||||
width: 100.0,
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.primaryContainer,
|
||||
foregroundColor:
|
||||
Theme.of(context).colorScheme.onPrimaryContainer,
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: Row(
|
||||
spacing: 4.0,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.map_outlined, size: 12.0),
|
||||
Text(
|
||||
L10n.of(context).continueText,
|
||||
style: const TextStyle(fontSize: 12.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -91,18 +91,21 @@ class ButtonControlledCarouselView extends StatelessWidget {
|
|||
final availableRoles = room.activityPlan!.roles;
|
||||
final assignedRoles = room.assignedRoles ?? {};
|
||||
|
||||
final userSummaries = summary.participants.where(
|
||||
(p) => assignedRoles.values.any(
|
||||
(role) => role.userId == p.participantId,
|
||||
),
|
||||
);
|
||||
final userSummaries = summary.participants
|
||||
.where(
|
||||
(p) => assignedRoles.values.any(
|
||||
(role) => role.userId == p.participantId,
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 175.0,
|
||||
height: 200.0,
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
controller: controller.carouselController,
|
||||
itemExtent: 250,
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: userSummaries.mapIndexed((i, p) {
|
||||
final user = room.getParticipants().firstWhereOrNull(
|
||||
|
|
@ -125,6 +128,7 @@ class ButtonControlledCarouselView extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 4.0,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
|
@ -148,9 +152,13 @@ class ButtonControlledCarouselView extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
p.feedback,
|
||||
style: const TextStyle(fontSize: 8.0),
|
||||
Flexible(
|
||||
child: SingleChildScrollView(
|
||||
child: Text(
|
||||
p.feedback,
|
||||
style: const TextStyle(fontSize: 8.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
spacing: 14.0,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue