chore: install project dependencies and generate build artifacts.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import type { CityDetail, CitySummary } from "@/lib/types";
|
||||
|
||||
export async function getCities(): Promise<CitySummary[]> {
|
||||
const res = await fetch("/api/cities", { cache: "no-store" });
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to load cities: ${res.status}`);
|
||||
}
|
||||
const data = await res.json();
|
||||
return data.cities ?? [];
|
||||
}
|
||||
|
||||
export async function getCityDetail(
|
||||
cityName: string,
|
||||
forceRefresh = false,
|
||||
): Promise<CityDetail> {
|
||||
const slug = cityName.replace(/\s/g, "-");
|
||||
const res = await fetch(
|
||||
`/api/city/${encodeURIComponent(slug)}?force_refresh=${forceRefresh}`,
|
||||
{
|
||||
cache: "no-store",
|
||||
},
|
||||
);
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to load city detail: ${res.status}`);
|
||||
}
|
||||
return await res.json();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
export type CitySummary = {
|
||||
name: string;
|
||||
display_name: string;
|
||||
lat: number;
|
||||
lon: number;
|
||||
risk_level: "low" | "medium" | "high";
|
||||
risk_emoji?: string;
|
||||
temp_unit: "fahrenheit" | "celsius";
|
||||
is_major?: boolean;
|
||||
};
|
||||
|
||||
export type CityDetail = {
|
||||
name: string;
|
||||
display_name: string;
|
||||
lat: number;
|
||||
lon: number;
|
||||
temp_symbol: string;
|
||||
local_time: string;
|
||||
current?: {
|
||||
temp?: number | null;
|
||||
max_so_far?: number | null;
|
||||
wu_settlement?: number | null;
|
||||
cloud_desc?: string | null;
|
||||
wind_speed_kt?: number | null;
|
||||
obs_time?: string | null;
|
||||
};
|
||||
deb?: {
|
||||
prediction?: number | null;
|
||||
};
|
||||
probabilities?: {
|
||||
mu?: number | null;
|
||||
distribution?: Array<{ value: number; probability: number }>;
|
||||
};
|
||||
ai_analysis?: string;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
Reference in New Issue
Block a user