Reorder assign panel columns and add featured button on slot list.
Put time-slot list in the middle with featured on the right, and allow promoting slot entries to featured directly. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
1bd2d299c1
commit
91cdcd74b3
@ -1050,6 +1050,143 @@ export function YtAssignPanel({ channels }: { channels: ManagedChannel[] }) {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="rounded-2xl border border-violet-500/25 bg-violet-500/5 p-4 xl:col-span-1">
|
||||
<div className="mb-1 flex flex-wrap items-center justify-between gap-2">
|
||||
<h4 className="text-sm font-medium text-violet-50">
|
||||
时间段列表(轮播)· {(selected.slots || []).length}
|
||||
</h4>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy}
|
||||
onClick={() => void autoFillSlots(false, true)}
|
||||
className="inline-flex items-center gap-1 rounded-lg bg-violet-500/20 px-2 py-1 text-[11px] text-violet-100"
|
||||
>
|
||||
<RefreshCw className="h-3 w-3" />
|
||||
填充直播
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void copyList("slots")}
|
||||
className="inline-flex items-center gap-1 rounded-lg bg-white/5 px-2 py-1 text-[11px] text-violet-50"
|
||||
>
|
||||
<Copy className="h-3 w-3" />
|
||||
复制
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => exportList("slots")}
|
||||
className="inline-flex items-center gap-1 rounded-lg bg-white/5 px-2 py-1 text-[11px] text-violet-50"
|
||||
>
|
||||
<Download className="h-3 w-3" />
|
||||
导出
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p className="mb-3 text-[11px] text-violet-100/70">
|
||||
本频道 {selectedSchedule?.start_label || "—"}–{selectedSchedule?.end_label || "—"} 内按序轮播抖音源;多频道错开时段,避免同时推流。
|
||||
</p>
|
||||
<div className="max-h-[28rem] space-y-2 overflow-y-auto">
|
||||
{(selected.slots || []).length === 0 ? (
|
||||
<div className="py-10 text-center text-xs text-violet-100/50">
|
||||
从普通列表点时钟图标加入,或点「填充直播」
|
||||
</div>
|
||||
) : (
|
||||
(selected.slots || []).map((s, i) => {
|
||||
const banned = Boolean(s.blacklisted);
|
||||
const inFeat = s.pool_url_id ? featuredIds.has(s.pool_url_id) : false;
|
||||
const schSlot = (schedule?.channels || [])
|
||||
.find((c) => c.group_id === selected.id)
|
||||
?.slots?.[i] as SlotUrl | undefined;
|
||||
const timeLabel =
|
||||
schSlot?.window_start_label && schSlot?.window_end_label
|
||||
? `${schSlot.window_start_label}–${schSlot.window_end_label}`
|
||||
: null;
|
||||
return (
|
||||
<div
|
||||
key={s.id}
|
||||
className={`flex items-center gap-2 rounded-xl border p-2 ${
|
||||
banned
|
||||
? "border-fuchsia-500/35 bg-fuchsia-500/10"
|
||||
: "border-violet-500/25 bg-black/40"
|
||||
}`}
|
||||
>
|
||||
<span className="shrink-0 rounded bg-violet-500/20 px-1.5 text-[10px] text-violet-100">
|
||||
#{i + 1}
|
||||
</span>
|
||||
<CoverThumb
|
||||
cover={s.cover_url}
|
||||
title={s.title}
|
||||
onOpen={(src) =>
|
||||
setLightbox({ src, title: s.title || "封面", subtitle: s.url })
|
||||
}
|
||||
/>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<div className="truncate text-sm text-violet-50">{s.title || "未命名主播"}</div>
|
||||
{timeLabel ? (
|
||||
<span className="rounded bg-violet-500/25 px-1.5 text-[10px] text-violet-100">
|
||||
{timeLabel}
|
||||
</span>
|
||||
) : null}
|
||||
{banned ? (
|
||||
<span className="rounded bg-fuchsia-500/25 px-1.5 text-[10px] text-fuchsia-100">
|
||||
黑名单
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<a
|
||||
href={s.url || "#"}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="block truncate text-[11px] text-sky-300 hover:underline"
|
||||
>
|
||||
{s.url || s.pool_url_id}
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex shrink-0 gap-1">
|
||||
{s.pool_url_id ? (
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy || inFeat || banned}
|
||||
title={banned ? "已在黑名单" : inFeat ? "已在精选" : "加入精选"}
|
||||
onClick={() => void addFeatured(s.pool_url_id)}
|
||||
className={`rounded-lg px-2 py-1 text-[11px] ${
|
||||
inFeat || banned
|
||||
? "bg-amber-500/20 text-amber-100 opacity-50"
|
||||
: "bg-white/5 text-slate-300 hover:bg-amber-500/15"
|
||||
}`}
|
||||
>
|
||||
<Star className="h-3 w-3" />
|
||||
</button>
|
||||
) : null}
|
||||
{s.pool_url_id ? (
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy}
|
||||
title="加入黑名单"
|
||||
onClick={() => void banPool(s.pool_url_id, s.title || s.url || "")}
|
||||
className="rounded-lg bg-fuchsia-500/15 px-2 py-1 text-fuchsia-100"
|
||||
>
|
||||
<Ban className="h-3 w-3" />
|
||||
</button>
|
||||
) : null}
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy}
|
||||
onClick={() => void removeSlot(s.id)}
|
||||
className="rounded-lg bg-rose-500/10 px-2 py-1 text-rose-200"
|
||||
>
|
||||
<Trash2 className="h-3 w-3" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="rounded-2xl border border-amber-500/20 bg-amber-500/5 p-4">
|
||||
<div className="mb-1 flex flex-wrap items-center justify-between gap-2">
|
||||
<h4 className="text-sm font-medium text-amber-50">
|
||||
@ -1147,127 +1284,6 @@ export function YtAssignPanel({ channels }: { channels: ManagedChannel[] }) {
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="rounded-2xl border border-violet-500/25 bg-violet-500/5 p-4 xl:col-span-1">
|
||||
<div className="mb-1 flex flex-wrap items-center justify-between gap-2">
|
||||
<h4 className="text-sm font-medium text-violet-50">
|
||||
时间段列表(轮播)· {(selected.slots || []).length}
|
||||
</h4>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy}
|
||||
onClick={() => void autoFillSlots(false, true)}
|
||||
className="inline-flex items-center gap-1 rounded-lg bg-violet-500/20 px-2 py-1 text-[11px] text-violet-100"
|
||||
>
|
||||
<RefreshCw className="h-3 w-3" />
|
||||
填充直播
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void copyList("slots")}
|
||||
className="inline-flex items-center gap-1 rounded-lg bg-white/5 px-2 py-1 text-[11px] text-violet-50"
|
||||
>
|
||||
<Copy className="h-3 w-3" />
|
||||
复制
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => exportList("slots")}
|
||||
className="inline-flex items-center gap-1 rounded-lg bg-white/5 px-2 py-1 text-[11px] text-violet-50"
|
||||
>
|
||||
<Download className="h-3 w-3" />
|
||||
导出
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p className="mb-3 text-[11px] text-violet-100/70">
|
||||
本频道 {selectedSchedule?.start_label || "—"}–{selectedSchedule?.end_label || "—"} 内按序轮播抖音源;多频道错开时段,避免同时推流。
|
||||
</p>
|
||||
<div className="max-h-[28rem] space-y-2 overflow-y-auto">
|
||||
{(selected.slots || []).length === 0 ? (
|
||||
<div className="py-10 text-center text-xs text-violet-100/50">
|
||||
从普通列表点时钟图标加入,或点「填充直播」
|
||||
</div>
|
||||
) : (
|
||||
(selected.slots || []).map((s, i) => {
|
||||
const banned = Boolean(s.blacklisted);
|
||||
const schSlot = (schedule?.channels || [])
|
||||
.find((c) => c.group_id === selected.id)
|
||||
?.slots?.[i] as SlotUrl | undefined;
|
||||
const timeLabel =
|
||||
schSlot?.window_start_label && schSlot?.window_end_label
|
||||
? `${schSlot.window_start_label}–${schSlot.window_end_label}`
|
||||
: null;
|
||||
return (
|
||||
<div
|
||||
key={s.id}
|
||||
className={`flex items-center gap-2 rounded-xl border p-2 ${
|
||||
banned
|
||||
? "border-fuchsia-500/35 bg-fuchsia-500/10"
|
||||
: "border-violet-500/25 bg-black/40"
|
||||
}`}
|
||||
>
|
||||
<span className="shrink-0 rounded bg-violet-500/20 px-1.5 text-[10px] text-violet-100">
|
||||
#{i + 1}
|
||||
</span>
|
||||
<CoverThumb
|
||||
cover={s.cover_url}
|
||||
title={s.title}
|
||||
onOpen={(src) =>
|
||||
setLightbox({ src, title: s.title || "封面", subtitle: s.url })
|
||||
}
|
||||
/>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<div className="truncate text-sm text-violet-50">{s.title || "未命名主播"}</div>
|
||||
{timeLabel ? (
|
||||
<span className="rounded bg-violet-500/25 px-1.5 text-[10px] text-violet-100">
|
||||
{timeLabel}
|
||||
</span>
|
||||
) : null}
|
||||
{banned ? (
|
||||
<span className="rounded bg-fuchsia-500/25 px-1.5 text-[10px] text-fuchsia-100">
|
||||
黑名单
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<a
|
||||
href={s.url || "#"}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="block truncate text-[11px] text-sky-300 hover:underline"
|
||||
>
|
||||
{s.url || s.pool_url_id}
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex shrink-0 gap-1">
|
||||
{s.pool_url_id ? (
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy}
|
||||
title="加入黑名单"
|
||||
onClick={() => void banPool(s.pool_url_id, s.title || s.url || "")}
|
||||
className="rounded-lg bg-fuchsia-500/15 px-2 py-1 text-fuchsia-100"
|
||||
>
|
||||
<Ban className="h-3 w-3" />
|
||||
</button>
|
||||
) : null}
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy}
|
||||
onClick={() => void removeSlot(s.id)}
|
||||
className="rounded-lg bg-rose-500/10 px-2 py-1 text-rose-200"
|
||||
>
|
||||
<Trash2 className="h-3 w-3" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user