MAJOR UPDATE ALERT!!!!!

This commit is contained in:
2026-03-01 14:57:18 +01:00
parent bb46330af8
commit 6497eb9770
21 changed files with 2374 additions and 915 deletions

106
tv/src/types.ts Normal file
View File

@@ -0,0 +1,106 @@
export interface TextState {
showing: boolean;
title: string;
}
export interface SettingsState {
/** Portrait background image URL (height > width). Empty string = no background. */
background_url: string;
}
export interface ImagePopupState {
showing: boolean;
image_url: string;
caption: string;
}
/** Grid layout: 1-based col/row, 4-column × 4-row grid */
export interface CardLayout {
grid_col: number; // 14
grid_row: number; // 14
col_span: number; // 14
row_span: number; // 14
}
// ─── custom_json ───────────────────────────────────────────────────────────────
export interface DisplayOptions {
font_size: number;
text_color: string;
}
export interface DataCardConfig {
url: string;
refresh_interval: number;
display_options: DisplayOptions;
take?: string;
additional_headers?: Record<string, string>;
}
export interface CustomJsonCard {
id: string;
type: "custom_json";
name: string;
config: DataCardConfig;
layout?: CardLayout;
}
// ─── static_text ──────────────────────────────────────────────────────────────
export interface StaticTextConfig {
text: string;
font_size: number;
text_color: string;
}
export interface StaticTextCard {
id: string;
type: "static_text";
name: string;
config: StaticTextConfig;
layout?: CardLayout;
}
// ─── clock ────────────────────────────────────────────────────────────────────
export interface ClockConfig {
/** "time" = live clock, "timer" = countdown to target_iso */
mode: "time" | "timer";
/** IANA timezone string, e.g. "Europe/Berlin" */
timezone?: string;
/** ISO-8601 target datetime for mode="timer", e.g. "2026-12-31T23:59:59" */
target_iso?: string;
font_size: number;
text_color: string;
show_seconds?: boolean;
}
export interface ClockCard {
id: string;
type: "clock";
name: string;
config: ClockConfig;
layout?: CardLayout;
}
// ─── image_rotator ────────────────────────────────────────────────────────────
export interface ImageRotatorConfig {
/** List of public image URLs to cycle through */
images: string[];
/** Seconds between transitions */
interval: number;
fit: "cover" | "contain";
}
export interface ImageRotatorCard {
id: string;
type: "image_rotator";
name: string;
config: ImageRotatorConfig;
layout?: CardLayout;
}
// ─── Union ────────────────────────────────────────────────────────────────────
export type DataCard = CustomJsonCard | StaticTextCard | ClockCard | ImageRotatorCard;