feat(assessment): Rebuild UI with new design - #264
Conversation
Replaces the tabbed Datasets/Config/Result surface with the approved v2 design: a two-panel Home (assessors | runs) and one 4-step wizard (Submission → Pre-filter → Assessment → Run) with new / edit-version / run entry modes. - prompt editor: two zones per step, token highlighting, two-stage @-mentions (column → Text/Image/PDF), live preview, split pane, anchored scroll sync - per-step model picker; Review & save bumps a version, gated on a real diff - results: row-detail modal, CSV export, polling until terminal status - moves onto /api/assessment/batch; fetchers split into lib/assessment/api/*, configBlob maps the wizard draft to the stored ASSESSMENT config blob - column mapping dropped — text and attachment columns come from prompt tokens - retires the legacy wizard and the 1-4 config fan-out (~6.7k LOC removed) Refs #263
|
Important Review skippedToo many files! This PR contains 151 files, which is 51 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (151)
You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CI runs `npm run format:check` before linting; ten files in the previous commit were not Prettier-clean. Formatting only, no behaviour change.
Props interfaces and hook result types were declared inline across the assessment module, several of them imported by a second file. Moves them to the domain type files so each shape has one home: - prompt.ts: editor zones, mentions, preview, model picker - home.ts: panels, rows, version chips, delete target - wizard.ts: steps, footer, modals, stepper - submission.ts: list, create panel, submission hook results - results.ts: toolbar, table, row modal, spreadsheet, view mode Also drops the props types the retired legacy components left behind (ColumnMapperStepProps, PromptPanelProps, ConfigPanelProps and friends), the unused imports the moves exposed, and trims an over-long comment. Scoped to files this branch already touches. Refs #263
Fallout the prop-type centralization exposed:
- workflow.ts: remove AssessmentFormState, PromptPanelProps,
ResponseSchemaProps and ConfigPanelProps — props for the components
retired when the wizard shell replaced ConfigPanel/SubViewBar.
Nothing imports them (99 -> 28 LOC). PageLayoutProps and
PostProcessing{Step,Panel}Props are still referenced and stay.
- Stepper.tsx, HomePanel.tsx: remove `import {} from "react"`, left
empty when their last named import moved to a type file.
Scoped to files this branch already touches.
Refs #263
The runs list is ordered by inserted_at (newest first, done in the API), but the row meta rendered updated_at. A run created yesterday and touched by a status transition a minute ago read "2m ago" while sitting below newer rows, so the list looked unsorted. Show "Started <inserted_at>" instead, matching the API's sort key. Ordering stays entirely server-side; no client-side sort added. AssessorRow keeps updated_at — a version bump is genuinely an update there, and that list is ordered separately. Refs #263
Run step (step 4): - Add a Preview button beside the submission select, showing at most 10 rows (RUN_PREVIEW_ROW_LIMIT) in the existing DataViewModal via the cached preview loader step 1 already uses. Passes an explicit subtitle so the modal reports "First 10 of N rows" rather than claiming the set only has 10. Step 1's View is unchanged. - Block Run while a file sits in the inline upload form uncreated. Previously the run went ahead against the previously selected set and the upload was silently dropped. The footer now disables the primary and explains why. - Collapsing "Upload new" resets the form, and CreatePanel takes an optional onCancel, so a pending file can't linger behind a closed panel and block Run with no visible cause. wizardFooterState now takes a params object; four positional arguments including two booleans had become unreadable. Refs #263
| import ResultRowModal from "@/app/components/assessment/results/ResultRowModal"; | ||
| import ResultsTable from "@/app/components/assessment/results/ResultsTable"; | ||
| import ResultsToolbar from "@/app/components/assessment/results/ResultsToolbar"; | ||
| import { useRunResults } from "@/app/hooks/useRunResults"; |
There was a problem hiding this comment.
import this inside the index.js and then import from that file. and use like this:
import { useRunResults } from "@/app/hooks";
instead of the import every file.
| import ResultRowModal from "@/app/components/assessment/results/ResultRowModal"; | ||
| import ResultsTable from "@/app/components/assessment/results/ResultsTable"; | ||
| import ResultsToolbar from "@/app/components/assessment/results/ResultsToolbar"; |
| cancelled = true; | ||
| }; | ||
| }, [apiKey, isAuthenticated, isHydrated, runId, toast]); | ||
| const assessmentId = params?.runId ?? ""; |
There was a problem hiding this comment.
is optional channing needed here?
|
|
||
| const BATCH_ENDPOINT = "/api/v1/assessments"; | ||
|
|
||
| /** GET /api/assessment/batch — list assessments, optionally by config + version. */ |
There was a problem hiding this comment.
| /** GET /api/assessment/batch — list assessments, optionally by config + version. */ |
| } | ||
| } | ||
|
|
||
| /** POST /api/assessment/batch — submit a batch assessment run. */ |
There was a problem hiding this comment.
| /** POST /api/assessment/batch — submit a batch assessment run. */ |
| p: "mb-2.5 text-sm leading-7 text-text-primary", | ||
| }; | ||
|
|
||
| /** Read-only mirror of the prompt the model will see, filled with row 1. */ |
There was a problem hiding this comment.
| /** Read-only mirror of the prompt the model will see, filled with row 1. */ |
| return `/assessment/results/${assessment.assessment_id}?${query}`; | ||
| } | ||
|
|
||
| /** Export / View results, per the run's status. Retry has no BATCH endpoint yet. */ |
There was a problem hiding this comment.
not need these type of the comment in the every component and if you want to add then add the high lebal simple what this component do.
| return ( | ||
| <> | ||
| <p className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-text-secondary"> | ||
| {/* Creation time, not updated_at — the API orders this list by inserted_at. */} |
There was a problem hiding this comment.
| {/* Creation time, not updated_at — the API orders this list by inserted_at. */} |
| @@ -0,0 +1,96 @@ | |||
| // BATCH assessment API shapes. Field names mirror the backend. | |||
There was a problem hiding this comment.
remove these all unwanted comments.
| @@ -0,0 +1,113 @@ | |||
| // Assessment types: the data-source contract shared by the mock fixture and the API layer. | |||
There was a problem hiding this comment.
remove these too from all the types files.
Review comments from #264: - Export the assessment hooks from app/hooks/index.ts and import them from "@/app/hooks" rather than reaching past the barrel. Hook-to-hook imports keep their deep paths so the barrel doesn't import itself. - Drop optional chaining on useParams in the results page. Next types it as non-nullable, so the fallback was dead code. - Remove comments from the assessment type files, the components and the batch route handlers. Algorithm notes under lib/assessment and hooks are kept: they explain non-obvious behaviour rather than restating the code. Refs #263
emptyDraft() starts a new assessor with prefilterEnabled false, so the optional step is opt-in rather than opt-out. Only the new-assessor flow changes. draftFromVersion still derives the toggle from the saved blob, so reopening a version that has a pre-filter configured still opens with it on. Refs #263
a1d8096 to
e26ac70
Compare
…ndling and validation
The results page showed two identical headers in spreadsheet mode: ResultsToolbar rendered one, and SpreadsheetView rendered its own title, subtitle and a second Download CSV. SpreadsheetView predates the toolbar and owned its header as a standalone panel. Remove the Table view rather than reconciling two headers: - Delete ResultsTable and ResultRowModal, the view switch and ResultsViewMode. The table row click was the modal's only trigger. - Delete SpreadsheetView's header block. Its Download CSV exported the Univer snapshot, which only holds the capped preview rows; the toolbar's re-derives from the full results, so that one is correct. - Fix SpreadsheetView's h-screen nested inside the page's own h-screen column, which gave it double height. Also remove Export from the run cards, which retires the chain feeding it: the isExporting/onExport props through RunRow and RunsPanel, and exportRun/exportingId in useAssessmentHomeData and useAssessmentHome. View results stays on the card; Download CSV lives on the results page. Refs #263
… model definitions
Issue
Closes #263
Summary
Checklist
Before submitting a pull request, please ensure that you mark these task.
npm run devandnpm run buildin the repository root and test.Original PR description
Issue
Closes #263
Summary
The old Assessment surface split one job across three tabs (
Datasets / Config / Result) and a 5-step wizard, with no way to reopen a saved config. This rebuilds it to the approved design indocs/assessment-ui-ux-flow.mdand moves it onto the BATCH assessments API.@-mentions (column → Text/Image/PDF), live preview filled with row 1, draggable split pane, per-step model picker.vN+1, enabled only on a real diff against the loaded version; whitespace-only edits don't count./api/assessment/batchBFF routes; fetchers split intolib/assessment/api/{assessors,runs,submissions}.ts.configBlob.tsmaps the wizard draft to the stored ASSESSMENT config blob,batchResults.tsflattens the nested BATCH result into the row the table reads.Column mapping is gone — text and attachment columns are derived from the prompt's
@Column/<Column>tokens.Checklist
Before submitting a pull request, please ensure that you mark these task.
npm run devandnpm run buildin the repository root and test.Notes
PostProcessingPanel.tsx/PostProcessingStep.tsxare kept but unreachable — the 4-step flow has no place for them. Needs a call on re-hosting or dropping.tsc,npm run lint(0 errors) andnpm run buildare clean.