;
}
const onSave = (isPreview?: boolean) => {
setHasChanged(false);
if (testId && testId !== 'new') {
uxtestingStore.updateTest(uxtestingStore.instance!, isPreview).then((testId) => {
if (isPreview) {
window.open(
`${uxtestingStore.instance!.startingPath}?oruxt=${testId}`,
'_blank',
'noopener,noreferrer'
);
} else {
toast.success('The usability test is now live and accessible to participants.');
history.push(withSiteId(usabilityTestingView(testId!.toString()), siteId));
}
});
} else {
uxtestingStore.createNewTest(isPreview).then((test) => {
if (isPreview) {
window.open(`${test.startingPath}?oruxt=${test.testId}`, '_blank', 'noopener,noreferrer');
history.replace(withSiteId(usabilityTestingEdit(test.testId), siteId));
} else {
history.push(withSiteId(usabilityTestingView(test.testId), siteId));
}
});
}
};
const onClose = (confirmed: boolean) => {
if (confirmed) {
uxtestingStore.instance!.setProperty('title', newTestTitle);
uxtestingStore.instance!.setProperty('description', newTestDescription);
}
setNewTestDescription('');
setNewTestTitle('');
setIsModalVisible(false);
};
const onMenuClick = async ({ key }: { key: string }) => {
if (key === '1') {
setNewTestTitle(uxtestingStore.instance!.title);
setNewTestDescription(uxtestingStore.instance!.description);
setIsModalVisible(true);
}
if (key === '2') {
if (
await confirm({
confirmation:
'Are you sure you want to delete this usability test? This action cannot be undone.',
})
) {
uxtestingStore.deleteTest(testId).then(() => {
history.push(withSiteId(usabilityTesting(), siteId));
});
}
}
};
const isPublished =
uxtestingStore.instance.status !== undefined && uxtestingStore.instance.status !== 'preview';
const isStartingPointValid = isValidUrl(uxtestingStore.instance.startingPath);
return (
{
return 'You have unsaved changes. Are you sure you want to leave?';
}}
/>
onClose(true)}
onCancel={() => onClose(false)}
footer={
}
>
Title
{
setHasChanged(true);
setNewTestTitle(e.target.value);
}}
/>
Test Objective (optional) {
setHasChanged(true);
setNewTestDescription(e.target.value);
}}
placeholder="Share a brief statement about what you aim to discover through this study."
/>
🏁 Starting point
{
setHasChanged(true);
if (!e.target.value.startsWith('https://')) {
e.target.value = 'https://';
}
uxtestingStore.instance!.setProperty('startingPath', e.target.value);
}}
/>
{uxtestingStore.instance!.startingPath === 'https://' || isStartingPointValid ? (
Test will begin on this page.
) : (
Starting point URL is invalid.
)}
📖 Introduction and Guidelines for Participants
{isOverviewEditing ? (
{
setHasChanged(true);
setGuidelines(e.target.value);
}}
/>
) : (
{uxtestingStore.instance?.guidelines?.length
? uxtestingStore.instance.guidelines
: 'Provide an overview of this usability test to and input guidelines that can be of assistance to users at any point during the test.'}