From 66457dc6ac5bed7446c2922f54c51d23d0a31699 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 13 Dec 2025 11:13:18 +0100 Subject: [PATCH 1/7] style(community_management): replace Text with Chip for "not available" state - Replaced Text widget with Chip widget for better visual presentation - Applied transparent background color to Chip - Removed border and set compact visual density - Updated text color to maintain readability --- .../view/engagements_page.dart | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/community_management/view/engagements_page.dart b/lib/community_management/view/engagements_page.dart index c164792d..3ec9b08f 100644 --- a/lib/community_management/view/engagements_page.dart +++ b/lib/community_management/view/engagements_page.dart @@ -210,13 +210,13 @@ class _EngagementsDataSource extends DataTableSource { side: BorderSide.none, visualDensity: VisualDensity.compact, ) - : Text( - l10n.notAvailable, - style: Theme.of(context).textTheme.bodySmall?.copyWith( - color: Theme.of( - context, - ).colorScheme.onSurface.withOpacity(0.6), - ), + : Chip( + label: Text(l10n.notAvailable), + backgroundColor: Theme.of( + context, + ).colorScheme.onSurface.withOpacity(0.1), + side: BorderSide.none, + visualDensity: VisualDensity.compact, ), ), DataCell( From 4302afc21a1134c3f0a1f478e2f217cd3af6c54b Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 13 Dec 2025 11:35:10 +0100 Subject: [PATCH 2/7] feat(l10n): add translations for new comment filter feature - Add Arabic and English translations for "Contains Comment" filter label - Add Arabic and English translations for "Show only engagements that include a text comment" description - Update "Comment Status" description for both languages --- lib/l10n/arb/app_ar.arb | 10 +++++++++- lib/l10n/arb/app_en.arb | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/l10n/arb/app_ar.arb b/lib/l10n/arb/app_ar.arb index 96a8e14e..70baa956 100644 --- a/lib/l10n/arb/app_ar.arb +++ b/lib/l10n/arb/app_ar.arb @@ -2316,7 +2316,15 @@ }, "commentStatus": "حالة التعليق", "@commentStatus": { - "description": "رأس العمود لحالة التعليق" + "description": "تسمية لحالة الإشراف على تعليق ضمن تفاعل." + }, +"hasCommentFilterLabel": "تحتوي على تعليقات", + "@hasCommentFilterLabel": { + "description": "تسمية لمفتاح تصفية التفاعلات بناءً على وجود تعليق." + }, + "hasCommentFilterDescription": "إظهار التفاعلات التي تتضمن تعليقًا نصيًا فقط.", + "@hasCommentFilterDescription": { + "description": "وصف لمفتاح تصفية التفاعلات بناءً على وجود تعليق." }, "date": "التاريخ", "@date": { diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 8cb9fbee..f9940e7d 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -2312,7 +2312,15 @@ }, "commentStatus": "Comment Status", "@commentStatus": { - "description": "Column header for comment status" + "description": "Label for the moderation status of a comment within an engagement." + }, + "hasCommentFilterLabel": "Contains Comment", + "@hasCommentFilterLabel": { + "description": "Label for the switch to filter engagements based on whether they have a comment." + }, + "hasCommentFilterDescription": "Show only engagements that include a text comment.", + "@hasCommentFilterDescription": { + "description": "Description for the switch to filter engagements based on whether they have a comment." }, "date": "Date", "@date": { From 446910b663d849797f3f16e0c87c42855d9fb90c Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 13 Dec 2025 11:35:24 +0100 Subject: [PATCH 3/7] build(l10n): sync --- lib/l10n/app_localizations.dart | 14 +++++++++++++- lib/l10n/app_localizations_ar.dart | 7 +++++++ lib/l10n/app_localizations_en.dart | 7 +++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index bee5a5ce..ccac0c16 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -3440,12 +3440,24 @@ abstract class AppLocalizations { /// **'Comment'** String get comment; - /// Column header for comment status + /// Label for the moderation status of a comment within an engagement. /// /// In en, this message translates to: /// **'Comment Status'** String get commentStatus; + /// Label for the switch to filter engagements based on whether they have a comment. + /// + /// In en, this message translates to: + /// **'Contains Comment'** + String get hasCommentFilterLabel; + + /// Description for the switch to filter engagements based on whether they have a comment. + /// + /// In en, this message translates to: + /// **'Show only engagements that include a text comment.'** + String get hasCommentFilterDescription; + /// Column header for date /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_ar.dart b/lib/l10n/app_localizations_ar.dart index 38c0f965..74295f99 100644 --- a/lib/l10n/app_localizations_ar.dart +++ b/lib/l10n/app_localizations_ar.dart @@ -1858,6 +1858,13 @@ class AppLocalizationsAr extends AppLocalizations { @override String get commentStatus => 'حالة التعليق'; + @override + String get hasCommentFilterLabel => 'تحتوي على تعليقات'; + + @override + String get hasCommentFilterDescription => + 'إظهار التفاعلات التي تتضمن تعليقًا نصيًا فقط.'; + @override String get date => 'التاريخ'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 69ab05ff..a6cf159b 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -1863,6 +1863,13 @@ class AppLocalizationsEn extends AppLocalizations { @override String get commentStatus => 'Comment Status'; + @override + String get hasCommentFilterLabel => 'Contains Comment'; + + @override + String get hasCommentFilterDescription => + 'Show only engagements that include a text comment.'; + @override String get date => 'Date'; From 6f05d9a5d736472894f2410d8f3f48c961b1363c Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 13 Dec 2025 11:41:02 +0100 Subject: [PATCH 4/7] feat(community_management): add switch filter for comments and update status filter - Add a new SwitchListTile filter for comments in the Engagements tab - Update the status filter to use a more specific label - Preserve existing filter settings when changing filters --- .../community_filter_dialog.dart | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/lib/community_management/widgets/community_filter_dialog/community_filter_dialog.dart b/lib/community_management/widgets/community_filter_dialog/community_filter_dialog.dart index cfa99379..1bae5cf6 100644 --- a/lib/community_management/widgets/community_filter_dialog/community_filter_dialog.dart +++ b/lib/community_management/widgets/community_filter_dialog/community_filter_dialog.dart @@ -169,6 +169,7 @@ class _CommunityFilterDialogState extends State { EngagementsFilter( searchQuery: query, selectedStatus: state.engagementsFilter.selectedStatus, + hasComment: state.engagementsFilter.hasComment, ), ), ); @@ -248,19 +249,37 @@ class _CommunityFilterDialogState extends State { case CommunityManagementTab.engagements: return [ _buildCapsuleFilter( - title: l10n.status, + title: l10n.commentStatus, allValues: ModerationStatus.values, selectedValue: state.engagementsFilter.selectedStatus, labelBuilder: (item) => item.l10n(context), onChanged: (item) { context.read().add( - EngagementsFilterChanged( - EngagementsFilter( - searchQuery: state.engagementsFilter.searchQuery, - selectedStatus: item, - ), - ), - ); + EngagementsFilterChanged( + EngagementsFilter( + searchQuery: state.engagementsFilter.searchQuery, + selectedStatus: item, + hasComment: state.engagementsFilter.hasComment, + ), + ), + ); + }, + ), + const Divider(height: AppSpacing.lg * 2), + SwitchListTile( + title: Text(l10n.hasCommentFilterLabel), + subtitle: Text(l10n.hasCommentFilterDescription), + value: state.engagementsFilter.hasComment, + onChanged: (value) { + context.read().add( + EngagementsFilterChanged( + EngagementsFilter( + searchQuery: state.engagementsFilter.searchQuery, + selectedStatus: state.engagementsFilter.selectedStatus, + hasComment: value, + ), + ), + ); }, ), ]; From 9b3ba7b18e8fccff4bb299f9ddaab4367a31d069 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 13 Dec 2025 11:41:13 +0100 Subject: [PATCH 5/7] feat(community_management): add hasComment filter to engagements - Add hasComment parameter to EngagementsFilter class - Update isFilterActive logic to include hasComment - Add hasComment to the list of props for equality comparison --- .../bloc/community_filter/community_filter_state.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/community_management/bloc/community_filter/community_filter_state.dart b/lib/community_management/bloc/community_filter/community_filter_state.dart index e973575d..9a9e1d0b 100644 --- a/lib/community_management/bloc/community_filter/community_filter_state.dart +++ b/lib/community_management/bloc/community_filter/community_filter_state.dart @@ -4,17 +4,20 @@ class EngagementsFilter extends Equatable { const EngagementsFilter({ this.searchQuery, this.selectedStatus, + this.hasComment = false, }); final String? searchQuery; final ModerationStatus? selectedStatus; + final bool hasComment; bool get isFilterActive => (searchQuery != null && searchQuery!.isNotEmpty) || - selectedStatus != null; + selectedStatus != null || + hasComment; @override - List get props => [searchQuery, selectedStatus]; + List get props => [searchQuery, selectedStatus, hasComment]; } class ReportsFilter extends Equatable { From fbb3c3682d55c1f5b90c65e516f401b3d3f200c9 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 13 Dec 2025 11:41:29 +0100 Subject: [PATCH 6/7] feat(community_management): add comment filter to community management - Implement a new filter option for comments in the community management feature - Add a condition to check if a listing has a comment, improving issue search functionality --- lib/community_management/bloc/community_management_bloc.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/community_management/bloc/community_management_bloc.dart b/lib/community_management/bloc/community_management_bloc.dart index 062265ae..cdb4437a 100644 --- a/lib/community_management/bloc/community_management_bloc.dart +++ b/lib/community_management/bloc/community_management_bloc.dart @@ -113,6 +113,11 @@ class CommunityManagementBloc r'$in': [filter.selectedStatus!.name], }; } + if (filter.hasComment) { + filterMap['comment'] = { + r'$ne': null, + }; + } return filterMap; } From 8e757835626512c783589aa9b978c3b2488848ce Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 13 Dec 2025 12:03:56 +0100 Subject: [PATCH 7/7] refactor(community_management): update engagement filter logic - Remove 'hasComment' property from EngagementsFilter class - Update buildEngagementsFilterMap function to handle different filter conditions - Remove 'hasComment' filter option from the UI --- .../community_filter_state.dart | 7 ++--- .../bloc/community_management_bloc.dart | 26 ++++++++++++------- .../community_filter_dialog.dart | 19 -------------- 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/lib/community_management/bloc/community_filter/community_filter_state.dart b/lib/community_management/bloc/community_filter/community_filter_state.dart index 9a9e1d0b..e973575d 100644 --- a/lib/community_management/bloc/community_filter/community_filter_state.dart +++ b/lib/community_management/bloc/community_filter/community_filter_state.dart @@ -4,20 +4,17 @@ class EngagementsFilter extends Equatable { const EngagementsFilter({ this.searchQuery, this.selectedStatus, - this.hasComment = false, }); final String? searchQuery; final ModerationStatus? selectedStatus; - final bool hasComment; bool get isFilterActive => (searchQuery != null && searchQuery!.isNotEmpty) || - selectedStatus != null || - hasComment; + selectedStatus != null; @override - List get props => [searchQuery, selectedStatus, hasComment]; + List get props => [searchQuery, selectedStatus]; } class ReportsFilter extends Equatable { diff --git a/lib/community_management/bloc/community_management_bloc.dart b/lib/community_management/bloc/community_management_bloc.dart index cdb4437a..dba5df01 100644 --- a/lib/community_management/bloc/community_management_bloc.dart +++ b/lib/community_management/bloc/community_management_bloc.dart @@ -104,21 +104,27 @@ class CommunityManagementBloc } Map buildEngagementsFilterMap(EngagementsFilter filter) { - final filterMap = {}; + final conditions = >[]; + if (filter.searchQuery != null && filter.searchQuery!.isNotEmpty) { - filterMap['userId'] = filter.searchQuery; + conditions.add({'userId': filter.searchQuery}); } + if (filter.selectedStatus != null) { - filterMap['comment.status'] = { - r'$in': [filter.selectedStatus!.name], - }; + if (filter.selectedStatus == ModerationStatus.resolved) { + conditions.add({'comment.status': ModerationStatus.resolved.name}); + } else { + conditions.add({'comment.status': filter.selectedStatus!.name}); + } } - if (filter.hasComment) { - filterMap['comment'] = { - r'$ne': null, - }; + + if (conditions.isEmpty) { + return {}; + } else if (conditions.length == 1) { + return conditions.first; + } else { + return {r'$and': conditions}; } - return filterMap; } Map buildReportsFilterMap(ReportsFilter filter) { diff --git a/lib/community_management/widgets/community_filter_dialog/community_filter_dialog.dart b/lib/community_management/widgets/community_filter_dialog/community_filter_dialog.dart index 1bae5cf6..cebf96fc 100644 --- a/lib/community_management/widgets/community_filter_dialog/community_filter_dialog.dart +++ b/lib/community_management/widgets/community_filter_dialog/community_filter_dialog.dart @@ -169,7 +169,6 @@ class _CommunityFilterDialogState extends State { EngagementsFilter( searchQuery: query, selectedStatus: state.engagementsFilter.selectedStatus, - hasComment: state.engagementsFilter.hasComment, ), ), ); @@ -259,24 +258,6 @@ class _CommunityFilterDialogState extends State { EngagementsFilter( searchQuery: state.engagementsFilter.searchQuery, selectedStatus: item, - hasComment: state.engagementsFilter.hasComment, - ), - ), - ); - }, - ), - const Divider(height: AppSpacing.lg * 2), - SwitchListTile( - title: Text(l10n.hasCommentFilterLabel), - subtitle: Text(l10n.hasCommentFilterDescription), - value: state.engagementsFilter.hasComment, - onChanged: (value) { - context.read().add( - EngagementsFilterChanged( - EngagementsFilter( - searchQuery: state.engagementsFilter.searchQuery, - selectedStatus: state.engagementsFilter.selectedStatus, - hasComment: value, ), ), );