add the very basics of a plot
Also troubleshoot to fix vite config for deduplicating react and react-dom
This commit is contained in:
+11
-20
@@ -1,32 +1,23 @@
|
||||
import './App.css'
|
||||
import LatestTemperature from "@/components/latest-temperature"
|
||||
import TemperatureHistory from "@/components/temperature-history"
|
||||
import TemperaturePlot from "@/components/temperature-plot"
|
||||
// import { Button } from "@/components/ui/button"
|
||||
|
||||
|
||||
// {"id":1001,"city":"Salem","temp":66.7,"feels_like":67.17,"humidity":87,"conditions":"scattered clouds","fetched_at":"2026-02-18T22:16:38.067097Z"}
|
||||
interface WeatherHistory {
|
||||
id: number;
|
||||
city: string;
|
||||
temp: number;
|
||||
feels_like: number;
|
||||
humidity: number;
|
||||
conditions: string;
|
||||
fetched_at: Date;
|
||||
|
||||
}
|
||||
|
||||
async function fetchWeatherHistory(): Promise<WeatherHistory>{
|
||||
const res = await fetch("/api/weather/history");
|
||||
if(!res.ok) throw new Error("Failed to fetch weather history");
|
||||
return res.json();
|
||||
}
|
||||
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<>
|
||||
<LatestTemperature />
|
||||
</>
|
||||
<main className="min-h-screen bg-background p-6">
|
||||
<div className="max-w-4xl mx-auto space-y-2">
|
||||
<TemperaturePlot />
|
||||
<div grid grid-cols-1 md:grid-cols-1 gap-6>
|
||||
<LatestTemperature />
|
||||
<TemperatureHistory />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user