chore: show selected archived activity, add tooltip to archived activity analytics view (#4217)
This commit is contained in:
parent
97163ce221
commit
343a27e80a
5 changed files with 52 additions and 28 deletions
|
|
@ -5299,5 +5299,6 @@
|
|||
"inviteYourFriends": "Invite your friends",
|
||||
"playWithAI": "Play with AI for now",
|
||||
"courseStartDesc": "Pangea Bot is ready to go anytime!\n\n...but learning is better with friends!",
|
||||
"activityDropdownDesc": "When you’re done with this activity, click below"
|
||||
"activityDropdownDesc": "When you’re done with this activity, click below",
|
||||
"activityAnalyticsListBody": "These are your completed activities! After finishing activities, you can view them here."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import 'package:matrix/matrix.dart';
|
|||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/activity_sessions/activity_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/instructions/instructions_enum.dart';
|
||||
import 'package:fluffychat/pangea/instructions/instructions_inline_tooltip.dart';
|
||||
import 'package:fluffychat/widgets/hover_builder.dart';
|
||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
|
@ -13,7 +15,11 @@ import '../../config/themes.dart';
|
|||
import '../../widgets/avatar.dart';
|
||||
|
||||
class ActivityArchive extends StatelessWidget {
|
||||
const ActivityArchive({super.key});
|
||||
final String? selectedRoomId;
|
||||
const ActivityArchive({
|
||||
super.key,
|
||||
this.selectedRoomId,
|
||||
});
|
||||
|
||||
List<Room> get archive =>
|
||||
MatrixState.pangeaController.getAnalytics.archivedActivities;
|
||||
|
|
@ -22,18 +28,19 @@ class ActivityArchive extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return MaxWidthBody(
|
||||
withScrolling: false,
|
||||
child: Builder(
|
||||
builder: (BuildContext context) {
|
||||
if (archive.isEmpty) {
|
||||
return const Center(
|
||||
child: Icon(Icons.archive_outlined, size: 80),
|
||||
child: ListView.builder(
|
||||
itemCount: archive.length + 1,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
if (i == 0) {
|
||||
return const InstructionsInlineTooltip(
|
||||
instructionsEnum: InstructionsEnum.activityAnalyticsList,
|
||||
padding: EdgeInsets.all(8.0),
|
||||
);
|
||||
}
|
||||
return ListView.builder(
|
||||
itemCount: archive.length,
|
||||
itemBuilder: (BuildContext context, int i) => AnalyticsActivityItem(
|
||||
room: archive[i],
|
||||
),
|
||||
i--;
|
||||
return AnalyticsActivityItem(
|
||||
room: archive[i],
|
||||
selected: archive[i].id == selectedRoomId,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
@ -43,9 +50,11 @@ class ActivityArchive extends StatelessWidget {
|
|||
|
||||
class AnalyticsActivityItem extends StatelessWidget {
|
||||
final Room room;
|
||||
final bool selected;
|
||||
const AnalyticsActivityItem({
|
||||
super.key,
|
||||
required this.room,
|
||||
this.selected = false,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -57,12 +66,14 @@ class AnalyticsActivityItem extends StatelessWidget {
|
|||
)
|
||||
?.cefrLevel;
|
||||
|
||||
final theme = Theme.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 1,
|
||||
),
|
||||
child: Material(
|
||||
color: selected ? theme.colorScheme.secondaryContainer : null,
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: ListTile(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/config/themes.dart';
|
||||
|
|
@ -28,6 +29,7 @@ class AnalyticsPage extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final analyticsRoomId = GoRouterState.of(context).pathParameters['roomid'];
|
||||
return Scaffold(
|
||||
appBar: construct != null ? AppBar() : null,
|
||||
body: SafeArea(
|
||||
|
|
@ -60,7 +62,9 @@ class AnalyticsPage extends StatelessWidget {
|
|||
view: ConstructTypeEnum.vocab,
|
||||
);
|
||||
} else if (indicator == ProgressIndicatorEnum.activities) {
|
||||
return const ActivityArchive();
|
||||
return ActivityArchive(
|
||||
selectedRoomId: analyticsRoomId,
|
||||
);
|
||||
}
|
||||
|
||||
return Center(
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ enum InstructionsEnum {
|
|||
chooseMorphs,
|
||||
analyticsVocabList,
|
||||
morphAnalyticsList,
|
||||
activityAnalyticsList,
|
||||
readingAssistanceOverview,
|
||||
emptyChatWarning,
|
||||
activityStatsMenu,
|
||||
|
|
@ -64,6 +65,7 @@ extension InstructionsEnumExtension on InstructionsEnum {
|
|||
case InstructionsEnum.readingAssistanceOverview:
|
||||
case InstructionsEnum.activityStatsMenu:
|
||||
case InstructionsEnum.chatListTooltip:
|
||||
case InstructionsEnum.activityAnalyticsList:
|
||||
ErrorHandler.logError(
|
||||
e: Exception("No title for this instruction"),
|
||||
m: 'InstructionsEnumExtension.title',
|
||||
|
|
@ -120,6 +122,8 @@ extension InstructionsEnumExtension on InstructionsEnum {
|
|||
return l10n.analyticsVocabListBody;
|
||||
case InstructionsEnum.morphAnalyticsList:
|
||||
return l10n.morphAnalyticsListBody;
|
||||
case InstructionsEnum.activityAnalyticsList:
|
||||
return l10n.activityAnalyticsListBody;
|
||||
case InstructionsEnum.readingAssistanceOverview:
|
||||
return l10n.readingAssistanceOverviewBody;
|
||||
case InstructionsEnum.emptyChatWarning:
|
||||
|
|
|
|||
|
|
@ -131,22 +131,26 @@ class ReadingAssistanceInputBarState extends State<ReadingAssistanceInputBar> {
|
|||
PracticeModeButtons(
|
||||
overlayController: overlayController,
|
||||
),
|
||||
Material(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
alignment: Alignment.center,
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: minContentHeight,
|
||||
maxHeight: AppConfig.readingAssistanceInputBarHeight,
|
||||
),
|
||||
child: Scrollbar(
|
||||
thumbVisibility: true,
|
||||
controller: _scrollController,
|
||||
child: SingleChildScrollView(
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
alignment: Alignment.center,
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: minContentHeight,
|
||||
maxHeight: AppConfig.readingAssistanceInputBarHeight,
|
||||
),
|
||||
child: Scrollbar(
|
||||
thumbVisibility: true,
|
||||
controller: _scrollController,
|
||||
child: SizedBox(
|
||||
width: overlayController.maxWidth,
|
||||
child: barContent(context),
|
||||
child: SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
child: SizedBox(
|
||||
width: overlayController.maxWidth,
|
||||
child: barContent(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue