chore: install project dependencies and generate build artifacts.

This commit is contained in:
2569718930@qq.com
2026-03-06 08:41:19 +08:00
parent b210dcf0dd
commit dc4167b514
28 changed files with 4143 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import { NextResponse } from "next/server";
const API_BASE =
process.env.POLYWEATHER_API_BASE_URL || "http://127.0.0.1:8000";
export async function GET() {
try {
const res = await fetch(`${API_BASE}/api/cities`, {
headers: { Accept: "application/json" },
next: { revalidate: 120 },
});
if (!res.ok) {
return NextResponse.json(
{ error: `Backend returned ${res.status}` },
{ status: 502 },
);
}
const data = await res.json();
return NextResponse.json(data);
} catch (error) {
return NextResponse.json(
{ error: "Failed to fetch cities", detail: String(error) },
{ status: 500 },
);
}
}
+33
View File
@@ -0,0 +1,33 @@
import { NextRequest, NextResponse } from "next/server";
const API_BASE =
process.env.POLYWEATHER_API_BASE_URL || "http://127.0.0.1:8000";
export async function GET(
req: NextRequest,
context: { params: Promise<{ name: string }> },
) {
const { name } = await context.params;
const forceRefresh = req.nextUrl.searchParams.get("force_refresh") ?? "false";
const url = `${API_BASE}/api/city/${encodeURIComponent(name)}?force_refresh=${forceRefresh}`;
try {
const res = await fetch(url, {
headers: { Accept: "application/json" },
cache: "no-store",
});
if (!res.ok) {
return NextResponse.json(
{ error: `Backend returned ${res.status}` },
{ status: 502 },
);
}
const data = await res.json();
return NextResponse.json(data);
} catch (error) {
return NextResponse.json(
{ error: "Failed to fetch city detail", detail: String(error) },
{ status: 500 },
);
}
}
+35
View File
@@ -0,0 +1,35 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--background: 222 47% 6%;
--foreground: 210 40% 98%;
--card: 222 47% 9%;
--card-foreground: 210 40% 98%;
--primary: 190 95% 52%;
--primary-foreground: 222 47% 8%;
--secondary: 223 36% 16%;
--secondary-foreground: 210 40% 98%;
--accent: 217 33% 18%;
--accent-foreground: 210 40% 98%;
--border: 220 33% 20%;
}
* {
border-color: hsl(var(--border));
}
body {
background:
radial-gradient(circle at 15% 5%, rgba(6, 78, 99, 0.2), transparent 45%),
radial-gradient(circle at 85% 85%, rgba(30, 41, 59, 0.4), transparent 42%),
hsl(var(--background));
color: hsl(var(--foreground));
}
.leaflet-container {
width: 100%;
height: 100%;
font-family: inherit;
}
+20
View File
@@ -0,0 +1,20 @@
import type { Metadata } from "next";
import "./globals.css";
export const metadata: Metadata = {
title: "PolyWeather | Weather Intelligence",
description:
"PolyWeather pro dashboard with global weather risk map and city analytics.",
};
export default function RootLayout({
children,
}: Readonly<{ children: React.ReactNode }>) {
return (
<html lang="zh-CN" className="dark">
<body className="min-h-screen font-sans antialiased">
{children}
</body>
</html>
);
}
+5
View File
@@ -0,0 +1,5 @@
import { PolyWeatherDashboard } from "@/components/polyweather-dashboard";
export default function HomePage() {
return <PolyWeatherDashboard />;
}