@linktr.ee/messaging-react 1.23.0 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -0
- package/dist/index.js +188 -187
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/index.tsx +5 -2
- package/src/types.ts +6 -0
package/package.json
CHANGED
|
@@ -8,6 +8,8 @@ import type { ChannelListProps } from '../../types'
|
|
|
8
8
|
import { ChannelListProvider } from './ChannelListContext'
|
|
9
9
|
import CustomChannelPreview from './CustomChannelPreview'
|
|
10
10
|
|
|
11
|
+
const DEFAULT_SORT = { last_message_at: -1 } as const
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* Channel list component with customizable header and actions
|
|
13
15
|
*/
|
|
@@ -16,6 +18,7 @@ export const ChannelList = React.memo<ChannelListProps>(
|
|
|
16
18
|
onChannelSelect,
|
|
17
19
|
selectedChannel,
|
|
18
20
|
filters,
|
|
21
|
+
sort = DEFAULT_SORT,
|
|
19
22
|
className,
|
|
20
23
|
customEmptyStateIndicator,
|
|
21
24
|
renderMessagePreview,
|
|
@@ -56,9 +59,9 @@ export const ChannelList = React.memo<ChannelListProps>(
|
|
|
56
59
|
<div className="flex-1 overflow-hidden min-w-0">
|
|
57
60
|
<ChannelListProvider value={contextValue}>
|
|
58
61
|
<StreamChannelList
|
|
59
|
-
key={JSON.stringify(filters)}
|
|
62
|
+
key={`${JSON.stringify(filters)}:${JSON.stringify(sort)}`}
|
|
60
63
|
filters={filters}
|
|
61
|
-
sort={
|
|
64
|
+
sort={sort}
|
|
62
65
|
options={{ limit: 30 }}
|
|
63
66
|
Preview={CustomChannelPreview}
|
|
64
67
|
EmptyStateIndicator={customEmptyStateIndicator}
|
package/src/types.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
import type {
|
|
6
6
|
Channel,
|
|
7
7
|
ChannelFilters,
|
|
8
|
+
ChannelSort,
|
|
8
9
|
LocalMessage,
|
|
9
10
|
SendMessageAPIResponse,
|
|
10
11
|
} from 'stream-chat'
|
|
@@ -67,6 +68,11 @@ export interface ChannelListProps {
|
|
|
67
68
|
participantLabel?: string
|
|
68
69
|
className?: string
|
|
69
70
|
filters: ChannelFilters
|
|
71
|
+
/**
|
|
72
|
+
* Sort order for the channel list query.
|
|
73
|
+
* Defaults to `{ last_message_at: -1 }` (most recent first).
|
|
74
|
+
*/
|
|
75
|
+
sort?: ChannelSort
|
|
70
76
|
customEmptyStateIndicator?: React.ComponentType<EmptyStateIndicatorProps>
|
|
71
77
|
renderMessagePreview?: (
|
|
72
78
|
message: LocalMessage | undefined,
|