前端接入监控页面:新增 Monitor 标签页 + /api/m 代理
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { buildBackendRequestHeaders } from "@/lib/backend-auth";
|
||||
|
||||
const API_BASE = process.env.POLYWEATHER_API_BASE_URL;
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
if (!API_BASE) {
|
||||
return new NextResponse("API not configured", { status: 500 });
|
||||
}
|
||||
const isCards = req.nextUrl.searchParams.get("cards") === "1";
|
||||
const path = isCards ? "/m/cards" : "/m";
|
||||
const auth = await buildBackendRequestHeaders(req, { includeSupabaseIdentity: false });
|
||||
const res = await fetch(`${API_BASE}${path}`, { headers: auth.headers });
|
||||
const html = await res.text();
|
||||
return new NextResponse(html, {
|
||||
status: res.status,
|
||||
headers: { "Content-Type": "text/html; charset=utf-8" },
|
||||
});
|
||||
}
|
||||
@@ -47,7 +47,7 @@ import {
|
||||
useUserLocalClock,
|
||||
} from "@/components/dashboard/scan-terminal/use-scan-terminal-ui-state";
|
||||
|
||||
type ContentView = "analysis" | "map";
|
||||
type ContentView = "analysis" | "map" | "monitor";
|
||||
|
||||
const CityDetailPanel = dynamic(
|
||||
() =>
|
||||
@@ -334,6 +334,17 @@ function ScanTerminalScreen() {
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (resolvedView === "monitor") {
|
||||
return (
|
||||
<div className="scan-map-view" style={{ background: "#0f1117" }}>
|
||||
<iframe
|
||||
src="/api/m"
|
||||
style={{ width: "100%", height: "100%", border: "none" }}
|
||||
title="Market Monitor"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (!isPro) {
|
||||
return (
|
||||
<div className="scan-table-shell empty">
|
||||
@@ -529,6 +540,15 @@ function ScanTerminalScreen() {
|
||||
>
|
||||
{isEn ? "Decision Cards" : "城市决策卡"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={resolvedView === "monitor"}
|
||||
className={resolvedView === "monitor" ? "active" : ""}
|
||||
onClick={() => setActiveView("monitor")}
|
||||
>
|
||||
🔥 Monitor
|
||||
</button>
|
||||
</div>
|
||||
<div className="scan-list-status">
|
||||
{terminalData?.generated_at ? (
|
||||
|
||||
Reference in New Issue
Block a user