types: expand interfaces for SBB, Spotify, Weather, and widget layout

This commit is contained in:
cediackermann 2026-04-20 18:27:24 +02:00
parent bb30691c1e
commit 73bf363407

View file

@ -1,23 +1,45 @@
export interface Config { export type ZoneId = 'header-left' | 'header-right' | 'main-1' | 'main-2' | 'footer-1' | 'footer-2' | 'footer-3';
export type WidgetId = 'clock' | 'weather' | 'sl' | 'sbb' | 'spotify' | 'system' | 'spacer';
export type WidgetLayout = Partial<Record<ZoneId, WidgetId>>;
export interface SLWidgetConfig {
stationId: string; stationId: string;
stationName: string; stationName: string;
}
export interface SBBWidgetConfig {
stationId: string;
stationName: string;
}
export interface SpotifyWidgetConfig {
clientId: string;
clientSecret: string;
}
export interface WeatherWidgetConfig {
plz: string;
}
export interface Config {
refreshRate: number; refreshRate: number;
alwaysOn: boolean;
layout: WidgetLayout;
sl: SLWidgetConfig;
sbb: SBBWidgetConfig;
spotify: SpotifyWidgetConfig;
weather: WeatherWidgetConfig;
} }
export interface Departure { export interface Departure {
line: { line: {
designation: string; designation: string;
transport_mode: string; transport_mode: string;
group_of_lines?: string;
}; };
destination: string; destination: string;
scheduled: string; scheduled: string;
stop_area: { stop_area: { name: string };
name: string;
};
}
export interface SLData {
departures: Departure[];
} }
export interface StopLocation { export interface StopLocation {
@ -25,6 +47,34 @@ export interface StopLocation {
name: string; name: string;
} }
export interface SearchData { export interface SBBDeparture {
StopLocation: StopLocation[]; name: string;
category: string;
number: string;
to: string;
stop: {
departure: string | null;
delay: number | null;
platform: string | null;
};
}
export interface SpotifyNowPlaying {
playing: boolean;
track?: {
name: string;
artist: string;
album: string;
durationMs: number;
progressMs: number;
};
}
export interface WeatherData {
temperature: number;
description: string;
sunrise: string;
sunset: string;
moonPhase: string;
hourly: Array<{ time: string; temp: number }>;
} }