Commit 19dff83
authored
feat: reaction list bottom redesign (#3424)
This pull request introduces a new `reactionListType` prop to the
message and channel components, allowing the bottom reaction list to be
displayed in either a "segmented" or "clustered" style. It also
refactors the `ReactionListBottom` component for improved flexibility
and code clarity, and adds support for selecting reactions and
customizing their appearance.
**Key changes:**
**1. Reaction List Type and Propagation**
- Added a new `reactionListType` prop (default: `'segmented'`) to
`Channel`, `Message`, and `MessageSimple` components, and ensured it is
passed through all relevant contexts and props. This enables consumers
to control the visual style of the bottom reaction list.
[[1]](diffhunk://#diff-f7139f4cdb523365cfc277d72b827a3432325b9c6460cf14628f9df67d0e4d85R389)
[[2]](diffhunk://#diff-f7139f4cdb523365cfc277d72b827a3432325b9c6460cf14628f9df67d0e4d85R712)
[[3]](diffhunk://#diff-f7139f4cdb523365cfc277d72b827a3432325b9c6460cf14628f9df67d0e4d85R1965)
[[4]](diffhunk://#diff-d3e4f4cdcef10807a38eab86f6ead6bbfe01980e7326f3cadfeb8186760d7af1R89)
[[5]](diffhunk://#diff-d3e4f4cdcef10807a38eab86f6ead6bbfe01980e7326f3cadfeb8186760d7af1R202)
[[6]](diffhunk://#diff-6c4943fcf0d32148b663091935ac039195d602cef7654b16bb93514ca2b3ba83R78)
[[7]](diffhunk://#diff-6c4943fcf0d32148b663091935ac039195d602cef7654b16bb93514ca2b3ba83R117)
[[8]](diffhunk://#diff-6c4943fcf0d32148b663091935ac039195d602cef7654b16bb93514ca2b3ba83R457)
[[9]](diffhunk://#diff-6c4943fcf0d32148b663091935ac039195d602cef7654b16bb93514ca2b3ba83R492)
[[10]](diffhunk://#diff-2335969a90d85933b956775f38af8bf0485cd538b0e73115b8087467d7ed116aR242)
**2. ReactionListBottom Component Refactor**
- Refactored `ReactionListBottom` to support both "segmented" and
"clustered" layouts, with the new `type` prop determining the style. The
component now uses a more flexible rendering approach and improved
styling, including item separators and alignment based on message
direction.
[[1]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6L1-R4)
[[2]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6L193-R178)
[[3]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6R188-R193)
[[4]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6R206-R232)
[[5]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6L257-R357)
**3. Reaction Selection and Overlay Improvements**
- Improved the reaction selection logic by adding a `selectedReaction`
state and updating the `showReactionsOverlay` callback to accept an
optional reaction type. This allows the overlay to highlight the
selected reaction.
[[1]](diffhunk://#diff-4234b2ddfee0f9e29e7b465026e851cf75f5d16f03a175c86374168589335d8eL251-L253)
[[2]](diffhunk://#diff-4234b2ddfee0f9e29e7b465026e851cf75f5d16f03a175c86374168589335d8eL352-R354)
[[3]](diffhunk://#diff-4234b2ddfee0f9e29e7b465026e851cf75f5d16f03a175c86374168589335d8eR882)
**4. ReactionListBottom Item Enhancements**
- Updated `ReactionListBottomItem` to accept `selected` and `showCount`
props, and refactored its rendering to use a wrapper component and
remove unnecessary animation code. The icon and count display logic has
been simplified and improved for accessibility and maintainability.
[[1]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6R50-R51)
[[2]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6R64-R79)
[[3]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6L127)
[[4]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6L140-R132)
**5. Styling and Theming Updates**
- Introduced a new `useStyles` hook for `ReactionListBottom` to handle
dynamic styling based on message alignment and theme, and improved the
structure of style definitions for better consistency and flexibility.
These changes collectively improve the flexibility, usability, and
maintainability of the reaction list feature in the messaging UI.1 parent 565601d commit 19dff83
10 files changed
Lines changed: 301 additions & 136 deletions
File tree
- package/src
- components
- Channel
- hooks
- MessageMenu
- Message
- MessageSimple
- ReactionList
- __tests__
- contexts
- messagesContext
- themeContext/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
| 389 | + | |
389 | 390 | | |
390 | 391 | | |
391 | 392 | | |
| |||
708 | 709 | | |
709 | 710 | | |
710 | 711 | | |
| 712 | + | |
711 | 713 | | |
712 | 714 | | |
713 | 715 | | |
| |||
1960 | 1962 | | |
1961 | 1963 | | |
1962 | 1964 | | |
| 1965 | + | |
1963 | 1966 | | |
1964 | 1967 | | |
1965 | 1968 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
| 202 | + | |
201 | 203 | | |
202 | 204 | | |
203 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
| 252 | + | |
252 | 253 | | |
253 | | - | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
356 | 355 | | |
357 | 356 | | |
358 | 357 | | |
| |||
880 | 879 | | |
881 | 880 | | |
882 | 881 | | |
| 882 | + | |
883 | 883 | | |
884 | 884 | | |
885 | 885 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| 117 | + | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| |||
274 | 276 | | |
275 | 277 | | |
276 | 278 | | |
277 | | - | |
| 279 | + | |
278 | 280 | | |
279 | 281 | | |
280 | 282 | | |
| |||
452 | 454 | | |
453 | 455 | | |
454 | 456 | | |
| 457 | + | |
455 | 458 | | |
456 | 459 | | |
457 | 460 | | |
| |||
486 | 489 | | |
487 | 490 | | |
488 | 491 | | |
| 492 | + | |
489 | 493 | | |
490 | 494 | | |
491 | 495 | | |
| |||
0 commit comments