@@ -7,38 +7,50 @@ import { useMediaQueryContext } from '../../lib/MediaQueryContext';
7
7
import { DesktopLayout } from './DesktopLayout' ;
8
8
import { MobileLayout } from './MobileLayout' ;
9
9
10
+ import useSendbirdStateContext from '../../hooks/useSendbirdStateContext' ;
11
+
10
12
export const AppLayout : React . FC < AppLayoutProps > = (
11
13
props : AppLayoutProps ,
12
14
) => {
13
15
const {
14
- isReactionEnabled,
15
- replyType,
16
16
isMessageGroupingEnabled,
17
17
allowProfileEdit,
18
- showSearchIcon,
19
18
onProfileEditSuccess,
20
19
disableAutoSelect,
21
20
currentChannel,
22
21
setCurrentChannel,
23
22
} = props ;
23
+
24
+ const globalStore = useSendbirdStateContext ( ) ;
25
+ const globalConfigs = globalStore ?. config ;
26
+
24
27
const [ showThread , setShowThread ] = useState ( false ) ;
25
28
const [ threadTargetMessage , setThreadTargetMessage ] = useState < UserMessage | FileMessage | null > ( null ) ;
26
29
const [ showSettings , setShowSettings ] = useState ( false ) ;
27
30
const [ showSearch , setShowSearch ] = useState ( false ) ;
28
31
const [ highlightedMessage , setHighlightedMessage ] = useState < number | null > ( null ) ;
29
32
const [ startingPoint , setStartingPoint ] = useState < number | null > ( null ) ;
30
33
const { isMobile } = useMediaQueryContext ( ) ;
34
+
35
+ /**
36
+ * Below configs can be set via Dashboard UIKit config setting but as a lower priority than App props.
37
+ * So need to be have fallback value \w global configs even though each prop values are undefined
38
+ */
39
+ const replyType = props . replyType ?? globalConfigs ?. replyType ;
40
+ const isReactionEnabled = props . isReactionEnabled ?? globalConfigs ?. isReactionEnabled ;
41
+ const showSearchIcon = props . showSearchIcon ?? globalConfigs ?. showSearchIcon ;
42
+
31
43
return (
32
44
< >
33
45
{
34
46
isMobile
35
47
? (
36
48
< MobileLayout
37
49
replyType = { replyType }
50
+ showSearchIcon = { showSearchIcon }
51
+ isReactionEnabled = { isReactionEnabled }
38
52
isMessageGroupingEnabled = { isMessageGroupingEnabled }
39
53
allowProfileEdit = { allowProfileEdit }
40
- isReactionEnabled = { isReactionEnabled }
41
- showSearchIcon = { showSearchIcon }
42
54
onProfileEditSuccess = { onProfileEditSuccess }
43
55
currentChannel = { currentChannel }
44
56
setCurrentChannel = { setCurrentChannel }
@@ -52,11 +64,11 @@ export const AppLayout: React.FC<AppLayoutProps> = (
52
64
)
53
65
: (
54
66
< DesktopLayout
55
- isReactionEnabled = { isReactionEnabled }
56
67
replyType = { replyType }
68
+ isReactionEnabled = { isReactionEnabled }
69
+ showSearchIcon = { showSearchIcon }
57
70
isMessageGroupingEnabled = { isMessageGroupingEnabled }
58
71
allowProfileEdit = { allowProfileEdit }
59
- showSearchIcon = { showSearchIcon }
60
72
onProfileEditSuccess = { onProfileEditSuccess }
61
73
disableAutoSelect = { disableAutoSelect }
62
74
currentChannel = { currentChannel }
0 commit comments