Fetches active Temporary Flight Restrictions from the FAA website, filters by configured state (LOCATION_STATE env var), and displays a red warning banner at the top of the dashboard when TFRs are present. Data is cached for 30 minutes and degrades gracefully if the FAA is unreachable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
111 lines
1.9 KiB
TypeScript
111 lines
1.9 KiB
TypeScript
// Core weather data types matching backend models
|
|
|
|
export interface WeatherPoint {
|
|
timestamp: string
|
|
temperature: number
|
|
wind_speed: number
|
|
wind_gust: number
|
|
wind_direction: number
|
|
cloud_cover: number
|
|
precipitation: number
|
|
visibility: number
|
|
pressure: number
|
|
humidity: number
|
|
}
|
|
|
|
export interface Thresholds {
|
|
max_wind_speed: number
|
|
max_wind_gust: number
|
|
max_precipitation: number
|
|
min_visibility: number
|
|
max_cloud_cover: number
|
|
min_temperature?: number
|
|
max_temperature?: number
|
|
}
|
|
|
|
export interface Assessment {
|
|
is_flyable: boolean
|
|
reasons: string[]
|
|
score: number
|
|
}
|
|
|
|
export interface FlyableWindow {
|
|
start: string
|
|
end: string
|
|
duration_hours: number
|
|
avg_conditions: {
|
|
wind_speed: number
|
|
wind_gust: number
|
|
temperature: number
|
|
cloud_cover: number
|
|
}
|
|
}
|
|
|
|
// API Response types
|
|
|
|
export interface CurrentWeatherResponse {
|
|
location: {
|
|
lat: number
|
|
lon: number
|
|
name?: string
|
|
}
|
|
current: WeatherPoint
|
|
assessment: Assessment
|
|
last_updated: string
|
|
}
|
|
|
|
export interface ForecastResponse {
|
|
location: {
|
|
lat: number
|
|
lon: number
|
|
name?: string
|
|
}
|
|
forecast: WeatherPoint[]
|
|
flyable_windows: FlyableWindow[]
|
|
generated_at: string
|
|
}
|
|
|
|
export interface HistoricalResponse {
|
|
location: {
|
|
lat: number
|
|
lon: number
|
|
name?: string
|
|
}
|
|
date: string
|
|
data: WeatherPoint[]
|
|
}
|
|
|
|
export interface AssessmentRequest {
|
|
thresholds: Thresholds
|
|
}
|
|
|
|
export interface AssessmentResponse {
|
|
current: WeatherPoint
|
|
assessment: Assessment
|
|
thresholds_used: Thresholds
|
|
}
|
|
|
|
// TFR (Temporary Flight Restriction) types
|
|
|
|
export interface TFR {
|
|
date: string
|
|
notam_id: string
|
|
facility: string
|
|
state: string
|
|
type: string
|
|
description: string
|
|
detail_url: string
|
|
}
|
|
|
|
export interface TFRResponse {
|
|
tfrs: TFR[]
|
|
count: number
|
|
last_checked: string
|
|
}
|
|
|
|
// Error response type
|
|
export interface APIError {
|
|
error: string
|
|
detail?: string
|
|
}
|