fix(ui): uxt fixes

This commit is contained in:
nick-delirium 2023-12-04 10:05:59 +01:00
parent 606373a448
commit aaf836ad42
3 changed files with 14 additions and 6 deletions

View file

@ -6,7 +6,7 @@ import SessionItem from 'Shared/SessionItem';
import { Pagination } from 'UI'; import { Pagination } from 'UI';
import { observer } from 'mobx-react-lite'; import { observer } from 'mobx-react-lite';
function LiveTestsModal({ testId }: { testId: string }) { function LiveTestsModal({ testId, closeModal }: { testId: string, closeModal: () => void }) {
const [page, setPage] = React.useState(1); const [page, setPage] = React.useState(1);
const [userId, setUserId] = React.useState(''); const [userId, setUserId] = React.useState('');
const { uxtestingStore } = useStore(); const { uxtestingStore } = useStore();
@ -32,7 +32,7 @@ function LiveTestsModal({ testId }: { testId: string }) {
/> />
</div> </div>
{uxtestingStore.testAssistSessions.list.map((s: any) => ( {uxtestingStore.testAssistSessions.list.map((s: any) => (
<SessionItem key={s.sessionId} session={s} live /> <SessionItem onClick={closeModal} key={s.sessionId} session={s} live />
))} ))}
<div className={'flex items-center justify-between'}> <div className={'flex items-center justify-between'}>
<div> <div>

View file

@ -121,7 +121,7 @@ function TestEdit() {
}, },
{ {
label: uxtestingStore.instance.title, label: uxtestingStore.instance.title,
to: withSiteId(usabilityTestingView(testId), siteId), to: isPublished ? withSiteId(usabilityTestingView(testId), siteId) : undefined,
}, },
{ {
label: 'Edit', label: 'Edit',

View file

@ -63,7 +63,7 @@ const menuItems = [
function TestOverview() { function TestOverview() {
// @ts-ignore // @ts-ignore
const { siteId, testId } = useParams(); const { siteId, testId } = useParams();
const { showModal } = useModal(); const { showModal, hideModal } = useModal();
const { uxtestingStore } = useStore(); const { uxtestingStore } = useStore();
usePageTitle(`Usability Tests | ${uxtestingStore.instance?.title || ''}`); usePageTitle(`Usability Tests | ${uxtestingStore.instance?.title || ''}`);
@ -105,7 +105,7 @@ function TestOverview() {
the moment. the moment.
</Typography.Text> </Typography.Text>
<Button onClick={() => { <Button onClick={() => {
showModal(<LiveTestsModal testId={testId} />, { right: true, width: 900 }) showModal(<LiveTestsModal closeModal={hideModal} testId={testId} />, { right: true, width: 900 })
}}> }}>
<Space align={'center'}> <Space align={'center'}>
Moderate Real-Time Moderate Real-Time
@ -290,6 +290,7 @@ const TaskSummary = observer(() => {
}); });
const Title = observer(({ testId, siteId }: any) => { const Title = observer(({ testId, siteId }: any) => {
const [truncate, setTruncate] = React.useState(true);
const { uxtestingStore } = useStore(); const { uxtestingStore } = useStore();
const history = useHistory(); const history = useHistory();
@ -317,6 +318,12 @@ const Title = observer(({ testId, siteId }: any) => {
} }
} }
}; };
if (!uxtestingStore.instance) {
return null;
}
const truncatedDescr = uxtestingStore.instance.description.length > 250 && truncate ? uxtestingStore.instance?.description.substring(0, 250) + '...' : uxtestingStore.instance?.description;
const redirectToEdit = async () => { const redirectToEdit = async () => {
if ( if (
await confirm({ await confirm({
@ -388,8 +395,9 @@ const Title = observer(({ testId, siteId }: any) => {
</Dropdown> </Dropdown>
</div> </div>
<div className={'whitespace-pre-wrap'}> <div className={'whitespace-pre-wrap'}>
{uxtestingStore.instance!.description} {truncatedDescr}
</div> </div>
{uxtestingStore.instance.description.length > 250 ? (<div className={'link'} onClick={() => setTruncate(!truncate)}>{truncate ? 'Show more' : 'Show less'}</div>) : null}
</div> </div>
); );
}); });