迁移导出与成本页签;Grid 改为 CSS 变量列宽、补充 MONO/TabStack 原语

main
mula.liu 2026-11-01 16:57:10 +08:00
parent c2bdd6e070
commit da679e135e
3 changed files with 431 additions and 9 deletions

View File

@ -10,8 +10,10 @@ import { cn } from '../../lib/cn'
/** 次要说明文字(.muted):11px + 最淡的一级灰,表格单元格的第二行、附注都用它 */
export const MUTED = 'text-faint text-caption'
/** 等宽小字(.mono):路径 / id / 枚举码 / 数值列 */
export const MONO = 'font-mono text-[10.5px] tracking-[-.2px]'
/** 弱化 + 等宽(.muted.mono):id、路径、枚举码 */
export const MUTED_MONO = 'text-faint text-[10.5px] font-mono tracking-[-.2px]'
export const MUTED_MONO = `${'text-faint'} ${MONO}`
/** 站内文字链配色(.link):<Link> 没有组件形态,用这个类名常量保持一致 */
export const LINK_CLS = 'text-success text-caption no-underline hover:underline'
@ -65,6 +67,11 @@ export function Sub({ children, className }: { children?: ReactNode; className?:
return <div className={cn('border-t border-line mt-[22px] pt-[18px] min-w-0', className)}>{children}</div>
}
/** 页签正文(.tabstack):面板之间固定 16px 呼吸,页面不要再自己写 mb-* */
export function TabStack({ children, className }: { children?: ReactNode; className?: string }) {
return <div className={cn('flex min-w-0 flex-col gap-4', className)}>{children}</div>
}
/**
* 两栏正文(.layout):主栏吃掉剩余宽度,侧栏最窄 300px。
* ≤1100 收成单列——断点写在组件里,页面不许再为自己写 @media。

View File

@ -178,13 +178,27 @@ export function Actions({ children, className }: { children: ReactNode; classNam
return <div className={cn('flex items-center gap-[7px] flex-wrap mt-2 min-w-0 [--ctl-h:var(--ctl-h-md)]', className)}>{children}</div>
}
/** 通用栅格:.grid(4) .grid2 .grid3 .grid4 —— 1fr 轨道配 min-w-0,防止内容把列顶宽 */
export function Grid({ children, cols = 4, gap = 12, className, min = 0 }: {
children: ReactNode; cols?: number | string; gap?: number; className?: string; min?: number
/** 窄屏折成一列的档位(字面量类名,Tailwind 只认源码里出现过的字符串) */
const ONE_CLS: Record<string, string> = {
mid: 'max-mid:grid-cols-1', mid2: 'max-mid2:grid-cols-1', nav: 'max-nav:grid-cols-1',
short: 'max-short:grid-cols-1', tiny: 'max-tiny:grid-cols-1', narrow: 'max-narrow:grid-cols-1'
}
export type GridCollapse = 'mid' | 'mid2' | 'nav' | 'short' | 'tiny' | 'narrow'
/**
* 通用栅格(.grid / .grid2 / .grid3 / .grid4)。
*
* 列数走 --cols/--min 两个 CSS 变量 + 字面量工具类,而不是内联 grid-template-columns:
* 内联样式会盖掉所有断点类,「窄屏折成一列」就再也写不上去
* (旧站 .grid2 在 ≤560 就是单列,用内联 style 之后这一档静默失效)。
*/
export function Grid({ children, cols = 4, gap = 12, min = 0, oneAt, className }: {
children?: ReactNode; cols?: number; gap?: number; min?: number; oneAt?: GridCollapse; className?: string
}) {
return (
<div className={cn('grid min-w-0 [&>*]:min-w-0', className)}
style={{ gridTemplateColumns: `repeat(${cols},minmax(${min}px,1fr))`, gap }}>
<div className={cn('grid min-w-0 [&>*]:min-w-0 gap-[var(--gap)] grid-cols-[repeat(var(--cols),minmax(var(--min),1fr))]',
oneAt && ONE_CLS[oneAt], className)}
style={{ ['--cols' as string]: cols, ['--min' as string]: `${min}px`, ['--gap' as string]: `${gap}px` }}>
{children}
</div>
)

View File

@ -1,4 +1,405 @@
/** 待迁移:导出与成本(占位,见 .local/vue-ref/src/views/tabs/Delivery.vue) */
export default function Delivery() {
return <div className="p-[26px] text-center text-faint text-body">导出与成本 迁移中…</div>
/**
* 导出与成本(图2 节点 ⑫ compose → export)
* 出片走任务队列:合成失败可重试,成片留档 + 成本台账 + 生成记录(可复现提示词)
*/
import { useCallback, useEffect, useMemo, useState } from 'react'
import { Link } from 'react-router-dom'
import * as api from '../../api/client'
import { fmtAgo, fmtBytes, fmtMs, fmtMoney, fmtSeconds, fmtTime, statusLabel } from '../../lib/format'
import { fromExport } from '../../lib/media'
import { useAutoRefresh } from '../../hooks'
import { Select } from '../../components/forms'
import { MediaThumb } from '../../components/media/MediaThumb'
import {
Actions, Button, Chip, ChipBar, ErrorText, Field, Grid, LINK_CLS, LineHint, MONO, MUTED, MUTED_MONO,
Panel, PanelHead, Row, Spinner, Stat, StatGrid, Status, TabStack, Table, TableBox, Tag, cellCenter, cellRight
} from '../../components/ui'
import { refresh, useProjectStore } from '../../stores/project'
import { presetLabel, presets as FALLBACK_PRESETS, useSystemStore } from '../../stores/system'
import { notify } from '../../stores/notice'
import { openTogether } from '../../stores/preview'
const PRESET_HINTS: Record<string, string> = {
draft_720p: '1280×720 · CRF28 · veryfast(试片最快)',
vertical_720p: '720×1280 · CRF24 · medium(9:16 竖屏试片)',
web_1080p: '1920×1080 · CRF21 · medium(平台投放默认)',
vertical_1080p: '1080×1920 · CRF21 · medium(9:16 竖屏投放)',
hq_1080p: '1920×1080 · CRF18 · slow(高质量)',
uhd_4k: '3840×2160 · CRF18 · slow(超清,耗时最长)'
}
const SUBTITLE_MODES = [
{ value: '', label: '跟随时间线设置(默认内嵌软字幕轨)' },
{ value: 'embed', label: '内嵌软字幕轨(可开关)' },
{ value: 'burn', label: '烧录进画面(硬字幕)' },
{ value: 'both', label: '烧录 + 内嵌' },
{ value: 'sidecar', label: '只出外挂 SRT' },
{ value: 'off', label: '不输出字幕' }
]
const EMPTY_CELL = 'text-center py-[22px] leading-[1.7]'
export default function Delivery() {
const projectId = useProjectStore((s) => s.id)
const meta = useSystemStore((s) => s.meta)
const health = useSystemStore((s) => s.health)
const [error, setError] = useState('')
const [busy, setBusy] = useState('')
const [exportList, setExportList] = useState<any[]>([])
const [costs, setCosts] = useState<any>(null)
const [costItems, setCostItems] = useState<any[]>([])
const [generations, setGenerations] = useState<any[]>([])
const [report, setReport] = useState<any>(null)
const [timelines, setTimelines] = useState<any[]>([])
const [showAllCost, setShowAllCost] = useState(false)
const [form, setForm] = useState({ presets: ['web_1080p'] as string[], name: '', subtitle_mode: '', timeline_id: '', priority: 2 })
const currency = costs?.currency || 'CNY'
const busyExports = exportList.filter((e) => ['queued', 'running', 'pending'].includes(e.status))
const succeeded = exportList.filter((e) => e.status === 'succeeded')
const presetList: string[] = meta?.presets?.length ? meta.presets : FALLBACK_PRESETS
const shownCostItems = showAllCost ? costItems : costItems.slice(0, 12)
const blockingIssues = report && !report.ready
? (report.issues || []).filter((y: any) => y.level === 'error') : []
const load = useCallback(async (silent = true) => {
if (!projectId) return
if (!silent) setBusy('读取交付数据')
try {
const [ex, cs, gen, rep, tl] = await Promise.all([
api.get(`/api/projects/${projectId}/exports`),
api.get(`/api/projects/${projectId}/costs`),
api.get(`/api/projects/${projectId}/generations`),
api.get(`/api/projects/${projectId}/timeline/report`).catch(() => null),
api.get(`/api/projects/${projectId}/timelines`).catch(() => ({ timelines: [] }))
])
setExportList(ex.exports || [])
setCosts(cs.cost)
// /costs 把计费明细放在顶层 items,不在 cost 里;之前取 cs.cost.items 永远是空的
setCostItems(cs.items || [])
setGenerations(gen.generations || [])
setReport(rep?.report || null)
setTimelines(tl.timelines || [])
setError('')
} catch (exc: any) { setError(exc?.message || String(exc)) }
finally { setBusy('') }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [projectId])
useEffect(() => { void load(false) }, [load])
/* 有合成在跑就 4 秒看一次,空闲时回到 15 秒 */
useAutoRefresh(() => void load(), busyExports.length ? 4000 : 15000, !!busy, !!busy)
async function run(label: string, fn: () => Promise<any>, message?: (res: any) => string) {
setBusy(label); setError('')
try {
const res = await fn()
const text = message ? message(res) : ''
if (text) notify(text)
await Promise.all([load(), refresh()])
return res
} catch (exc: any) { setError(exc?.message || String(exc)); return null }
finally { setBusy('') }
}
/** 出片:多选预设时依次入队(同一时间线复用,避免逐个点击等页面刷新) */
async function compose() {
if (!projectId) return
const chosen = form.presets.length ? form.presets : ['web_1080p']
setBusy(chosen.length > 1 ? `依次合成 ${chosen.length} 个预设` : '合成导出中')
setError('')
const done: string[] = []
const queued: number[] = []
const bad: string[] = []
try {
for (const preset of chosen) {
try {
const r = await api.post(`/api/projects/${projectId}/compose`, {
preset,
name: chosen.length === 1 ? form.name.trim() : '',
subtitle_mode: form.subtitle_mode || null,
timeline_id: form.timeline_id ? Number(form.timeline_id) : null,
priority: form.priority
})
const list = r?.exports || []
const ok = list.filter((e: any) => e.status === 'succeeded')
if (ok.length) done.push(`${presetLabel[preset] || preset}:${ok[0].name}(${fmtMs(ok[0].duration_ms)} · ${fmtBytes(ok[0].size_bytes)})`)
else if (!list.length) queued.push(r?.task_id)
else bad.push(`${presetLabel[preset] || preset}:${list[0]?.error_message || statusLabel(list[0]?.status)}`)
} catch (exc: any) { bad.push(`${presetLabel[preset] || preset}:${exc?.message || exc}`) }
}
await Promise.all([load(), refresh()])
const parts: string[] = []
if (done.length) parts.push(done.join(';'))
if (queued.length) parts.push(`${queued.length} 个合成任务已入队(#${queued.join('、#')}),等待 worker 执行`)
if (bad.length) parts.push(`未完成 ${bad.length} 个:${bad.join(';')}`)
if (parts.length) notify(parts.join('。'))
} finally { setBusy('') }
}
/** 导出成片 → 统一预览队列(点任意一行都能 ←/→ 翻所有成片) */
const exportItems = useMemo(() => exportList.map((rec) => fromExport(rec)).filter(Boolean), [exportList])
const indexOfExport = useCallback(
(rec: any) => exportItems.findIndex((m: any) => m.raw?.id === rec.id),
[exportItems]
)
const retryExport = (rec: any) =>
run('重试导出', () => api.post(`/api/tasks/${rec.task_id}/retry`, {}), () => `合成任务 #${rec.task_id} 已重新入队`)
function togglePreset(p: string) {
setForm((f) => ({ ...f, presets: f.presets.includes(p) ? f.presets.filter((x) => x !== p) : [...f.presets, p] }))
}
const burnBlocked = health?.ffmpeg_capabilities && !health.ffmpeg_capabilities.subtitle_burn
return (
<TabStack>
<div className="flex flex-wrap items-center justify-between gap-3 min-w-0 mb-3 [--ctl-h:var(--ctl-h-md)]">
<Row tight>
<Chip>成片 {succeeded.length} / {exportList.length}</Chip>
<Chip>累计成本 {fmtMoney(costs?.total_cost, currency)}</Chip>
<Chip>生成 {costs?.generations?.count ?? 0} 次 / {(costs?.generations?.seconds ?? 0).toFixed(1)}s</Chip>
<Chip>待结算预估 {fmtMoney(costs?.estimated_pending, currency)}</Chip>
{report && <Tag tone={report.ready ? 'ok' : 'bad'}>{report.ready ? '时间线可导出' : '时间线有阻塞'}</Tag>}
</Row>
<span className={MUTED}>{busy && <><Spinner className="mr-1" /> {busy}…</>}</span>
</div>
<ErrorText className="mb-3">{error}</ErrorText>
{blockingIssues.length > 0 && (
<ErrorText className="mb-3 text-caption">
时间线尚未就绪,导出会被拒绝(409):
{blockingIssues.map((x: any, i: number) => <span key={i}>{x.message} </span>)}
<Link to={`/projects/${projectId}/timeline`} className={LINK_CLS}>前往时间线修复 ↗</Link>
</ErrorText>
)}
{/* ===== 出片 ===== */}
<Grid cols={2} oneAt="narrow">
<Panel>
<PanelHead eyebrow="PIPELINE · 导出成片" title="合成导出" />
<ChipBar label="出片预设(可多选,依次入队)">
{presetList.map((p) => (
<Chip key={p} title={PRESET_HINTS[p]} active={form.presets.includes(p)} onClick={() => togglePreset(p)}>
{presetLabel[p] || p}
</Chip>
))}
</ChipBar>
<FormGrid>
<Field label="时间线">
<Select value={form.timeline_id} onChange={(v) => setForm((f) => ({ ...f, timeline_id: v }))}
options={[{ value: '', label: '当前时间线' },
...timelines.map((t) => ({ value: String(t.id), label: `v${t.version} · ${t.name}(${fmtMs(t.total_duration_ms)})` }))]} />
</Field>
<Field label="字幕">
<Select value={form.subtitle_mode} onChange={(v) => setForm((f) => ({ ...f, subtitle_mode: v }))} options={SUBTITLE_MODES} />
</Field>
<Field label="优先级" width="narrow">
<input type="number" min={0} max={9} value={form.priority}
onChange={(e) => setForm((f) => ({ ...f, priority: Number(e.target.value) }))} />
</Field>
<Field label="成片名称(可选)">
<input value={form.name} placeholder="留空自动命名:项目名-时间线-时间戳"
onChange={(e) => setForm((f) => ({ ...f, name: e.target.value }))} />
</Field>
</FormGrid>
<Actions>
<Button variant="primary" disabled={!!busy || !report || !report.ready || !form.presets.length}
title={report && report.ready ? `将依次合成 ${form.presets.length} 个预设` : '时间线未就绪时不允许出片'}
onClick={compose}>
▶ 开始合成导出{form.presets.length > 1 ? `(${form.presets.length} 个预设)` : ''}
</Button>
<Link to={`/projects/${projectId}/timeline`} className={LINK_CLS}>先检查时间线 ↗</Link>
</Actions>
{burnBlocked && (
<LineHint>
⚠ 本机 ffmpeg 缺 libass(无 subtitles/ass 滤镜),烧录模式会自动降级为内嵌软字幕轨;
装好完整版后设 FFMPEG_BIN 指向它即可。当前使用:{health.ffmpeg_capabilities.ffmpeg_path || '未探测'}。
</LineHint>
)}
</Panel>
<Panel>
<PanelHead eyebrow="COST LEDGER" title="成本台账" right={<span className={MUTED}>{costs?.records ?? 0} 条计费记录</span>} />
<StatGrid cols={2} className="mb-3">
<Stat label="已发生成本" value={fmtMoney(costs?.total_cost, currency)} />
<Stat label="待生成预估" value={fmtMoney(costs?.estimated_pending, currency)} />
</StatGrid>
<TableBox maxHeight={170}>
<Table minWidth={0}>
<thead><tr><th>维度</th><th>取值</th><th className={cellRight}>金额</th><th className={cellRight}>记录数</th></tr></thead>
<tbody>
{(costs?.by_kind || []).map((row: any) => (
<tr key={'k' + row.key}>
<td className={MUTED}>任务类型</td><td>{statusLabel(row.key)}</td>
<td className={`${cellRight} ${MONO}`}>{fmtMoney(row.cost, currency)}</td><td className={`${cellRight} ${MONO}`}>{row.count}</td>
</tr>
))}
{(costs?.by_provider || []).map((row: any) => (
<tr key={'p' + row.key}>
<td className={MUTED}>Provider</td><td className={MONO}>{row.key}</td>
<td className={`${cellRight} ${MONO}`}>{fmtMoney(row.cost, currency)}</td><td className={`${cellRight} ${MONO}`}>{row.count}</td>
</tr>
))}
{(costs?.by_model || []).map((row: any) => (
<tr key={'m' + row.key}>
<td className={MUTED}>模型</td><td className={MONO}>{row.key}</td>
<td className={`${cellRight} ${MONO}`}>{fmtMoney(row.cost, currency)}</td><td className={`${cellRight} ${MONO}`}>{row.count}</td>
</tr>
))}
{!costs?.by_model?.length && (
<tr><td colSpan={4} className={`${MUTED} ${EMPTY_CELL}`}>
暂无计费明细:本项目使用自建模型,但未在模型管理中心配置单价,服务端因此不会写入计费记录;
「待生成预估」只统计排队中 / 执行中 / 已规划的任务,全部跑完后自然归零。<br />
可量化的投入见下方<b>生成记录</b>({costs?.generations?.count ?? 0} 次调用 / {(costs?.generations?.seconds ?? 0).toFixed(1)} 秒)。{' '}
<Link to="/models" className={LINK_CLS}>去配置模型单价 ↗</Link>
</td></tr>
)}
</tbody>
</Table>
</TableBox>
</Panel>
</Grid>
{/* ===== 成片列表 ===== */}
<Panel>
<PanelHead eyebrow="EXPORTS"
title={<span title="点「▶ 预览」在统一预览器中播放,多份成片可用左右方向键连续比对、Esc 关闭;出片参数 H.264 high profile · yuv420p · AAC 48kHz 双声道 · faststart,逐预设调整 CRF 与 x264 preset。">成片记录</span>}
right={<span className={MUTED}>媒体由后端 <span className={MONO}>/media</span> 直出,下载走 <span className={MONO}>/api/exports/:id/download</span></span>} />
<TableBox maxHeight={420}>
<Table minWidth={0}>
<thead>
<tr>
<th className={cellCenter}>#</th><th>名称 / 预设</th><th>状态</th><th className={cellCenter}>规格</th>
<th className={cellRight}>时长</th><th className={cellRight}>大小</th><th className={cellRight}>耗时</th>
<th>校验和</th><th className={cellRight}>操作</th>
</tr>
</thead>
<tbody>
{exportList.map((rec) => {
const at = indexOfExport(rec)
return (
<tr key={rec.id}>
<td className={`${cellCenter} ${MONO}`}>{rec.id}</td>
<td>
<div className="flex items-start gap-[9px] flex-nowrap min-w-0">
<MediaThumb item={exportItems[at]} size="xs" width="60px" radius={5}
queue={exportItems} index={at < 0 ? 0 : at} />
<div className="flex-1 min-w-0">
<b>{rec.name}</b>
<div className={MUTED_MONO}>{rec.preset} · timeline#{rec.timeline_id} · task#{rec.task_id || '—'}</div>
{rec.error_message && <ErrorText>{rec.error_message}</ErrorText>}
</div>
</div>
</td>
<td>
<Status value={rec.status} />
{rec.subtitle_burned && <div className="mt-[3px]"><Tag tone="info">已烧字幕</Tag></div>}
</td>
<td className={`${cellCenter} ${MONO}`}>{rec.width || '?'}×{rec.height || '?'}{rec.fps ? ` @${rec.fps}` : ''}</td>
<td className={`${cellRight} ${MONO}`}>{fmtMs(rec.duration_ms)}</td>
<td className={`${cellRight} ${MONO}`}>{fmtBytes(rec.size_bytes)}</td>
<td className={`${cellRight} ${MONO} text-faint`}>{rec.elapsed_ms ? (rec.elapsed_ms / 1000).toFixed(1) + 's' : '—'}</td>
<td className={`${MONO} text-faint`}
title={rec.checksum ? '完整校验和为文件 SHA-256 前 32 位(上传超过 16MB 时按流式截断计算)' : '未记录校验和'}>
{(rec.checksum || '').slice(0, 10) || '—'}
</td>
<td className={cellRight}>
<div className="flex flex-wrap items-center gap-[9px] justify-end min-w-0 [--ctl-h:var(--ctl-h-md)]">
{rec.status === 'succeeded' && (
<>
<Button variant="outline" size="sm" onClick={() => openTogether(exportList, rec, fromExport)}>▶ 预览</Button>
<a className={LINK_CLS} href={api.href(`/api/exports/${rec.id}/download`)}>下载 ↗</a>
</>
)}
{rec.status !== 'succeeded' && rec.task_id && ['failed', 'cancelled'].includes(rec.status) && (
<Button variant="outline" size="sm" onClick={() => retryExport(rec)}>重试</Button>
)}
{rec.status !== 'succeeded' && !(rec.task_id && ['failed', 'cancelled'].includes(rec.status)) && (
<span className={MUTED}>—</span>
)}
</div>
</td>
</tr>
)
})}
{!exportList.length && (
<tr><td colSpan={9} className={`${MUTED} ${EMPTY_CELL}`}>还没有成片。先在时间线页通过交付预检,再回到这里出片。</td></tr>
)}
</tbody>
</Table>
</TableBox>
</Panel>
{/* ===== 生成记录 ===== */}
<Panel>
<PanelHead eyebrow="GENERATION LOG" title="生成记录(可复现)"
right={<>
<span className={MUTED}>{generations.length} 条</span>
<Button variant="outline" size="sm" onClick={() => setShowAllCost((v) => !v)}>{showAllCost ? '收起明细' : '展开计费明细'}</Button>
</>} />
<TableBox maxHeight={360}>
<Table minWidth={0}>
<thead>
<tr>
<th className={cellCenter}>#</th><th>镜头 / 类型</th><th>Provider / 模型</th><th>提示词</th>
<th className={cellRight}>时长</th><th className={cellRight}>成本</th><th className={cellCenter}>尝试</th><th className={cellCenter}>时间</th>
</tr>
</thead>
<tbody>
{generations.map((g) => (
<tr key={g.id}>
<td className={`${cellCenter} ${MONO}`}>{g.id}</td>
<td className={MONO}>shot#{g.shot_id || '—'}<div className={MUTED}>{statusLabel(g.kind)}</div></td>
<td className={MUTED_MONO}>{g.provider}/{g.model}</td>
<td className="max-w-[340px] whitespace-normal leading-[1.5] break-anywhere">
{(g.prompt || '').slice(0, 130)}{(g.prompt || '').length > 130 ? '…' : ''}
{g.params && Object.keys(g.params).length > 0 && <div className={MUTED_MONO}>{JSON.stringify(g.params).slice(0, 120)}</div>}
{g.asset_paths?.length ? <div className={MUTED_MONO}>参考素材 {g.asset_paths.length} 个 · job {g.provider_job_id || '—'}</div> : null}
</td>
<td className={`${cellRight} ${MONO}`}>{fmtSeconds(g.duration_seconds)}</td>
<td className={`${cellRight} ${MONO}`}>{fmtMoney(g.cost, g.currency || currency)}</td>
<td className={`${cellCenter} ${MONO}`}>{g.attempts}</td>
<td className={`${cellCenter} ${MONO} text-faint`} title={fmtTime(g.created_at)}>{fmtAgo(g.created_at)}</td>
</tr>
))}
{!generations.length && (
<tr><td colSpan={8} className={`${MUTED} ${EMPTY_CELL}`}>暂无生成记录。</td></tr>
)}
</tbody>
</Table>
</TableBox>
{showAllCost && costItems.length > 0 && (
<TableBox maxHeight={280} className="mt-3">
<Table minWidth={0}>
<thead>
<tr>
<th className={cellCenter}>#</th><th>类型</th><th>Provider / 模型</th>
<th className={cellRight}>数量</th><th className={cellRight}>单价</th><th className={cellRight}>金额</th><th className={cellCenter}>时间</th>
</tr>
</thead>
<tbody>
{shownCostItems.map((it) => (
<tr key={it.id}>
<td className={`${cellCenter} ${MONO}`}>{it.id}</td>
<td>{statusLabel(it.kind)}</td>
<td className={MUTED_MONO}>{it.provider}/{it.model}</td>
<td className={`${cellRight} ${MONO}`}>{it.quantity} {it.unit}</td>
<td className={`${cellRight} ${MONO}`}>{fmtMoney(it.unit_price, it.currency || currency)}</td>
<td className={`${cellRight} ${MONO}`}>{fmtMoney(it.cost, it.currency || currency)}</td>
<td className={`${cellCenter} ${MONO} text-faint`}>{fmtTime(it.created_at)}</td>
</tr>
))}
</tbody>
</Table>
</TableBox>
)}
</Panel>
</TabStack>
)
}
/** 面板里的短字段栅格(.frow):一行四列,窄列自动降列 */
function FormGrid({ children }: { children: React.ReactNode }) {
return <div className="grid grid-cols-[repeat(auto-fit,minmax(190px,1fr))] gap-[10px] mb-[10px] min-w-0 max-mid:grid-cols-2 [&>*]:min-w-0">{children}</div>
}