- {/* Header Stat Area */}
-
-
-
- {t.marketAnalysis || "MARKET ANALYSIS"}
-
-
- {t.realTime || "LIVE UPLINK"}
-
-
-
-
-
-
- {t.liveMetar || "REAL-TIME METAR"}
-
-
-
- {overview.current_temp?.toFixed(1) || "--"}
-
-
- {overview.temp_symbol}
-
-
-
-
-
- {t.ensembleDeb || "ENSEMBLE DEB"}
-
-
-
- {overview.deb_prediction?.toFixed(1) || "--"}
-
-
- {overview.temp_symbol}
-
-
-
-
-
- {/* Trade Execution Signal */}
-
-
-
-
- {t.signalStrategy || "SIGNAL STRATEGY"}
-
-
-
-
- {market_scan.signal_label}
-
-
-
-
-
- {t.confidence || "CONFIDENCE"}
-
-
- {market_scan.confidence}
-
-
-
-
- 0
- ? market_scan.sparkline
- : [1, 1, 1]
- }
- width={360}
- height={35}
- color={
- market_scan.signal_label === "BUY YES"
- ? "#10b981"
- : market_scan.signal_label === "BUY NO"
- ? "#f43f5e"
- : "#52525b"
- }
- />
-
-
-
-
- {/* Probability & Market Pricing */}
-
-
-
-
-
- {t.yieldArbitrage || "YIELD ARBITRAGE"}
-
-
-
-
-
- {t.probComparison || "PROB COMPARISON"}
-
- {t.predictionGap || "GAP"}:{" "}
- {market_scan.edge_percent?.toFixed(1) || "0.0"}%
-
-
- {/* Visual Probability Bar */}
-
-
-
-
-
-
- {t.marketPriceLabel || "MIDPOINT"}
-
-
- ${market_scan.market_price?.toFixed(2) || "--"}
-
-
-
-
- {t.modelProbLabel || "MODEL PROB"}
-
-
- {((market_scan.model_probability || 0) * 100).toFixed(1)}%
-
-
-
-
-
-
-
-
-
-
- {t.multiModelDivergence || "MULTI-MODEL DIVERGENCE"}
-
-
-
- {modelEntries.map((m) => (
-
-
-
- {m.label}
-
-
- {m.value.toFixed(1)}°
-
-
-
-
25
- ? "bg-rose-500 shadow-[0_0_8px_rgba(244,63,94,0.5)]"
- : m.value > 15
- ? "bg-amber-500"
- : "bg-cyan-500 shadow-[0_0_8px_rgba(34,211,238,0.5)]"
- }`}
- style={{ width: `${(m.value / 40) * 100}%` }}
- />
-
-
- ))}
-
-
-
-
- {/* Execute Scan Footer */}
-
-
-
-
- );
-}
diff --git a/frontend/components/terminal/Sidebar.tsx b/frontend/components/terminal/Sidebar.tsx
deleted file mode 100644
index cf957758..00000000
--- a/frontend/components/terminal/Sidebar.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-import React from "react";
-import { Search, Globe, ChevronRight, Activity } from "lucide-react";
-import { Badge } from "@/components/ui/badge";
-import { CityInfo } from "@/lib/types";
-import { Sparkline } from "./Sparkline";
-
-interface CitySidebarProps {
- cities: CityInfo[];
- activeCity: string;
- onSelectCity: (name: string) => void;
- t: any;
-}
-
-export function CitySidebar({
- cities,
- activeCity,
- onSelectCity,
- t,
-}: CitySidebarProps) {
- return (
-
- );
-}
diff --git a/frontend/components/terminal/TerminalDashboard.tsx b/frontend/components/terminal/TerminalDashboard.tsx
deleted file mode 100644
index 80a6538f..00000000
--- a/frontend/components/terminal/TerminalDashboard.tsx
+++ /dev/null
@@ -1,307 +0,0 @@
-"use client";
-
-import React, { useState } from "react";
-import { CitySidebar } from "./Sidebar";
-import { AnalyticsPanel } from "./AnalyticsPanel";
-import {
- RefreshCw,
- LayoutGrid,
- Maximize2,
- Layers,
- Languages,
- Sun,
- Moon,
-} from "lucide-react";
-import { Badge } from "@/components/ui/badge";
-
-interface TerminalDashboardProps {
- cities: any[];
- activeCity: string;
- onSelectCity: (name: string) => void;
- cityData: any;
- marketData: any;
- officialData: any;
- isLoading: boolean;
- refresh: () => void;
- lang: any;
- setLang: (lang: any) => void;
- theme: string;
- toggleTheme: () => void;
- t: any;
- children: React.ReactNode; // For the Map
-}
-
-function NavLink({
- href,
- label,
- active = false,
-}: {
- href: string;
- label: string;
- active?: boolean;
-}) {
- return (
-
- {label}
-
- );
-}
-
-export function TerminalDashboard({
- cities,
- activeCity,
- onSelectCity,
- cityData,
- marketData,
- officialData,
- isLoading,
- refresh,
- lang,
- setLang,
- theme,
- toggleTheme,
- t,
- children,
-}: TerminalDashboardProps) {
- const currentTemp = cityData?.current?.temp ?? null;
- const debPrediction = cityData?.deb?.prediction ?? null;
- const marketPrice = marketData?.markets?.[0]?.price ?? 0.62; // Placeholder
-
- const modelEntries = Object.entries(cityData?.multi_model ?? {})
- .map(([label, value]) => ({ label, value: value as number }))
- .filter((e) => typeof e.value === "number");
-
- return (
-
- {/* Top Global Ticker / Nav */}
-
-
-
-
-
-
-
-
-
-
- {t.node || "Node"}:
-
-
- CLOUD-ALPHA-01
-
-
-
-
-
-
-
-
-
-
-
-
-
- NODE: CLOUD-ALPHA-01
-
-
-
-
-
- {/* Main Container */}
-
- {/* Left: Component List */}
-
-
- {/* Center: Interactive Map Area */}
-
- {/* Map UI Overlay */}
-
-
-
-
- Current Focus
-
-
- {activeCity}
-
-
-
-
-
-
-
-
-
-
- {/* The Map */}
-
- {children}
-
-
- {/* Bottom Map Info Bar */}
-
-
-
- Projection: Mercator · Layer: Dynamic Thermal Ensemble
-
-
-
-
- STABLE VIBE
-
-
-
-
-
- {/* Right: Intelligence Panel */}
-
-
-
- {/* Footer Ticker */}
-
-
- );
-}
diff --git a/frontend/lib/polymarket-market-links.ts b/frontend/lib/polymarket-market-links.ts
deleted file mode 100644
index e3a2816c..00000000
--- a/frontend/lib/polymarket-market-links.ts
+++ /dev/null
@@ -1,123 +0,0 @@
-import type { CityDetail } from "@/lib/dashboard-types";
-import type { Locale } from "@/lib/i18n";
-
-const CITY_TO_MARKET_SLUG: Record
= {
- ankara: "ankara",
- atlanta: "atlanta",
- austin: "austin",
- beijing: "beijing",
- "buenos aires": "buenos-aires",
- chengdu: "chengdu",
- chicago: "chicago",
- chongqing: "chongqing",
- dallas: "dallas",
- houston: "houston",
- "hong kong": "hong-kong",
- istanbul: "istanbul",
- london: "london",
- "los angeles": "los-angeles",
- lucknow: "lucknow",
- madrid: "madrid",
- mexico: "mexico-city",
- "mexico city": "mexico-city",
- miami: "miami",
- milan: "milan",
- munich: "munich",
- "new york": "nyc",
- paris: "paris",
- qingdao: "qingdao",
- "san francisco": "san-francisco",
- "sao paulo": "sao-paulo",
- seattle: "seattle",
- seoul: "seoul",
- shanghai: "shanghai",
- shenzhen: "shenzhen",
- singapore: "singapore",
- taipei: "taipei",
- "tel aviv": "tel-aviv",
- tokyo: "tokyo",
- toronto: "toronto",
- warsaw: "warsaw",
- wellington: "wellington",
- wuhan: "wuhan",
-};
-
-const MONTHS = [
- "january",
- "february",
- "march",
- "april",
- "may",
- "june",
- "july",
- "august",
- "september",
- "october",
- "november",
- "december",
-];
-
-function normalizeCityKey(detail?: CityDetail | null) {
- return String(detail?.name || detail?.display_name || "")
- .trim()
- .toLowerCase();
-}
-
-function slugifyCityName(cityKey: string) {
- return cityKey
- .trim()
- .toLowerCase()
- .replace(/['’.]/g, "")
- .replace(/&/g, " and ")
- .replace(/\s+/g, "-");
-}
-
-function normalizeDateParts(localDate?: string | null) {
- const value = String(localDate || "").trim();
- const match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
- if (!match) return null;
- const year = Number(match[1]);
- const monthIndex = Number(match[2]) - 1;
- const day = Number(match[3]);
- if (
- !Number.isFinite(year) ||
- !Number.isFinite(monthIndex) ||
- !Number.isFinite(day) ||
- monthIndex < 0 ||
- monthIndex > 11
- ) {
- return null;
- }
- return {
- year,
- month: MONTHS[monthIndex],
- day,
- };
-}
-
-export function getTodayPolymarketUrl(
- detail?: CityDetail | null,
- locale: Locale = "en-US",
-) {
- const directMarketUrl = String(
- detail?.market_scan?.market_url ||
- detail?.market_scan?.primary_market_url ||
- detail?.market_scan?.primary_market?.market_url ||
- "",
- ).trim();
- if (directMarketUrl) {
- return directMarketUrl;
- }
-
- const cityKey = normalizeCityKey(detail);
- const citySlug = CITY_TO_MARKET_SLUG[cityKey] || slugifyCityName(cityKey);
- const dateParts = normalizeDateParts(detail?.local_date);
- if (!citySlug || !dateParts) return null;
-
- const prefix =
- locale === "zh-CN"
- ? "https://polymarket.com/zh/event/"
- : "https://polymarket.com/event/";
-
- return `${prefix}highest-temperature-in-${citySlug}-on-${dateParts.month}-${dateParts.day}-${dateParts.year}`;
-}
diff --git a/frontend/lib/types.ts b/frontend/lib/types.ts
deleted file mode 100644
index 1648cb41..00000000
--- a/frontend/lib/types.ts
+++ /dev/null
@@ -1,420 +0,0 @@
-// --- Polymarket Market Types ---
-
-export interface MarketBook {
- best_bid: number;
- best_ask: number;
- bid_levels: [number, number][]; // [price, size]
- ask_levels: [number, number][]; // [price, size]
-}
-
-export interface MarketToken {
- outcome: string;
- token_id: string;
- implied_probability: number;
- buy_price: number;
- sell_price: number;
- midpoint: number;
- last_trade_price: number;
- book?: MarketBook;
-}
-
-export interface Trade {
- id: string;
- price: number;
- size: number;
- side: "buy" | "sell";
- timestamp: string;
- timestamp_iso?: string | null;
- outcome?: string | null;
- asset?: string | null;
- transaction_hash?: string | null;
-}
-
-export interface MarketSnapshot {
- id: string;
- question: string;
- title: string;
- slug: string;
- event_slug: string;
- condition_id: string;
- target_date: string;
- active: boolean;
- closed: boolean;
- archived: boolean;
- enable_order_book: boolean;
- liquidity: number;
- volume: number;
- start_date: string;
- end_date: string;
- tokens: MarketToken[];
- recent_trades: Trade[];
-}
-
-export interface MarketPlatformData {
- city: string;
- target_date: string;
- fetched_at: string;
- market_count: number;
- markets: MarketSnapshot[];
- websocket: {
- market_url: string;
- asset_ids: string[];
- condition_ids: string[];
- };
-}
-
-// --- Official Weather Types (Aviation) ---
-
-export interface METARObservation {
- source: string;
- icao: string;
- station_name: string;
- timestamp: string;
- observation_time: string;
- current: {
- temp: number;
- max_temp_so_far: number;
- max_temp_time: string;
- dewpoint: number;
- wind_speed_kt: number;
- wind_dir: number;
- visibility_mi: string | number;
- wx_desc: string | null;
- altimeter: number;
- clouds: any[];
- };
- recent_temps: number[];
- today_obs: any[];
- recent_obs: any[];
- unit: "celsius" | "fahrenheit";
-}
-
-export interface AviationWeatherData {
- available: boolean;
- source: string;
- icao: string;
- observation: METARObservation;
-}
-
-// --- Official Weather Types (Weather.gov) ---
-
-export interface WeatherGovPeriod {
- name: string;
- start_time?: string;
- end_time?: string;
- is_daytime?: boolean;
- temperature: number;
- temperature_unit: string;
- wind_speed?: string;
- wind_direction?: string;
- short_forecast?: string;
- detailed_forecast?: string;
-}
-
-export interface WeatherGovAlert {
- id: string;
- event: string;
- severity: string;
- certainty: string;
- urgency: string;
- headline: string;
- onset: string;
- expires: string;
-}
-
-export interface WeatherGovData {
- available: boolean;
- source: string;
- city: string;
- grid: any;
- nearest_station: {
- station_identifier?: string;
- name?: string;
- timezone?: string;
- elevation_m?: number | null;
- } | null;
- latest_observation: {
- station_identifier?: string;
- temperature_c?: number | null;
- dewpoint_c?: number | null;
- wind_direction_deg?: number | null;
- wind_speed_kmh?: number | null;
- text_description?: string | null;
- timestamp?: string;
- } | null;
- stations: any[];
- forecast_periods: WeatherGovPeriod[];
- hourly_periods: WeatherGovPeriod[];
- active_alerts: WeatherGovAlert[];
-}
-
-export interface OfficialWeatherData {
- city: string;
- fetched_at: string;
- aviation_weather?: AviationWeatherData;
- weather_gov?: WeatherGovData;
-}
-
-// --- City List Types ---
-
-export interface CityInfo {
- name: string;
- display_name: string;
- lat: number;
- lon: number;
- risk_level: "low" | "medium" | "high";
- risk_emoji: string;
- airport: string;
- icao: string;
- temp_unit: "celsius" | "fahrenheit";
- is_major: boolean;
- settlement_source?: string;
- settlement_source_label?: string;
-}
-
-export interface CitiesResponse {
- cities: CityInfo[];
-}
-
-// --- Full City Analysis Types ---
-
-export interface ModelComparison {
- [key: string]: number | undefined;
- "Open-Meteo"?: number;
- ECMWF?: number;
- GFS?: number;
- ICON?: number;
- GEM?: number;
- JMA?: number;
- LGBM?: number;
- MGM?: number;
- NWS?: number;
-}
-
-export interface DEBAnalysis {
- prediction: number | null;
- weights_info?: string;
-}
-
-export interface TrendInfo {
- direction: string;
- recent: Array<{ time: string; temp: number }>;
- is_cooling: boolean;
- is_dead_market: boolean;
-}
-
-export interface PeakInfo {
- hours: string[];
- first_h: number;
- last_h: number;
- status: string;
-}
-
-export interface CityAnalysis {
- name: string;
- display_name: string;
- lat: number;
- lon: number;
- temp_symbol: string;
- local_time: string;
- local_date: string;
- risk: {
- level: string;
- emoji: string;
- airport: string;
- icao: string;
- distance_km: number;
- warning: string;
- };
- current: {
- temp: number | null;
- max_so_far: number | null;
- max_temp_time: string;
- wu_settlement: number | null;
- settlement_source?: string | null;
- settlement_source_label?: string | null;
- obs_time: string;
- obs_age_min: number | null;
- wind_speed_kt: number | null;
- wind_dir: number | null;
- humidity: number | null;
- cloud_desc: string;
- clouds_raw: Array<{ cover: string; base: number | null }>;
- visibility_mi: number | null;
- wx_desc: string | null;
- raw_metar?: string | null;
- report_time?: string | null;
- receipt_time?: string | null;
- obs_time_epoch?: number | null;
- };
- mgm?: {
- temp?: number | null;
- time?: string;
- today_high?: number | null;
- today_low?: number | null;
- };
- forecast: {
- today_high: number | null;
- daily: any[];
- };
- multi_model: ModelComparison;
- deb: DEBAnalysis;
- probabilities: {
- mu?: number | null;
- distribution?: any[];
- };
- hourly?: any;
- metar_recent_obs?: any[];
- trend?: TrendInfo;
- peak?: PeakInfo;
- ai_analysis: string;
- updated_at: string;
-}
-
-// --- Aggregated Detail Types ---
-
-export interface MarketScan {
- available: boolean;
- reason: string | null;
- primary_market: any | null;
- selected_date: string | null;
- selected_condition_id: string | null;
- selected_slug: string | null;
- temperature_bucket: any | null;
- model_probability: number | null;
- market_price: number | null;
- midpoint?: number | null;
- spread?: number | null;
- edge_percent: number | null;
- signal_label: "BUY YES" | "BUY NO" | "MONITOR";
- confidence: "low" | "medium" | "high";
- probability_engine?: string | null;
- probability_calibration_mode?: string | null;
- yes_token: MarketToken | null;
- no_token: MarketToken | null;
- yes_buy: number | null;
- yes_sell: number | null;
- yes_midpoint?: number | null;
- yes_spread?: number | null;
- no_buy: number | null;
- no_sell: number | null;
- no_midpoint?: number | null;
- no_spread?: number | null;
- last_trade_price: number | null;
- liquidity: number | null;
- volume: number | null;
- quote_source?: string | null;
- quote_age_ms?: number | null;
- sparkline: number[];
- top_buckets?: Array<{
- label?: string | null;
- value?: number | null;
- temp?: number | null;
- probability?: number | null;
- market_price?: number | null;
- yes_buy?: number | null;
- yes_sell?: number | null;
- no_buy?: number | null;
- no_sell?: number | null;
- slug?: string | null;
- question?: string | null;
- is_primary?: boolean;
- }>;
- recent_trades: Trade[];
- scan_scope?: "lite" | "full" | string | null;
- websocket: any;
-}
-
-export interface CityDetail {
- city: string;
- fetched_at: string;
- overview: {
- name: string;
- display_name: string;
- icao: string;
- airport: string;
- lat: number;
- lon: number;
- local_time: string;
- local_date: string;
- temp_symbol: string;
- current_temp: number | null;
- settlement_station?: {
- provider_code?: string | null;
- settlement_source?: string | null;
- settlement_station_code?: string | null;
- settlement_station_label?: string | null;
- airport_code?: string | null;
- airport_name?: string | null;
- is_airport_anchor?: boolean;
- is_official_station_anchor?: boolean;
- };
- deb_prediction: number | null;
- risk_level: string;
- risk_warning: string;
- updated_at: string;
- };
- official: {
- available: boolean;
- metar: any;
- weather_gov: WeatherGovData;
- mgm: any;
- mgm_nearby: any[];
- nearby_source?: string;
- airport_primary?: any;
- airport_primary_today_obs?: any[];
- official_nearby?: any[];
- official_network_source?: string;
- official_network_status?: any;
- network_lead_signal?: any;
- network_spread_signal?: any;
- center_station_candidate?: any;
- airport_vs_network_delta?: number | null;
- };
- timeseries: {
- metar_recent_obs: any[];
- metar_today_obs: any[];
- settlement_today_obs?: any[];
- hourly: any;
- mgm_hourly: any[];
- forecast_daily: any[];
- };
- models: ModelComparison;
- probabilities: {
- mu: number | null;
- distribution: any[];
- };
- market_scan: MarketScan;
- risk: any;
- settlement_station?: any;
- airport_primary?: any;
- official_nearby?: any[];
- official_network_source?: string;
- official_network_status?: any;
- network_lead_signal?: any;
- network_spread_signal?: any;
- center_station_candidate?: any;
- airport_vs_network_delta?: number | null;
- ai_analysis: string;
- errors: Record;
-}
-
-export interface CitySummary {
- name: string;
- display_name: string;
- icao: string;
- local_time: string;
- temp_symbol: string;
- current: {
- temp: number | null;
- obs_time: string;
- };
- deb: {
- prediction: number | null;
- };
- risk: {
- level: string;
- warning: string;
- };
- updated_at: string;
-}