feat(frontend): ScheduleConfig V2 types, weekday schema, export update
This commit is contained in:
@@ -71,7 +71,9 @@ export function ChannelCard({
|
||||
onMoveDown,
|
||||
}: ChannelCardProps) {
|
||||
const [confirmOpen, setConfirmOpen] = useState(false);
|
||||
const blockCount = channel.schedule_config.blocks.length;
|
||||
const blockCount = Object.values(channel.schedule_config.day_blocks).reduce(
|
||||
(sum, blocks) => sum + blocks.length, 0
|
||||
);
|
||||
const { status, label } = useScheduleStatus(channel.id);
|
||||
|
||||
const scheduleColor =
|
||||
|
||||
@@ -27,7 +27,9 @@ import type {
|
||||
MediaFilter,
|
||||
ProviderInfo,
|
||||
RecyclePolicy,
|
||||
Weekday,
|
||||
} from "@/lib/types";
|
||||
import { WEEKDAYS } from "@/lib/types";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Local shared primitives (only used inside this file)
|
||||
@@ -334,7 +336,7 @@ interface EditChannelSheetProps {
|
||||
name: string;
|
||||
description: string;
|
||||
timezone: string;
|
||||
schedule_config: { blocks: ProgrammingBlock[] };
|
||||
schedule_config: { day_blocks: Record<Weekday, ProgrammingBlock[]> };
|
||||
recycle_policy: RecyclePolicy;
|
||||
auto_schedule: boolean;
|
||||
access_mode?: AccessMode;
|
||||
@@ -373,7 +375,9 @@ export function EditChannelSheet({
|
||||
name: form.name,
|
||||
description: form.description,
|
||||
timezone: form.timezone,
|
||||
blocks: form.blocks,
|
||||
day_blocks: Object.fromEntries(
|
||||
WEEKDAYS.map(d => [d, d === 'monday' ? form.blocks : []])
|
||||
) as Record<Weekday, ProgrammingBlock[]>,
|
||||
recycle_policy: form.recyclePolicy,
|
||||
auto_schedule: form.autoSchedule,
|
||||
access_mode: form.accessMode,
|
||||
@@ -390,7 +394,11 @@ export function EditChannelSheet({
|
||||
name: form.name,
|
||||
description: form.description,
|
||||
timezone: form.timezone,
|
||||
schedule_config: { blocks: form.blocks },
|
||||
schedule_config: {
|
||||
day_blocks: Object.fromEntries(
|
||||
WEEKDAYS.map(d => [d, d === 'monday' ? form.blocks : []])
|
||||
) as Record<Weekday, ProgrammingBlock[]>,
|
||||
},
|
||||
recycle_policy: form.recyclePolicy,
|
||||
auto_schedule: form.autoSchedule,
|
||||
access_mode: form.accessMode !== "public" ? form.accessMode : "public",
|
||||
|
||||
Reference in New Issue
Block a user