Skip to content

Commit

Permalink
reactions: Add sheet to view who reacted to a message
Browse files Browse the repository at this point in the history
Fixes zulip#740
  • Loading branch information
chimnayajith committed Jan 16, 2025
1 parent 7c53913 commit 3667ec4
Show file tree
Hide file tree
Showing 13 changed files with 362 additions and 3 deletions.
3 changes: 3 additions & 0 deletions assets/icons/reactions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
"@actionSheetOptionShare": {
"description": "Label for share button on action sheet."
},
"actionSheetOptionViewReactions": "View Reactions",
"@actionSheetOptionViewReactions": {
"description": "Label for View Reactions button on action sheet."
},
"actionSheetOptionQuoteAndReply": "Quote and reply",
"@actionSheetOptionQuoteAndReply": {
"description": "Label for Quote and reply button on action sheet."
Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ abstract class ZulipLocalizations {
/// **'Share'**
String get actionSheetOptionShare;

/// Label for View Reactions button on action sheet.
///
/// In en, this message translates to:
/// **'View Reactions'**
String get actionSheetOptionViewReactions;

/// Label for Quote and reply button on action sheet.
///
/// In en, this message translates to:
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Share';

@override
String get actionSheetOptionViewReactions => 'View Reactions';

@override
String get actionSheetOptionQuoteAndReply => 'Quote and reply';

Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Share';

@override
String get actionSheetOptionViewReactions => 'View Reactions';

@override
String get actionSheetOptionQuoteAndReply => 'Quote and reply';

Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Share';

@override
String get actionSheetOptionViewReactions => 'View Reactions';

@override
String get actionSheetOptionQuoteAndReply => 'Quote and reply';

Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_nb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Share';

@override
String get actionSheetOptionViewReactions => 'View Reactions';

@override
String get actionSheetOptionQuoteAndReply => 'Quote and reply';

Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Udostępnij';

@override
String get actionSheetOptionViewReactions => 'View Reactions';

@override
String get actionSheetOptionQuoteAndReply => 'Odpowiedz cytując';

Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Поделиться';

@override
String get actionSheetOptionViewReactions => 'View Reactions';

@override
String get actionSheetOptionQuoteAndReply => 'Ответить с цитированием';

Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Zdielať';

@override
String get actionSheetOptionViewReactions => 'View Reactions';

@override
String get actionSheetOptionQuoteAndReply => 'Citovať a odpovedať';

Expand Down
20 changes: 20 additions & 0 deletions lib/widgets/action_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ void showMessageActionSheet({required BuildContext context, required Message mes

final optionButtons = [
ReactionButtons(message: message, pageContext: context),
if((message.reactions?.total ?? 0) > 0)
ViewReactionsButton(message: message, pageContext: context),
StarButton(message: message, pageContext: context),
if (isComposeBoxOffered)
QuoteAndReplyButton(message: message, pageContext: context),
Expand Down Expand Up @@ -678,6 +680,24 @@ class QuoteAndReplyButton extends MessageActionSheetMenuItemButton {
}
}

class ViewReactionsButton extends MessageActionSheetMenuItemButton {
ViewReactionsButton({super.key, required super.message, required super.pageContext});

@override IconData get icon => ZulipIcons.reactions;

@override
String label(ZulipLocalizations zulipLocalizations) {
return zulipLocalizations.actionSheetOptionViewReactions;
}

@override void onPressed() async {
showReactionListSheet(
pageContext,
reactionList: message.reactions?.aggregated,
);
}
}

class MarkAsUnreadButton extends MessageActionSheetMenuItemButton {
MarkAsUnreadButton({super.key, required super.message, required super.pageContext});

Expand Down
Loading

0 comments on commit 3667ec4

Please sign in to comment.