221 lines
4.3 KiB
TypeScript
221 lines
4.3 KiB
TypeScript
export interface Forecast {
|
|
coord: {
|
|
lon: number;
|
|
lat: number;
|
|
};
|
|
weather: Array<{
|
|
id: number;
|
|
main: string;
|
|
description: string;
|
|
icon: string;
|
|
}>;
|
|
base: string;
|
|
main: {
|
|
temp: number;
|
|
feels_like: number;
|
|
temp_min: number;
|
|
temp_max: number;
|
|
pressure: number;
|
|
humidity: number;
|
|
};
|
|
visibility: number;
|
|
wind: {
|
|
speed: number;
|
|
deg: number;
|
|
};
|
|
clouds: {
|
|
all: number;
|
|
};
|
|
dt: number;
|
|
sys: {
|
|
type: number;
|
|
id: number;
|
|
country: string;
|
|
sunrise: number;
|
|
sunset: number;
|
|
};
|
|
timezone: number;
|
|
id: number;
|
|
name: string;
|
|
cod: number;
|
|
}
|
|
|
|
export interface HourlyForecast {
|
|
latitude: number;
|
|
longitude: number;
|
|
generationtime_ms: number;
|
|
utc_offset_seconds: number;
|
|
timezone: string;
|
|
timezone_abbreviation: string;
|
|
elevation: number;
|
|
current_units: CurrentUnits;
|
|
current: CurrentWeather;
|
|
hourly_units: HourlyUnits;
|
|
hourly: HourlyWeather;
|
|
daily_units: DailyUnits;
|
|
daily: DailyWeather;
|
|
}
|
|
|
|
interface CurrentUnits {
|
|
time: string;
|
|
interval: string;
|
|
temperature_2m: string;
|
|
apparent_temperature: string;
|
|
is_day: string;
|
|
precipitation: string;
|
|
rain: string;
|
|
showers: string;
|
|
snowfall: string;
|
|
weather_code: string;
|
|
cloud_cover: string;
|
|
wind_speed_10m: string;
|
|
wind_direction_10m: string;
|
|
}
|
|
|
|
interface CurrentWeather {
|
|
time: string;
|
|
interval: number;
|
|
temperature_2m: number;
|
|
apparent_temperature: number;
|
|
is_day: number;
|
|
precipitation: number;
|
|
rain: number;
|
|
showers: number;
|
|
snowfall: number;
|
|
weather_code: number;
|
|
cloud_cover: number;
|
|
wind_speed_10m: number;
|
|
wind_direction_10m: number;
|
|
}
|
|
|
|
interface HourlyUnits {
|
|
time: string;
|
|
temperature_2m: string;
|
|
apparent_temperature: string;
|
|
precipitation_probability: string;
|
|
precipitation: string;
|
|
weather_code: string;
|
|
wind_speed_10m: string;
|
|
is_day: string;
|
|
}
|
|
|
|
export interface HourlyWeather {
|
|
time: string[];
|
|
temperature_2m: number[];
|
|
apparent_temperature: number[];
|
|
precipitation_probability: number[];
|
|
precipitation: number[];
|
|
weather_code: number[];
|
|
wind_speed_10m: number[];
|
|
is_day: number[];
|
|
}
|
|
|
|
interface DailyUnits {
|
|
time: string;
|
|
weather_code: string;
|
|
temperature_2m_max: string;
|
|
temperature_2m_min: string;
|
|
apparent_temperature_max: string;
|
|
apparent_temperature_min: string;
|
|
sunrise: string;
|
|
sunset: string;
|
|
daylight_duration: string;
|
|
sunshine_duration: string;
|
|
uv_index_max: string;
|
|
precipitation_sum: string;
|
|
precipitation_hours: string;
|
|
wind_speed_10m_max: string;
|
|
}
|
|
|
|
interface DailyWeather {
|
|
time: string[];
|
|
weather_code: number[];
|
|
temperature_2m_max: number[];
|
|
temperature_2m_min: number[];
|
|
apparent_temperature_max: number[];
|
|
apparent_temperature_min: number[];
|
|
sunrise: string[];
|
|
sunset: string[];
|
|
daylight_duration: number[];
|
|
sunshine_duration: number[];
|
|
uv_index_max: number[];
|
|
precipitation_sum: number[];
|
|
precipitation_hours: number[];
|
|
wind_speed_10m_max: number[];
|
|
}
|
|
|
|
export interface LocationType {
|
|
results: {
|
|
address_components: {
|
|
long_name: string;
|
|
short_name: string;
|
|
types: string[];
|
|
}[];
|
|
formatted_address: string;
|
|
geometry: {
|
|
bounds: {
|
|
northeast: {
|
|
lat: number;
|
|
lng: number;
|
|
};
|
|
southwest: {
|
|
lat: number;
|
|
lng: number;
|
|
};
|
|
};
|
|
location: {
|
|
lat: number;
|
|
lng: number;
|
|
};
|
|
location_type: string;
|
|
viewport: {
|
|
northeast: {
|
|
lat: number;
|
|
lng: number;
|
|
};
|
|
southwest: {
|
|
lat: number;
|
|
lng: number;
|
|
};
|
|
};
|
|
};
|
|
place_id: string;
|
|
types: string[];
|
|
}[];
|
|
status: string;
|
|
}
|
|
|
|
export interface coordType {
|
|
name: string;
|
|
geo: {
|
|
lat: number;
|
|
lng: number;}
|
|
}
|
|
|
|
export type EffectCallback = () => void | (() => void | undefined);
|
|
|
|
export interface TempInfo {
|
|
temp: number;
|
|
feels_like: number;
|
|
temp_min: number;
|
|
temp_max: number;
|
|
pressure: number;
|
|
humidity: number;
|
|
}
|
|
|
|
|
|
export interface LocationContextType {
|
|
geoLocation: coordType;
|
|
setGeoLocation: React.Dispatch<React.SetStateAction<coordType>>;
|
|
}
|
|
|
|
export interface WeatherContextType {
|
|
weather: HourlyForecast;
|
|
setWeather: React.Dispatch<React.SetStateAction<HourlyForecast>>;
|
|
}
|
|
|
|
export interface HourlyCardPropType {
|
|
temperature: number;
|
|
weatherCode: number;
|
|
time: string;
|
|
} |