"use client";
import type { ReactNode } from "react";
import {
Clock,
Cpu,
Loader2,
MonitorPlay,
Radio,
RefreshCw,
Sparkles,
Zap,
} from "lucide-react";
import { EnableSwitch } from "@/components/EnableSwitch";
export type RelayOpsHeroProps = {
relayEnabled: boolean;
timeSlotModeOn: boolean;
exclusiveLiveOn: boolean;
relayBusy: boolean;
busy: boolean;
douyinLiveCount: number | string;
pushingCount: number;
workerRunning: boolean;
nowLabel: string;
keyedChannelCount: number;
exclusiveWinnerName?: string;
nekoPausedCount?: number;
nekoEnabledCount: number;
qualityPresetId: string;
qualityPresets: Array<{
id: string;
label: string;
description?: string;
recommended_for_vps?: boolean;
active?: boolean;
}>;
qualityHint?: string;
lastError?: string;
onToggleRelay: (on: boolean) => void;
onToggleTimeSlot: (on: boolean) => void;
onToggleExclusive: (on: boolean) => void;
onQualityChange: (id: string) => void;
onRefreshAvatars: () => void;
onRefresh: () => void;
createForm: ReactNode;
};
function MetricPill({
label,
value,
tone = "slate",
pulse,
}: {
label: string;
value: ReactNode;
tone?: "slate" | "teal" | "rose" | "amber";
pulse?: boolean;
}) {
const tones = {
slate: "border-white/10 bg-black/35 text-slate-100",
teal: "border-teal-400/25 bg-teal-500/10 text-teal-50",
rose: "border-rose-400/30 bg-rose-500/10 text-rose-50",
amber: "border-amber-400/30 bg-amber-500/10 text-amber-50",
};
return (
{pulse ? (
) : null}
{label}
{value}
);
}
function PolicyCard({
title,
subtitle,
icon,
accent,
children,
active,
}: {
title: string;
subtitle: string;
icon: ReactNode;
accent: string;
children: ReactNode;
active?: boolean;
}) {
return (
);
}
/** Hero ops strip for YouTube 分配 — schedule vs resource policy made obvious. */
export function YtRelayOpsHero({
relayEnabled,
timeSlotModeOn,
exclusiveLiveOn,
relayBusy,
busy,
douyinLiveCount,
pushingCount,
workerRunning,
nowLabel,
keyedChannelCount,
exclusiveWinnerName,
nekoPausedCount = 0,
nekoEnabledCount,
qualityPresetId,
qualityPresets,
qualityHint,
lastError,
onToggleRelay,
onToggleTimeSlot,
onToggleExclusive,
onQualityChange,
onRefreshAvatars,
onRefresh,
createForm,
}: RelayOpsHeroProps) {
const pushing = Number(pushingCount || 0) > 0;
return (
Live Relay
转播分配
{timeSlotModeOn
? `排班中:${keyedChannelCount || "N"} 个有 KEY 频道平分 24h(北京时间),源取当前在播抖音。`
: "精选列表推流:频道 + KEY → 抖音池 → 精选地址。打开自动推流后由 Worker 调度。"}
{exclusiveLiveOn
? " 资源策略为「独占」:开播时只保留一路 FFmpeg,并暂停其他 Neko(适合 VPS)。"
: " 资源策略为「多开」:可同时保留多个 Neko 预热(适合物理机)。"}
}
accent="border-rose-400/30 bg-rose-500/[0.08]"
active={relayEnabled}
>
}
accent="border-teal-400/30 bg-teal-500/[0.08]"
active={timeSlotModeOn}
>
}
accent="border-amber-400/30 bg-amber-500/[0.08]"
active={exclusiveLiveOn}
>
{(timeSlotModeOn || (exclusiveLiveOn && exclusiveWinnerName) || nekoEnabledCount > 0) && (
{timeSlotModeOn ? (
排班 · {keyedChannelCount} 频道
{keyedChannelCount > 0 ? ` · ≈${(24 / keyedChannelCount).toFixed(1)}h/档` : " · 请先配置 KEY"}
· 源=在播抖音
) : null}
{exclusiveLiveOn && exclusiveWinnerName ? (
独占中 · {exclusiveWinnerName}
{nekoPausedCount > 0 ? (
· 已暂停 {nekoPausedCount} 个 Neko
) : null}
) : null}
{!exclusiveLiveOn ? (
多开模式 · Neko 启用标记 {nekoEnabledCount}
) : null}
)}
转推画质
VPS 建议 Ultra;物理机可开 720p。切换后推流会自动重启。
{qualityHint ?
{qualityHint}
: null}
{lastError ? (
{lastError}
) : null}
);
}