diff --git a/README.md b/README.md index c8b59f2..a602183 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ Standalone Next.js admin frontend for the virtual try-on workflow. +## UI Direction + +- Shared admin shell uses a compact dense-console layout instead of wide hero-card framing. +- `orders`, `reviews`, and `workflows` prioritize toolbar + table + detail patterns for desktop operators. +- Review detail keeps image inspection on the left and grouped decision actions on the right. + ## Requirements - Node.js 20+ @@ -82,8 +88,6 @@ Real integration pages: Placeholder or transitional pages: -- `/orders` -- `/workflows` - `/libraries/models` - `/libraries/scenes` - `/libraries/garments` diff --git a/src/lib/adapters/workflows.ts b/src/lib/adapters/workflows.ts index da9f857..3c45cee 100644 --- a/src/lib/adapters/workflows.ts +++ b/src/lib/adapters/workflows.ts @@ -24,6 +24,34 @@ type WorkflowAssetUriField = | "result_uri" | "source_uri"; +type WorkflowLookupSource = + | Pick< + WorkflowListItemDto, + | "order_id" + | "workflow_id" + | "workflow_type" + | "workflow_status" + | "current_step" + | "failure_count" + | "review_task_status" + | "revision_count" + | "pending_manual_confirm" + | "updated_at" + > + | Pick< + WorkflowStatusResponseDto, + | "order_id" + | "workflow_id" + | "workflow_type" + | "workflow_status" + | "current_step" + | "review_task_status" + | "revision_count" + | "pending_manual_confirm" + | "updated_at" + | "steps" + >; + const WORKFLOW_ASSET_URI_FIELDS = new Set([ "asset_uri", "candidate_uri", @@ -94,21 +122,14 @@ function adaptWorkflowStep( }; } -export function adaptWorkflowLookupItem( - workflow: Pick< - WorkflowStatusResponseDto | WorkflowListItemDto, - | "order_id" - | "workflow_id" - | "workflow_type" - | "workflow_status" - | "current_step" - | "failure_count" - | "review_task_status" - | "revision_count" - | "pending_manual_confirm" - | "updated_at" - >, -): WorkflowLookupItemVM { +export function adaptWorkflowLookupItem(workflow: WorkflowLookupSource): WorkflowLookupItemVM { + const failureCount = + "failure_count" in workflow + ? workflow.failure_count + : "steps" in workflow + ? workflow.steps.filter((step) => step.step_status === "failed").length + : 0; + return { orderId: workflow.order_id, workflowId: workflow.workflow_id, @@ -117,7 +138,7 @@ export function adaptWorkflowLookupItem( statusMeta: getOrderStatusMeta(workflow.workflow_status), currentStep: workflow.current_step, currentStepLabel: getWorkflowStepMeta(workflow.current_step).label, - failureCount: workflow.failure_count, + failureCount, reviewTaskStatus: workflow.review_task_status, revisionCount: workflow.revision_count, pendingManualConfirm: workflow.pending_manual_confirm,