import React from 'react'; import { useStore } from 'App/mstore'; import { numberWithCommas } from 'App/utils'; import { Input } from 'antd'; import ReloadButton from 'Shared/ReloadButton'; import SessionItem from 'Shared/SessionItem'; import { Loader, Pagination } from 'UI'; import { observer } from 'mobx-react-lite'; import { useTranslation } from 'react-i18next'; function LiveTestsModal({ testId, closeModal, }: { testId: string; closeModal: () => void; }) { const { t } = useTranslation(); const [page, setPage] = React.useState(1); const [isLoading, setIsLoading] = React.useState(false); const [userId, setUserId] = React.useState(''); const { uxtestingStore } = useStore(); React.useEffect(() => { uxtestingStore.getAssistSessions(testId, page, undefined); }, []); const refreshData = (page: number) => { setIsLoading(true); setPage(page); uxtestingStore .getAssistSessions(testId, page, userId) .then(() => setIsLoading(false)) .catch(() => setIsLoading(false)); }; return (
refreshData(page)} />
{t('Live Participants')}
setUserId(e.target.value)} onSearch={() => refreshData(page)} />
{uxtestingStore.testAssistSessions.list.map((s: any) => ( ))}
{t('Showing')}  {(page - 1) * 10 + 1} {t('to')}{' '} {(page - 1) * 10 + uxtestingStore.testAssistSessions.list.length} {' '} {t('of')}{' '} {numberWithCommas(uxtestingStore.testAssistSessions.total)} {' '} {t('ongoing tests.')}
); } export default observer(LiveTestsModal);