@ -17,6 +17,7 @@ import {
isOnlineSelector ,
isOnlineSelector ,
isMobileAtom ,
isMobileAtom ,
serverStatusState ,
serverStatusState ,
isChatAvailableSelector ,
} from '../../stores/ClientConfigStore' ;
} from '../../stores/ClientConfigStore' ;
import { ClientConfig } from '../../../interfaces/client-config.model' ;
import { ClientConfig } from '../../../interfaces/client-config.model' ;
@ -97,6 +98,7 @@ export const Content: FC = () => {
const [ isMobile , setIsMobile ] = useRecoilState < boolean | undefined > ( isMobileAtom ) ;
const [ isMobile , setIsMobile ] = useRecoilState < boolean | undefined > ( isMobileAtom ) ;
const messages = useRecoilValue < ChatMessage [ ] > ( chatMessagesAtom ) ;
const messages = useRecoilValue < ChatMessage [ ] > ( chatMessagesAtom ) ;
const online = useRecoilValue < boolean > ( isOnlineSelector ) ;
const online = useRecoilValue < boolean > ( isOnlineSelector ) ;
const isChatAvailable = useRecoilValue < boolean > ( isChatAvailableSelector ) ;
const { viewerCount , lastConnectTime , lastDisconnectTime , streamTitle } =
const { viewerCount , lastConnectTime , lastDisconnectTime , streamTitle } =
useRecoilValue < ServerStatus > ( serverStatusState ) ;
useRecoilValue < ServerStatus > ( serverStatusState ) ;
@ -180,7 +182,7 @@ export const Content: FC = () => {
setSupportsBrowserNotifications ( isPushNotificationSupported ( ) && browserNotificationsEnabled ) ;
setSupportsBrowserNotifications ( isPushNotificationSupported ( ) && browserNotificationsEnabled ) ;
} , [ browserNotificationsEnabled ] ) ;
} , [ browserNotificationsEnabled ] ) ;
const showChat = onlin e && ! chatDisabled && isChatVisible ;
const showChat = isChatAvailabl e && ! chatDisabled && isChatVisible ;
// accounts for sidebar width when online in desktop
// accounts for sidebar width when online in desktop
const dynamicPadding = showChat && ! isMobile ? '320px' : '0px' ;
const dynamicPadding = showChat && ! isMobile ? '320px' : '0px' ;
@ -303,22 +305,21 @@ export const Content: FC = () => {
handleClose = { ( ) = > setShowFollowModal ( false ) }
handleClose = { ( ) = > setShowFollowModal ( false ) }
/ >
/ >
< / Modal >
< / Modal >
{ showChatModal && isChatVisible && (
{ isMobile && showChatModal && isChatVisible && (
< ChatModal
< ChatModal
messages = { messages }
messages = { messages }
currentUser = { currentUser }
currentUser = { currentUser }
handleClose = { ( ) = > setShowChatModal ( false ) }
handleClose = { ( ) = > setShowChatModal ( false ) }
/ >
/ >
) }
) }
{ isChatVisi ble && (
{ isMobile && isChatAvaila ble && (
< Button
< Button
id = "mobile-chat-button"
id = "mobile-chat-button"
type = "primary"
type = "primary"
onClick = { ( ) = > setShowChatModal ( true ) }
onClick = { ( ) = > setShowChatModal ( true ) }
className = { styles . floatingMobileChatModalButton }
className = { styles . floatingMobileChatModalButton }
style = { { zIndex : 99 } }
>
>
Chat < MessageFilled style = { { transform : 'translateX(-1px)' } } / >
Chat < MessageFilled / >
< / Button >
< / Button >
) }
) }
< / >
< / >