公开定时任务页:每条记录标题前加 M月D日 前缀
同名任务多次执行后列表全是同一行,加上日期前缀方便扫描; 用 muted-foreground + text-xs + font-normal 弱化,不喧宾夺主。 Tooltip / title / 删除确认弹窗内的文案也同步带上日期。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ef410e298d
commit
f8e3a3e5b4
1 file changed
+21
-2
@@ -193,6 +193,19 @@ function formatDate(value?: string | null): string {
|
|||||||
return value ? new Date(value).toLocaleString() : "暂无";
|
return value ? new Date(value).toLocaleString() : "暂无";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compact "M月D日" badge prefixed to each run title so visually identical
|
||||||
|
* names (the agent often emits the same title every run) become scannable.
|
||||||
|
* Returns empty string for an invalid / missing date so the title falls back
|
||||||
|
* to its bare form instead of rendering "Invalid Date".
|
||||||
|
*/
|
||||||
|
function formatScheduledDatePrefix(value?: string | null): string {
|
||||||
|
if (!value) return "";
|
||||||
|
const date = new Date(value);
|
||||||
|
if (Number.isNaN(date.getTime())) return "";
|
||||||
|
return `${date.getMonth() + 1}月${date.getDate()}日`;
|
||||||
|
}
|
||||||
|
|
||||||
function isMarkdownFile(file: { name: string; kind?: string | null; mime_type?: string | null }): boolean {
|
function isMarkdownFile(file: { name: string; kind?: string | null; mime_type?: string | null }): boolean {
|
||||||
const name = file.name.toLowerCase();
|
const name = file.name.toLowerCase();
|
||||||
return (
|
return (
|
||||||
@@ -373,6 +386,7 @@ export default function PublicScheduledTaskPage() {
|
|||||||
const runTitle = stripTimestampSuffix(
|
const runTitle = stripTimestampSuffix(
|
||||||
run.result?.title || formatDate(run.scheduled_for),
|
run.result?.title || formatDate(run.scheduled_for),
|
||||||
);
|
);
|
||||||
|
const datePrefix = formatScheduledDatePrefix(run.scheduled_for);
|
||||||
const isDeletingThis =
|
const isDeletingThis =
|
||||||
deleteRunMutation.isPending && deleteRunMutation.variables === run.id;
|
deleteRunMutation.isPending && deleteRunMutation.variables === run.id;
|
||||||
return (
|
return (
|
||||||
@@ -398,13 +412,18 @@ export default function PublicScheduledTaskPage() {
|
|||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<div
|
<div
|
||||||
className="text-sm leading-snug font-medium break-all"
|
className="text-sm leading-snug font-medium break-all"
|
||||||
title={runTitle}
|
title={datePrefix ? `${datePrefix} · ${runTitle}` : runTitle}
|
||||||
>
|
>
|
||||||
|
{datePrefix && (
|
||||||
|
<span className="text-muted-foreground mr-1.5 text-xs font-normal tabular-nums">
|
||||||
|
{datePrefix}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
{runTitle}
|
{runTitle}
|
||||||
</div>
|
</div>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="right" className="max-w-[360px] break-all">
|
<TooltipContent side="right" className="max-w-[360px] break-all">
|
||||||
{runTitle}
|
{datePrefix ? `${datePrefix} · ${runTitle}` : runTitle}
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<div className="text-muted-foreground mt-1 text-xs">
|
<div className="text-muted-foreground mt-1 text-xs">
|
||||||
|
|||||||
Reference in new issue
Block a user