Update reaction strip to show only top 3 reactions with full functionality
- Add logic to sort reactions by count and take top 3 - Maintain full ReactionStrip functionality (toggle, add, tooltips) - Only limit display to top 3 most popular reactions - Keep all reaction state management and API calls - Preserve visual design and interactions - Add button still available for adding new reactions
This commit is contained in:
parent
eb3957febc
commit
fb9748c795
|
|
@ -203,12 +203,19 @@ class _PostActionsState extends ConsumerState<PostActions> {
|
|||
Widget build(BuildContext context) {
|
||||
final allowChain = widget.post.allowChain && widget.post.visibility != 'private' && widget.onChain != null;
|
||||
|
||||
// Get top 3 reactions by count
|
||||
final sortedReactions = _reactionCounts.entries.toList()
|
||||
..sort((a, b) => b.value.compareTo(a.value));
|
||||
final topReactions = Map.fromEntries(
|
||||
sortedReactions.take(3)
|
||||
);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Reactions section - full width
|
||||
// Reactions section - full width, but only top 3
|
||||
ReactionStrip(
|
||||
reactions: _reactionCounts,
|
||||
reactions: topReactions,
|
||||
myReactions: _myReactions,
|
||||
reactionUsers: {},
|
||||
onToggle: (emoji) => _toggleReaction(emoji),
|
||||
|
|
|
|||
Loading…
Reference in a new issue