@@ -3,7 +3,15 @@ import React, { useEffect, useState } from 'react';
33import pkg from '../../../../package-lock.json'
44
55import App from '../index' ;
6+ import Sendbird from '../../../lib/Sendbird' ;
7+ import ChannelList from '../../ChannelList' ;
8+ import Conversation from '../../Conversation' ;
9+ import ChannelSettings from '../../ChannelSettings' ;
10+ import MessageSearch from '../../MessageSearch' ;
11+ import { withSendBird } from '../../..' ;
12+ import { sendBirdSelectors } from '../../..' ;
613import { fitPageSize } from './utils' ;
14+
715const appId = process . env . STORYBOOK_APP_ID ;
816// const userId = 'leo.sub';
917const userId = 'sendbird' ;
@@ -159,6 +167,7 @@ const array = [
159167 `hoon${ age } 1` ,
160168 `hoon${ age } 2` ,
161169 `hoon${ age } 3` ,
170+ `eunseo${ age } 1` ,
162171] ;
163172const addProfile = null ; // 'https://static.sendbird.com/sample/profiles/profile_12_512px.png';
164173
@@ -186,6 +195,7 @@ export const user1 = () => fitPageSize(
186195 allowProfileEdit
187196 profileUrl = { addProfile }
188197 config = { { logLevel : 'all' } }
198+ queries = { { } }
189199 />
190200) ;
191201export const user2 = ( ) => fitPageSize (
@@ -216,6 +226,83 @@ export const user3 = () => fitPageSize(
216226 />
217227) ;
218228
229+ const UseSendbirdChannelList = ( props ) => {
230+ const [ queries ] = useState ( { channelListQuery : { customTypesFilter : [ 'apple' ] } } ) ;
231+ const sdk = sendBirdSelectors . getSdk ( props ) ;
232+ const { setChannelUrl } = props ;
233+
234+ return (
235+ < ChannelList
236+ onChannelSelect = { ( channel ) => channel && setChannelUrl ( channel . url ) }
237+ queries = { queries }
238+ onBeforeCreateChannel = { ( selectedUserIds ) => {
239+ const params = new sdk . GroupChannelParams ( ) ;
240+ params . addUserIds ( selectedUserIds ) ;
241+ params . isDistinct = false ;
242+ params . customType = 'apple' ;
243+ return params ;
244+ } }
245+ />
246+ ) ;
247+ } ;
248+ const SBChannelList = withSendBird ( UseSendbirdChannelList ) ;
249+ const CustomApp = ( ) => {
250+ const [ channelUrl , setChannelUrl ] = useState ( '' ) ;
251+ const [ channelSettings , setChannelSettings ] = useState ( false ) ;
252+ const [ channelSearch , setChannelSearch ] = useState ( false ) ;
253+ return (
254+ < Sendbird
255+ appId = { appId }
256+ userId = { array [ 3 ] }
257+ nickname = { array [ 3 ] }
258+ theme = "dark"
259+ showSearchIcon
260+ allowProfileEdit
261+ profileUrl = { addProfile }
262+ imageCompression = { { compressionRate : 0.5 , resizingWidth : 100 , resizingHeight : '100px' } }
263+ >
264+ < div style = { { height : '100%' , width : '100%' , display : 'flex' , flexDirection : 'row' } } >
265+ < SBChannelList setChannelUrl = { setChannelUrl } />
266+ < div style = { { height : '100%' , width : '100%' , display : 'inline-flex' , flexDirection : 'row' } } >
267+ < div style = { { width : '100%' } } >
268+ < Conversation
269+ channelUrl = { channelUrl }
270+ onChatHeaderActionClick = { ( ) => {
271+ setChannelSearch ( false ) ;
272+ setChannelSettings ( true ) ;
273+ } }
274+ showSearchIcon
275+ onSearchClick = { ( ) => {
276+ setChannelSettings ( false ) ;
277+ setChannelSearch ( true ) ;
278+ } }
279+ />
280+ </ div >
281+ { channelSearch && (
282+ < div style = { { width : '100%' } } >
283+ < MessageSearch
284+ channelUrl = { channelUrl }
285+ searchString = "hello"
286+ onResultClick = { ( ) => { } }
287+ />
288+ </ div >
289+ ) }
290+ { channelSettings && (
291+ < div style = { { display : 'inline-flex' } } >
292+ < ChannelSettings
293+ channelUrl = { channelUrl }
294+ onCloseClick = { ( ) => setChannelSettings ( false ) }
295+ />
296+ </ div >
297+ ) }
298+ </ div >
299+ </ div >
300+ </ Sendbird >
301+ ) ;
302+ } ;
303+
304+ export const customer1 = ( ) => fitPageSize ( < CustomApp /> ) ;
305+
219306export const disableUserProfile = ( ) => fitPageSize (
220307 < App
221308 showSearchIcon
0 commit comments