From d054e39165eb5ab773d5bdcbc45cf8cb7c9d2cbc Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Fri, 1 Dec 2023 13:54:47 +0100 Subject: [PATCH] fix(ui): uxt fixes --- .../components/UsabilityTesting/TestEdit.tsx | 1 - .../UsabilityTesting/TestOverview.tsx | 156 +++++++++--------- .../UsabilityTesting/UsabilityTesting.tsx | 18 +- frontend/app/services/UxtestingService.ts | 2 +- 4 files changed, 91 insertions(+), 86 deletions(-) diff --git a/frontend/app/components/UsabilityTesting/TestEdit.tsx b/frontend/app/components/UsabilityTesting/TestEdit.tsx index dd3827ba2..80ba4fe1d 100644 --- a/frontend/app/components/UsabilityTesting/TestEdit.tsx +++ b/frontend/app/components/UsabilityTesting/TestEdit.tsx @@ -66,7 +66,6 @@ function TestEdit() { }); } else { uxtestingStore.createNewTest(isPreview).then((test) => { - console.log(test); if (isPreview) { window.open(`${test.startingPath}?oruxt=${test.testId}`, '_blank', 'noopener,noreferrer'); history.push(withSiteId(usabilityTestingEdit(test.testId), siteId)); diff --git a/frontend/app/components/UsabilityTesting/TestOverview.tsx b/frontend/app/components/UsabilityTesting/TestOverview.tsx index 2759ff284..c60658c9d 100644 --- a/frontend/app/components/UsabilityTesting/TestOverview.tsx +++ b/frontend/app/components/UsabilityTesting/TestOverview.tsx @@ -1,5 +1,5 @@ import { durationFormatted } from 'App/date'; -import usePageTitle from "App/hooks/usePageTitle"; +import usePageTitle from 'App/hooks/usePageTitle'; import { numberWithCommas } from 'App/utils'; import { getPdf2 } from 'Components/AssistStats/pdfGenerator'; import { useModal } from 'Components/Modal'; @@ -36,10 +36,10 @@ import ResponsesOverview from './ResponsesOverview'; const { Option } = Select; const statusItems = [ - { value: 'preview', label: 'Preview', icon: }, - { value: 'in-progress', label: 'In Progress', icon: }, - { value: 'paused', label: 'Pause', icon: }, - { value: 'closed', label: 'End Testing', icon: }, + { value: 'preview', label: 'Draft', icon: }, + { value: 'in-progress', label: 'Ongoing', icon: }, + { value: 'paused', label: 'On Hold', icon: }, + { value: 'closed', label: 'Closed', icon: }, ]; const menuItems = [ @@ -71,7 +71,6 @@ function TestOverview() { uxtestingStore.getTest(testId); }, [testId]); - if (!uxtestingStore.instance) { return No data.; } @@ -81,7 +80,7 @@ function TestOverview() { }; return ( -
+
-
Open-ended task responses @@ -192,9 +190,7 @@ const ParticipantOverview = observer(() => { Total Participants
- - {uxtestingStore.testStats.tests_attempts} - + {uxtestingStore.testStats.tests_attempts}
@@ -207,7 +203,7 @@ const ParticipantOverview = observer(() => { {Math.round( (uxtestingStore.testStats.completed_all_tasks / uxtestingStore.testStats.tests_attempts) * - 100 + 100 )} % @@ -226,7 +222,7 @@ const ParticipantOverview = observer(() => { {Math.round( (uxtestingStore.testStats.tasks_skipped / uxtestingStore.testStats.tests_attempts) * - 100 + 100 )} % @@ -245,7 +241,7 @@ const ParticipantOverview = observer(() => { {Math.round( (uxtestingStore.testStats.tests_skipped / uxtestingStore.testStats.tests_attempts) * - 100 + 100 )} % @@ -257,8 +253,8 @@ const ParticipantOverview = observer(() => {
) : null}
- ) -}) + ); +}); const TaskSummary = observer(() => { const { uxtestingStore } = useStore(); @@ -273,11 +269,11 @@ const TaskSummary = observer(() => { {uxtestingStore.taskStats ? durationFormatted( - uxtestingStore.taskStats.reduce( - (stats, task) => stats + task.avgCompletionTime, - 0 - ) / uxtestingStore.taskStats.length - ) + uxtestingStore.taskStats.reduce( + (stats, task) => stats + task.avgCompletionTime, + 0 + ) / uxtestingStore.taskStats.length + ) : null} @@ -289,8 +285,8 @@ const TaskSummary = observer(() => { ))}
- ) -}) + ); +}); const Title = observer(({ testId, siteId }: any) => { const { uxtestingStore } = useStore(); @@ -333,65 +329,67 @@ const Title = observer(({ testId, siteId }: any) => { }; return ( -
-
+
+
{uxtestingStore.instance!.title} -
{uxtestingStore.instance!.description}
-
-
- - - -
- {`${uxtestingStore.instance!.startingPath}?oruxt=${ - uxtestingStore.instance!.testId - }`} -
- -
- } - > - - - - - + +
+ {`${uxtestingStore.instance!.startingPath}?oruxt=${ + uxtestingStore.instance!.testId + }`} +
+ +
+ } + > + + + + + +
+
+ {uxtestingStore.instance!.description} +
- ) -}) + ); +}); export default observer(TestOverview); diff --git a/frontend/app/components/UsabilityTesting/UsabilityTesting.tsx b/frontend/app/components/UsabilityTesting/UsabilityTesting.tsx index b893759a3..0982fa5e7 100644 --- a/frontend/app/components/UsabilityTesting/UsabilityTesting.tsx +++ b/frontend/app/components/UsabilityTesting/UsabilityTesting.tsx @@ -172,21 +172,22 @@ const statusMap = { preview: "Preview", 'in-progress': "In progress", paused: "Paused", - completed: "Completed", + closed: "Completed", } function Row({ test }: { test: UxTListEntry }) { const link = usabilityTestingView(test.testId.toString()) + const editLink = usabilityTestingEdit(test.testId.toString()) return (
} /> -
- +
+ {test.title} -
+
{test.description}
@@ -195,12 +196,19 @@ function Row({ test }: { test: UxTListEntry }) { {test.createdBy.name} {checkForRecent(getDateFromMill(test.updatedAt)!, 'LLL dd, yyyy, hh:mm a')} - {statusMap[test.status]} + {statusMap[test.status]}
); } +const colors = { + 'in-progress': 'green', + closed: 'geekblue', + paused: 'grey', + preview: 'orange', +} as const + function Cell({ size, children }: { size: number; children?: React.ReactNode }) { return
{children}
; } diff --git a/frontend/app/services/UxtestingService.ts b/frontend/app/services/UxtestingService.ts index f768a482c..19c177935 100644 --- a/frontend/app/services/UxtestingService.ts +++ b/frontend/app/services/UxtestingService.ts @@ -35,7 +35,7 @@ export interface UxTest { export interface UxTListEntry { createdAt: string; - status: 'preview' | 'in-progress' | 'paused' | 'completed'; + status: 'preview' | 'in-progress' | 'paused' | 'closed'; createdBy: { userId: number; name: string;