Files
aigc-home/calliope-web/src/lib/components/workbench/JobChip.svelte
T
总工andmultica-agent 06b15dc3b6 feat: five-stage creation workbench (HEL-614)
- backend: project_stages/stage_runs tables; /api/workbench router
  (overview, run agent with confirmed-upstream context only, edit draft,
  confirm, restore, script import, in-flow image/video generation via the
  shared queue with source=workbench); project stats gain real
  stage_confirmed/stage_status/active_jobs
- frontend: /workbench picker + /workbench/[id] five-stage page (stepper,
  per-stage editors, style direction chooser, storyboard table, asset
  prompt cards with in-flow generation, shot video prompts with player,
  agent + task side rail); nav 创作工作台 now opens it; home entries go
  through the workbench (导入剧本 skips 剧本创作); project cards show
  real five-stage progress; i18n keys in all seven dictionaries
- tests: 9 backend workbench tests (flow handoff, edit/confirm/restore,
  import, generation, Chinese failure states)

Co-authored-by: multica-agent <github@multica.ai>
2026-09-28 13:30:19 +08:00

104 lines
2.1 KiB
Svelte

<script lang="ts">
import type { WorkbenchJobBrief } from '$lib/api';
import { progressFor } from '$lib/jobProgress';
import { t } from '$lib/i18n.svelte';
/**
* Inline workbench job state chip (spec §5 任务条目四态):
* 排队灰 / 进行中琥珀百分比 / 完成绿 / 失败红(附原因).
*/
interface Props {
job: WorkbenchJobBrief;
}
let { job }: Props = $props();
const live = $derived(progressFor(job.id));
const pct = $derived(live?.progress ?? null);
const state = $derived(
job.status === 'done'
? 'done'
: job.status === 'failed'
? 'failed'
: job.status === 'running'
? 'running'
: 'pending',
);
</script>
<span class="job-chip st-{state}" data-testid="wb-job-chip">
{#if state === 'running'}
<span class="breath" aria-hidden="true"></span>
{#if pct != null}{t('workbench.jobRunningPct', { n: Math.round(pct) })}{:else}{t('workbench.jobRunning')}{/if}
{:else if state === 'pending'}
{t('workbench.jobQueued')}
{:else if state === 'done'}
{t('workbench.jobDone')}
{:else}
{t('workbench.jobFailed')}
{/if}
</span>
{#if state === 'failed' && job.error}
<span class="job-error">{job.error}</span>
{/if}
<style>
.job-chip {
display: inline-flex;
align-items: center;
gap: 5px;
padding: 1px 9px;
border-radius: 999px;
font-size: 10.5px;
font-weight: 600;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.st-pending {
color: var(--text-2);
background: var(--surface-3);
}
.st-running {
color: var(--accent);
background: var(--accent-dim);
}
.st-done {
color: var(--success);
background: var(--success-dim);
}
.st-failed {
color: var(--error);
background: var(--error-dim);
}
.job-error {
display: block;
font-size: 11px;
color: var(--error);
line-height: 1.5;
margin-top: 2px;
}
.breath {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent);
animation: wb-chip-breath 2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
@keyframes wb-chip-breath {
0%,
100% {
opacity: 0.35;
}
50% {
opacity: 1;
}
}
@media (prefers-reduced-motion: reduce) {
.breath {
animation: none;
}
}
</style>