// Workflow task detail page. // // Fetches a single user task by ID. If the task carries a formKey // starting with "vibe:", strips the prefix and renders the matching // MetadataFormRenderer so the user sees a rich, metadata-driven // form. Otherwise falls back to a read-only JSON dump of the task // variables with a simple "Complete" button. import { useEffect, useState } from 'react' import { useNavigate, useParams } from 'react-router-dom' import { workflow } from '@/api/client' import type { UserTaskDetail } from '@/types/api' import { PageHeader } from '@/components/PageHeader' import { Loading } from '@/components/Loading' import { ErrorBox } from '@/components/ErrorBox' import { MetadataFormRenderer } from '@/components/MetadataFormRenderer' import { useT } from '@/i18n/LocaleContext' export function TaskDetailPage() { const t = useT() const navigate = useNavigate() const { taskId = '' } = useParams<{ taskId: string }>() const [task, setTask] = useState(null) const [loading, setLoading] = useState(true) const [acting, setActing] = useState(false) const [error, setError] = useState(null) useEffect(() => { setLoading(true) setError(null) workflow .getTask(taskId) .then(setTask) .catch((e: unknown) => setError(e instanceof Error ? e : new Error(String(e)))) .finally(() => setLoading(false)) }, [taskId]) const handleComplete = async (formData?: Record) => { setActing(true) setError(null) try { await workflow.completeTask(taskId, formData ?? {}) navigate('/workflow/tasks') } catch (e: unknown) { setError(e instanceof Error ? e : new Error(String(e))) } finally { setActing(false) } } if (loading) return if (error && !task) return if (!task) return // Determine whether we have a vibe: form key const vibeFormSlug = task.formKey && task.formKey.startsWith('vibe:') ? task.formKey.slice('vibe:'.length) : null return (
navigate('/workflow/tasks')} > {t('action.back')} } /> {error && }
Task ID
{task.taskId}
Process
{task.processDefinitionKey}
Created
{task.createTime}
Assignee
{task.assignee ?? '\u2014'}
Form Key
{task.formKey ?? '\u2014'}

{vibeFormSlug ? ( ) : (

Variables

                {JSON.stringify(task.variables, null, 2)}
              
)}
) }