1+ import React , { useCallback , useMemo } from 'react' ;
12import uniqBy from 'lodash.uniqby' ;
2- import React , { ComponentType , useCallback , useMemo } from 'react' ;
3+ import type { ComponentType } from 'react' ;
4+ import type { Channel , MessageResponse , User } from 'stream-chat' ;
35
46import { useSearchContext } from '../SearchContext' ;
57import { Avatar } from '../../../components/Avatar' ;
68import { ChannelPreview } from '../../../components/ChannelPreview' ;
79import { useChannelListContext , useChatContext } from '../../../context' ;
8-
910import { DEFAULT_JUMP_TO_PAGE_SIZE } from '../../../constants/limits' ;
1011
11- import type { Channel , MessageResponse , User } from 'stream-chat' ;
12- import type { DefaultStreamChatGenerics } from '../../../types' ;
13-
14- export type ChannelSearchResultItemProps <
15- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
16- > = {
17- item : Channel < StreamChatGenerics > ;
12+ export type ChannelSearchResultItemProps = {
13+ item : Channel ;
1814} ;
1915
20- export const ChannelSearchResultItem = <
21- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
22- > ( {
23- item,
24- } : ChannelSearchResultItemProps < StreamChatGenerics > ) => {
25- const { setActiveChannel } = useChatContext < StreamChatGenerics > ( ) ;
26- const { setChannels } = useChannelListContext < StreamChatGenerics > ( ) ;
16+ export const ChannelSearchResultItem = ( { item } : ChannelSearchResultItemProps ) => {
17+ const { setActiveChannel } = useChatContext ( ) ;
18+ const { setChannels } = useChannelListContext ( ) ;
2719
2820 const onSelect = useCallback ( ( ) => {
2921 setActiveChannel ( item ) ;
@@ -39,24 +31,20 @@ export const ChannelSearchResultItem = <
3931 ) ;
4032} ;
4133
42- export type ChannelByMessageSearchResultItemProps <
43- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
44- > = {
45- item : MessageResponse < StreamChatGenerics > ;
34+ export type ChannelByMessageSearchResultItemProps = {
35+ item : MessageResponse ;
4636} ;
4737
48- export const MessageSearchResultItem = <
49- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
50- > ( {
38+ export const MessageSearchResultItem = ( {
5139 item,
52- } : ChannelByMessageSearchResultItemProps < StreamChatGenerics > ) => {
40+ } : ChannelByMessageSearchResultItemProps ) => {
5341 const {
5442 channel : activeChannel ,
5543 client,
5644 searchController,
5745 setActiveChannel,
58- } = useChatContext < StreamChatGenerics > ( ) ;
59- const { setChannels } = useChannelListContext < StreamChatGenerics > ( ) ;
46+ } = useChatContext ( ) ;
47+ const { setChannels } = useChannelListContext ( ) ;
6048
6149 const channel = useMemo ( ( ) => {
6250 const { channel : channelData } = item ;
@@ -97,20 +85,14 @@ export const MessageSearchResultItem = <
9785 ) ;
9886} ;
9987
100- export type UserSearchResultItemProps <
101- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
102- > = {
103- item : User < StreamChatGenerics > ;
88+ export type UserSearchResultItemProps = {
89+ item : User ;
10490} ;
10591
106- export const UserSearchResultItem = <
107- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
108- > ( {
109- item,
110- } : UserSearchResultItemProps < StreamChatGenerics > ) => {
111- const { client, setActiveChannel } = useChatContext < StreamChatGenerics > ( ) ;
112- const { setChannels } = useChannelListContext < StreamChatGenerics > ( ) ;
113- const { directMessagingChannelType } = useSearchContext < StreamChatGenerics > ( ) ;
92+ export const UserSearchResultItem = ( { item } : UserSearchResultItemProps ) => {
93+ const { client, setActiveChannel } = useChatContext ( ) ;
94+ const { setChannels } = useChannelListContext ( ) ;
95+ const { directMessagingChannelType } = useSearchContext ( ) ;
11496
11597 const onClick = useCallback ( ( ) => {
11698 const newChannel = client . channel ( directMessagingChannelType , {
0 commit comments