Commit b0a5125
authored
feat: improve reaction list in message customization (#3473)
This pull request enhances the customization and flexibility of the
reaction list UI components in the chat application. It introduces new
context properties and props for various reaction list subcomponents,
allowing developers to override and customize individual parts of the
reaction list (such as clustered views, items, wrappers, and count
items) both globally and at the component level. This enables more
granular control over the appearance and behavior of message reactions.
Key changes include:
**Customization API for Reaction List Components:**
- Added new context properties to `MessagesContextValue` for
`ReactionListClustered`, `ReactionListItem`, `ReactionListItemWrapper`,
and `ReactionListCountItem`, allowing these subcomponents to be
overridden via context.
- Updated the `Channel` component and its context to accept and
propagate the new reaction list component overrides, making them
available throughout the component tree.
[[1]](diffhunk://#diff-f7139f4cdb523365cfc277d72b827a3432325b9c6460cf14628f9df67d0e4d85R161-R164)
[[2]](diffhunk://#diff-f7139f4cdb523365cfc277d72b827a3432325b9c6460cf14628f9df67d0e4d85R400-R403)
[[3]](diffhunk://#diff-f7139f4cdb523365cfc277d72b827a3432325b9c6460cf14628f9df67d0e4d85R733-R736)
[[4]](diffhunk://#diff-f7139f4cdb523365cfc277d72b827a3432325b9c6460cf14628f9df67d0e4d85R1993-R1996)
[[5]](diffhunk://#diff-d3e4f4cdcef10807a38eab86f6ead6bbfe01980e7326f3cadfeb8186760d7af1R94-R97)
[[6]](diffhunk://#diff-d3e4f4cdcef10807a38eab86f6ead6bbfe01980e7326f3cadfeb8186760d7af1R214-R217)
**Component Propagation and Usage:**
- Modified `ReactionListTop` and `ReactionListBottom` to accept and
prioritize the new override props, falling back to context values if not
provided, and updated their rendering logic to use these customizable
components.
[[1]](diffhunk://#diff-1d5290d5eb1b5942da3dd1386029e3951eb7a08188398c0d943bd16d378da24aL32-R37)
[[2]](diffhunk://#diff-1d5290d5eb1b5942da3dd1386029e3951eb7a08188398c0d943bd16d378da24aR59-R61)
[[3]](diffhunk://#diff-1d5290d5eb1b5942da3dd1386029e3951eb7a08188398c0d943bd16d378da24aL70-R81)
[[4]](diffhunk://#diff-1d5290d5eb1b5942da3dd1386029e3951eb7a08188398c0d943bd16d378da24aR93-R96)
[[5]](diffhunk://#diff-1d5290d5eb1b5942da3dd1386029e3951eb7a08188398c0d943bd16d378da24aL101-R116)
[[6]](diffhunk://#diff-1d5290d5eb1b5942da3dd1386029e3951eb7a08188398c0d943bd16d378da24aL115-R133)
[[7]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6L49-R34)
[[8]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6R58-R59)
[[9]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6L87-R78)
[[10]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6R90-R110)
**Type and Export Updates:**
- Updated type definitions and exports to ensure the new reaction list
component types and props are available for use in other parts of the
codebase and by consumers of the library.
[[1]](diffhunk://#diff-784bafff5d1104bab8f993f0eab47d22373071f35a518685093bf641289b4e38L7-R7)
[[2]](diffhunk://#diff-667ac1eb12bc400d53fad690273567753408afefc69a49fa9869641181e86dd8R109-R111)
[[3]](diffhunk://#diff-327d7452e29943b63019b2b135e4c012a8fcd51a85fa38ec099c55db0d9d2cfeR52-R57)
**Refactoring and Cleanup:**
- Refactored the rendering logic in `ReactionListBottom` and
`ReactionListTop` to use the customizable components, and removed
hardcoded imports and renderers in favor of dynamic, context-driven
rendering.
[[1]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6L1-R4)
[[2]](diffhunk://#diff-926ded9f8a41b99e3b915a72424b44c11631585a26cfc0fa236d68979dafddb6L19-L34)
[[3]](diffhunk://#diff-1d5290d5eb1b5942da3dd1386029e3951eb7a08188398c0d943bd16d378da24aL4-L7)
These changes collectively provide a more modular and extensible
approach to rendering reaction lists, making it easier for developers to
implement custom designs or behaviors for message reactions.1 parent 06b9eed commit b0a5125
File tree
7 files changed
+112
-33
lines changed- package/src
- components
- Channel
- hooks
- Message/MessageSimple/ReactionList
- contexts/messagesContext
7 files changed
+112
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
161 | 165 | | |
162 | 166 | | |
163 | 167 | | |
| |||
393 | 397 | | |
394 | 398 | | |
395 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
396 | 404 | | |
397 | 405 | | |
398 | 406 | | |
| |||
722 | 730 | | |
723 | 731 | | |
724 | 732 | | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
725 | 737 | | |
726 | 738 | | |
727 | 739 | | |
| |||
1978 | 1990 | | |
1979 | 1991 | | |
1980 | 1992 | | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
1981 | 1997 | | |
1982 | 1998 | | |
1983 | 1999 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
| |||
207 | 211 | | |
208 | 212 | | |
209 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
210 | 218 | | |
211 | 219 | | |
212 | 220 | | |
| |||
Lines changed: 33 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | 18 | | |
36 | 19 | | |
37 | 20 | | |
| |||
46 | 29 | | |
47 | 30 | | |
48 | 31 | | |
49 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
50 | 35 | | |
51 | 36 | | |
52 | 37 | | |
| |||
70 | 55 | | |
71 | 56 | | |
72 | 57 | | |
| 58 | + | |
| 59 | + | |
73 | 60 | | |
74 | 61 | | |
75 | 62 | | |
| |||
84 | 71 | | |
85 | 72 | | |
86 | 73 | | |
87 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
88 | 79 | | |
89 | 80 | | |
90 | 81 | | |
| |||
96 | 87 | | |
97 | 88 | | |
98 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
99 | 111 | | |
100 | 112 | | |
101 | 113 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
Lines changed: 26 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | 4 | | |
9 | 5 | | |
10 | 6 | | |
| |||
29 | 25 | | |
30 | 26 | | |
31 | 27 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
| |||
67 | 73 | | |
68 | 74 | | |
69 | 75 | | |
70 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
71 | 82 | | |
72 | 83 | | |
73 | 84 | | |
| |||
79 | 90 | | |
80 | 91 | | |
81 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
82 | 97 | | |
83 | 98 | | |
84 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
109 | 112 | | |
110 | 113 | | |
111 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
| |||
608 | 614 | | |
609 | 615 | | |
610 | 616 | | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
611 | 636 | | |
612 | 637 | | |
613 | 638 | | |
| |||
0 commit comments