123 lines
3.6 KiB
TypeScript
123 lines
3.6 KiB
TypeScript
export interface TextState {
|
||
showing: boolean;
|
||
title: string;
|
||
}
|
||
|
||
export interface NightModeSettings {
|
||
/** Whether night mode scheduling is active */
|
||
enabled: boolean;
|
||
/** Start of night window, "HH:MM" 24-hour */
|
||
start_time: string;
|
||
/** End of night window (exclusive), "HH:MM" 24-hour */
|
||
end_time: string;
|
||
/** Text shown on image rotator cards during night mode */
|
||
message: string;
|
||
/** When true, hide background image/colour and use near-black */
|
||
dim_background: boolean;
|
||
}
|
||
|
||
export interface SettingsState {
|
||
/** Landscape background image URL. Empty string = no background. */
|
||
background_url: string;
|
||
/** CSS colour string for the TV background. Default "#000000". */
|
||
background_color: string;
|
||
night_mode: NightModeSettings;
|
||
}
|
||
|
||
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; // 1–4
|
||
grid_row: number; // 1–4
|
||
col_span: number; // 1–4
|
||
row_span: number; // 1–4
|
||
}
|
||
|
||
// ─── 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;
|