import { useRecoilValue } from 'recoil'; import cn from 'classnames'; import { EyeFilled } from '@ant-design/icons'; import { useEffect } from 'react'; import { ClientConfig } from '../../../interfaces/client-config.model'; import { clientConfigStateAtom, isOnlineSelector, serverStatusState, } from '../../stores/ClientConfigStore'; import { ServerLogo } from '../../ui'; import CategoryIcon from '../../ui/CategoryIcon/CategoryIcon'; import SocialLinks from '../../ui/SocialLinks/SocialLinks'; import s from './StreamInfo.module.scss'; import { ServerStatus } from '../../../interfaces/server-status.model'; interface Props { isMobile: boolean; } export default function StreamInfo({ isMobile }: Props) { const { socialHandles, name, title, tags, summary } = useRecoilValue(clientConfigStateAtom); const { viewerCount } = useRecoilValue(serverStatusState); const online = useRecoilValue(isOnlineSelector); useEffect(() => { console.log({ online }); }, [online]); return isMobile ? (
{name}
{online && ( <> {viewerCount} )}
{online &&
} {online ? 'LIVE' : 'OFFLINE'}
) : (
{name}
{title || summary}
{tags.length > 0 && tags.map(tag => #{tag} )}
); }