2026-03-09 10:36:03 +08:00
|
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
import clsx from "clsx";
|
2026-04-28 20:19:17 +08:00
|
|
|
|
import dynamic from "next/dynamic";
|
2026-03-26 01:19:56 +08:00
|
|
|
|
import { useRouter } from "next/navigation";
|
2026-03-18 20:38:43 +08:00
|
|
|
|
import { useEffect, useMemo, useRef, useState } from "react";
|
2026-03-10 04:45:40 +08:00
|
|
|
|
import { ForecastTable } from "@/components/dashboard/PanelSections";
|
2026-05-14 15:05:13 +08:00
|
|
|
|
import {
|
|
|
|
|
|
useDashboardModal,
|
|
|
|
|
|
useDashboardStore,
|
|
|
|
|
|
useProAccess,
|
|
|
|
|
|
} from "@/hooks/useDashboardStore";
|
2026-03-10 04:45:40 +08:00
|
|
|
|
import { useI18n } from "@/hooks/useI18n";
|
2026-05-14 21:31:05 +08:00
|
|
|
|
import { useRelativeTime } from "@/hooks/useRelativeTime";
|
2026-03-21 13:02:07 +08:00
|
|
|
|
import { getOfficialSourceLinks } from "@/lib/dashboard-official-sources";
|
2026-03-31 07:15:54 +08:00
|
|
|
|
import { trackAppEvent } from "@/lib/app-analytics";
|
2026-03-30 00:09:35 +08:00
|
|
|
|
import { getTodayPolymarketUrl } from "@/lib/polymarket-market-links";
|
2026-04-28 12:17:42 +08:00
|
|
|
|
import { getCityProfileStats } from "@/lib/dashboard-utils";
|
2026-04-22 23:43:27 +08:00
|
|
|
|
import { normalizeObservationSourceLabel } from "@/lib/source-labels";
|
2026-04-28 12:17:42 +08:00
|
|
|
|
import { getRiskBadgeLabel } from "@/lib/weather-summary-utils";
|
2026-03-10 04:45:40 +08:00
|
|
|
|
|
2026-04-28 20:19:17 +08:00
|
|
|
|
const DetailMiniTemperatureChart = dynamic(
|
|
|
|
|
|
() =>
|
|
|
|
|
|
import("@/components/dashboard/DetailMiniTemperatureChart").then(
|
|
|
|
|
|
(module) => module.DetailMiniTemperatureChart,
|
|
|
|
|
|
),
|
|
|
|
|
|
{
|
|
|
|
|
|
loading: () => <div className="detail-mini-chart detail-mini-chart-loading" />,
|
|
|
|
|
|
ssr: false,
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
2026-03-09 10:36:03 +08:00
|
|
|
|
|
2026-04-24 13:35:36 +08:00
|
|
|
|
export function DetailPanel({
|
|
|
|
|
|
variant = "overlay",
|
|
|
|
|
|
}: {
|
|
|
|
|
|
variant?: "overlay" | "rail";
|
|
|
|
|
|
} = {}) {
|
2026-03-09 10:36:03 +08:00
|
|
|
|
const store = useDashboardStore();
|
2026-05-14 15:05:13 +08:00
|
|
|
|
const modal = useDashboardModal();
|
|
|
|
|
|
const { proAccess } = useProAccess();
|
2026-03-10 04:45:40 +08:00
|
|
|
|
const { locale, t } = useI18n();
|
2026-03-26 01:19:56 +08:00
|
|
|
|
const router = useRouter();
|
2026-04-24 13:35:36 +08:00
|
|
|
|
const isRail = variant === "rail";
|
2026-03-09 10:36:03 +08:00
|
|
|
|
const detail = store.selectedDetail;
|
2026-03-26 00:29:14 +08:00
|
|
|
|
const selectedCityItem = useMemo(
|
|
|
|
|
|
() =>
|
|
|
|
|
|
store.selectedCity
|
|
|
|
|
|
? store.cities.find((city) => city.name === store.selectedCity) || null
|
|
|
|
|
|
: null,
|
|
|
|
|
|
[store.cities, store.selectedCity],
|
|
|
|
|
|
);
|
2026-04-08 18:25:25 +08:00
|
|
|
|
const selectedSummary = useMemo(
|
|
|
|
|
|
() =>
|
|
|
|
|
|
store.selectedCity
|
|
|
|
|
|
? store.citySummariesByName[store.selectedCity] || null
|
|
|
|
|
|
: null,
|
|
|
|
|
|
[store.citySummariesByName, store.selectedCity],
|
|
|
|
|
|
);
|
2026-05-14 15:05:13 +08:00
|
|
|
|
const isPro = proAccess.subscriptionActive;
|
|
|
|
|
|
const isAuthenticated = proAccess.authenticated;
|
2026-03-11 11:14:03 +08:00
|
|
|
|
const panelRef = useRef<HTMLElement | null>(null);
|
2026-05-14 21:31:05 +08:00
|
|
|
|
const lastDetailFetchedAtRef = useRef<number>(0);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (detail?.name) {
|
|
|
|
|
|
lastDetailFetchedAtRef.current = Date.now();
|
|
|
|
|
|
}
|
|
|
|
|
|
}, [detail?.name]);
|
|
|
|
|
|
|
|
|
|
|
|
const detailAgeText = useRelativeTime(
|
|
|
|
|
|
lastDetailFetchedAtRef.current
|
|
|
|
|
|
? new Date(lastDetailFetchedAtRef.current).toISOString()
|
|
|
|
|
|
: null,
|
|
|
|
|
|
);
|
2026-03-18 20:38:43 +08:00
|
|
|
|
const [heavyContentReady, setHeavyContentReady] = useState(false);
|
2026-04-23 22:35:34 +08:00
|
|
|
|
const isOverlayOpen =
|
2026-05-16 20:14:05 +08:00
|
|
|
|
Boolean(modal.futureModalDate);
|
2026-04-24 13:35:36 +08:00
|
|
|
|
const isVisible = isRail
|
|
|
|
|
|
? Boolean(store.selectedCity) && !isOverlayOpen
|
|
|
|
|
|
: store.isPanelOpen && Boolean(store.selectedCity) && !isOverlayOpen;
|
2026-04-23 22:35:34 +08:00
|
|
|
|
const hasBasicPanelContent = Boolean(
|
|
|
|
|
|
detail || selectedSummary || selectedCityItem,
|
|
|
|
|
|
);
|
2026-03-26 00:53:38 +08:00
|
|
|
|
const panelDisplayName =
|
|
|
|
|
|
detail?.display_name ||
|
2026-04-08 18:25:25 +08:00
|
|
|
|
selectedSummary?.display_name ||
|
2026-03-26 00:53:38 +08:00
|
|
|
|
selectedCityItem?.display_name ||
|
|
|
|
|
|
store.selectedCity ||
|
|
|
|
|
|
"...";
|
2026-04-08 18:25:25 +08:00
|
|
|
|
const panelRiskLevel =
|
|
|
|
|
|
detail?.risk?.level ||
|
|
|
|
|
|
selectedSummary?.risk?.level ||
|
|
|
|
|
|
selectedCityItem?.risk_level ||
|
|
|
|
|
|
"low";
|
2026-03-18 20:38:43 +08:00
|
|
|
|
const profileStats = useMemo(
|
|
|
|
|
|
() => (detail ? getCityProfileStats(detail, locale) : []),
|
|
|
|
|
|
[detail, locale],
|
|
|
|
|
|
);
|
2026-03-21 13:02:07 +08:00
|
|
|
|
const officialLinks = useMemo(
|
|
|
|
|
|
() => (detail ? getOfficialSourceLinks(detail) : []),
|
|
|
|
|
|
[detail],
|
|
|
|
|
|
);
|
2026-03-30 00:09:35 +08:00
|
|
|
|
const marketUrl = useMemo(
|
|
|
|
|
|
() => getTodayPolymarketUrl(detail, locale),
|
|
|
|
|
|
[detail, locale],
|
|
|
|
|
|
);
|
2026-04-22 23:43:27 +08:00
|
|
|
|
const basicSettlementLabel = normalizeObservationSourceLabel(
|
2026-04-08 18:25:25 +08:00
|
|
|
|
selectedSummary?.current?.settlement_source_label ||
|
2026-04-22 23:43:27 +08:00
|
|
|
|
selectedCityItem?.settlement_source_label ||
|
|
|
|
|
|
selectedCityItem?.settlement_source,
|
|
|
|
|
|
locale === "en-US" ? "Settlement source pending" : "结算口径待确认",
|
|
|
|
|
|
);
|
2026-04-08 18:25:25 +08:00
|
|
|
|
const basicAirportLabel =
|
|
|
|
|
|
selectedCityItem?.airport ||
|
|
|
|
|
|
selectedSummary?.icao ||
|
|
|
|
|
|
(locale === "en-US" ? "Airport pending" : "机场待确认");
|
2026-04-22 23:43:27 +08:00
|
|
|
|
const heroSettlementLabel = normalizeObservationSourceLabel(
|
|
|
|
|
|
detail?.current?.settlement_source_label,
|
|
|
|
|
|
basicSettlementLabel,
|
|
|
|
|
|
);
|
2026-04-15 23:51:54 +08:00
|
|
|
|
const heroAirportLabel = detail?.risk?.airport || basicAirportLabel;
|
2026-04-18 14:40:29 +08:00
|
|
|
|
const isSparsePanelDetail = Boolean(
|
2026-04-18 01:04:36 +08:00
|
|
|
|
detail &&
|
2026-04-23 22:35:34 +08:00
|
|
|
|
(detail.detail_depth !== "full" ||
|
|
|
|
|
|
(detail.forecast?.daily?.length ?? 0) <= 1),
|
2026-04-18 01:04:36 +08:00
|
|
|
|
);
|
2026-04-18 14:40:29 +08:00
|
|
|
|
const isPanelSyncing = store.loadingState.cityDetail;
|
2026-04-26 10:43:14 +08:00
|
|
|
|
const [panelSyncTimedOut, setPanelSyncTimedOut] = useState(false);
|
|
|
|
|
|
const showPanelSyncing = isPanelSyncing && !panelSyncTimedOut;
|
|
|
|
|
|
const isShowingCachedDetailDuringSync = false;
|
2026-04-15 23:51:54 +08:00
|
|
|
|
|
2026-03-11 11:14:03 +08:00
|
|
|
|
const blurActiveElement = () => {
|
|
|
|
|
|
if (typeof document === "undefined") return;
|
|
|
|
|
|
const active = document.activeElement;
|
|
|
|
|
|
if (active instanceof HTMLElement) {
|
|
|
|
|
|
active.blur();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2026-04-15 23:51:54 +08:00
|
|
|
|
|
2026-05-16 20:14:05 +08:00
|
|
|
|
const handleTodayAccess = () => {
|
2026-03-26 01:19:56 +08:00
|
|
|
|
blurActiveElement();
|
|
|
|
|
|
|
|
|
|
|
|
if (isPro) {
|
2026-05-16 20:14:05 +08:00
|
|
|
|
void modal.openTodayModal();
|
2026-03-26 01:19:56 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 19:06:04 +08:00
|
|
|
|
trackAppEvent("paywall_feature_clicked", {
|
|
|
|
|
|
entry: "detail_panel",
|
|
|
|
|
|
feature: "today",
|
|
|
|
|
|
city: store.selectedCity,
|
|
|
|
|
|
user_state: isAuthenticated ? "logged_in" : "guest",
|
|
|
|
|
|
});
|
|
|
|
|
|
router.push("/account");
|
2026-03-26 01:19:56 +08:00
|
|
|
|
};
|
2026-03-11 11:14:03 +08:00
|
|
|
|
|
2026-04-26 10:43:14 +08:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (!isPanelSyncing || !store.selectedCity) {
|
|
|
|
|
|
setPanelSyncTimedOut(false);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setPanelSyncTimedOut(false);
|
|
|
|
|
|
const timeoutId = window.setTimeout(() => {
|
|
|
|
|
|
setPanelSyncTimedOut(true);
|
|
|
|
|
|
}, 12_000);
|
|
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
|
window.clearTimeout(timeoutId);
|
|
|
|
|
|
};
|
|
|
|
|
|
}, [isPanelSyncing, store.selectedCity]);
|
|
|
|
|
|
|
2026-03-11 11:14:03 +08:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
const panel = panelRef.current;
|
|
|
|
|
|
if (!panel) return;
|
|
|
|
|
|
|
|
|
|
|
|
if (!isVisible) {
|
|
|
|
|
|
panel.setAttribute("inert", "");
|
2026-04-23 22:35:34 +08:00
|
|
|
|
if (
|
|
|
|
|
|
typeof document !== "undefined" &&
|
|
|
|
|
|
panel.contains(document.activeElement)
|
|
|
|
|
|
) {
|
2026-03-11 11:14:03 +08:00
|
|
|
|
const active = document.activeElement;
|
|
|
|
|
|
if (active instanceof HTMLElement) {
|
|
|
|
|
|
active.blur();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
panel.removeAttribute("inert");
|
|
|
|
|
|
}, [isVisible]);
|
2026-03-09 10:36:03 +08:00
|
|
|
|
|
2026-03-18 20:38:43 +08:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (!isVisible || !detail) {
|
|
|
|
|
|
setHeavyContentReady(false);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let canceled = false;
|
|
|
|
|
|
let timeoutId: number | null = null;
|
|
|
|
|
|
let idleId: number | null = null;
|
|
|
|
|
|
const win = typeof window !== "undefined" ? (window as any) : null;
|
|
|
|
|
|
|
|
|
|
|
|
const markReady = () => {
|
|
|
|
|
|
if (!canceled) {
|
|
|
|
|
|
setHeavyContentReady(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (win && typeof win.requestIdleCallback === "function") {
|
|
|
|
|
|
idleId = win.requestIdleCallback(markReady, { timeout: 180 });
|
|
|
|
|
|
} else if (typeof window !== "undefined") {
|
|
|
|
|
|
timeoutId = window.setTimeout(markReady, 80);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
setHeavyContentReady(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
|
canceled = true;
|
2026-04-23 22:35:34 +08:00
|
|
|
|
if (
|
|
|
|
|
|
win &&
|
|
|
|
|
|
idleId != null &&
|
|
|
|
|
|
typeof win.cancelIdleCallback === "function"
|
|
|
|
|
|
) {
|
2026-03-18 20:38:43 +08:00
|
|
|
|
win.cancelIdleCallback(idleId);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (timeoutId != null && typeof window !== "undefined") {
|
|
|
|
|
|
window.clearTimeout(timeoutId);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
}, [detail, isVisible]);
|
|
|
|
|
|
|
2026-03-09 10:36:03 +08:00
|
|
|
|
return (
|
2026-04-23 22:35:34 +08:00
|
|
|
|
<aside
|
|
|
|
|
|
ref={panelRef}
|
2026-04-24 13:35:36 +08:00
|
|
|
|
className={clsx(
|
|
|
|
|
|
"detail-panel",
|
|
|
|
|
|
isRail && "scan-city-detail-rail",
|
|
|
|
|
|
(isVisible || isRail) && "visible",
|
|
|
|
|
|
)}
|
2026-04-23 22:35:34 +08:00
|
|
|
|
>
|
2026-03-09 10:36:03 +08:00
|
|
|
|
<div className="panel-header">
|
2026-04-24 13:35:36 +08:00
|
|
|
|
{!isRail ? (
|
|
|
|
|
|
<button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
className="panel-close"
|
|
|
|
|
|
aria-label={t("detail.closeAria")}
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
blurActiveElement();
|
|
|
|
|
|
store.closePanel();
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
×
|
|
|
|
|
|
</button>
|
|
|
|
|
|
) : null}
|
2026-04-23 22:35:34 +08:00
|
|
|
|
<div className="panel-title-area">
|
2026-04-15 23:51:54 +08:00
|
|
|
|
<div className="panel-title-stack">
|
|
|
|
|
|
<div className="panel-overline">
|
|
|
|
|
|
<span>{locale === "en-US" ? "City briefing" : "城市简报"}</span>
|
|
|
|
|
|
<span className="panel-overline-sep">•</span>
|
|
|
|
|
|
<span>{panelDisplayName.toUpperCase()}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<h2>{panelDisplayName}</h2>
|
|
|
|
|
|
</div>
|
2026-04-26 10:43:14 +08:00
|
|
|
|
{showPanelSyncing && (
|
2026-04-23 22:35:34 +08:00
|
|
|
|
<div
|
|
|
|
|
|
className="panel-loading-hint"
|
|
|
|
|
|
role="status"
|
|
|
|
|
|
aria-live="polite"
|
|
|
|
|
|
>
|
2026-04-09 08:29:02 +08:00
|
|
|
|
<span className="panel-loading-spinner" aria-hidden="true" />
|
|
|
|
|
|
<span>
|
|
|
|
|
|
{locale === "en-US"
|
2026-04-18 14:40:29 +08:00
|
|
|
|
? isSparsePanelDetail
|
2026-04-18 01:04:36 +08:00
|
|
|
|
? `Completing ${panelDisplayName} cards...`
|
|
|
|
|
|
: `Syncing ${panelDisplayName}...`
|
2026-04-18 14:40:29 +08:00
|
|
|
|
: isSparsePanelDetail
|
2026-04-18 01:04:36 +08:00
|
|
|
|
? `正在补齐 ${panelDisplayName} 卡片...`
|
|
|
|
|
|
: `正在同步 ${panelDisplayName}...`}
|
2026-04-09 08:29:02 +08:00
|
|
|
|
</span>
|
2026-05-10 16:13:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{panelSyncTimedOut && (
|
|
|
|
|
|
<div className="panel-loading-hint timed-out" role="alert">
|
|
|
|
|
|
<span>
|
|
|
|
|
|
{locale === "en-US"
|
|
|
|
|
|
? "Sync is taking longer than expected. Data shown may be incomplete."
|
|
|
|
|
|
: "同步时间较长,当前展示的数据可能不完整。"}
|
|
|
|
|
|
</span>
|
2026-04-09 08:29:02 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
2026-03-09 10:36:03 +08:00
|
|
|
|
<div className="panel-meta">
|
2026-03-26 00:53:38 +08:00
|
|
|
|
<span className={clsx("risk-badge", panelRiskLevel)}>
|
|
|
|
|
|
{getRiskBadgeLabel(panelRiskLevel, locale)}
|
2026-03-09 10:36:03 +08:00
|
|
|
|
</span>
|
2026-05-14 21:31:05 +08:00
|
|
|
|
{detailAgeText ? (
|
|
|
|
|
|
<span
|
|
|
|
|
|
className="panel-meta-chip panel-meta-chip-muted"
|
|
|
|
|
|
title={
|
|
|
|
|
|
locale === "en-US"
|
|
|
|
|
|
? "Time since last data refresh"
|
|
|
|
|
|
: "上次数据更新时间"
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
|
|
|
|
|
{locale === "en-US" ? "Updated " : "更新于 "}
|
|
|
|
|
|
{detailAgeText}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
) : null}
|
2026-04-23 22:35:34 +08:00
|
|
|
|
<span className="panel-meta-chip panel-meta-chip-strong">
|
|
|
|
|
|
{heroSettlementLabel}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span className="panel-meta-chip panel-meta-chip-muted">
|
|
|
|
|
|
{heroAirportLabel}
|
|
|
|
|
|
</span>
|
2026-04-15 23:51:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div className="panel-actions">
|
|
|
|
|
|
{marketUrl ? (
|
|
|
|
|
|
<a
|
|
|
|
|
|
className="panel-action-button panel-action-button-ghost"
|
|
|
|
|
|
href={marketUrl}
|
|
|
|
|
|
target="_blank"
|
|
|
|
|
|
rel="noreferrer"
|
2026-03-13 08:15:27 +08:00
|
|
|
|
title={
|
2026-04-15 23:51:54 +08:00
|
|
|
|
locale === "en-US"
|
|
|
|
|
|
? "Open today's Polymarket market"
|
|
|
|
|
|
: "打开今日 Polymarket 题目页"
|
2026-03-13 08:15:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
>
|
2026-04-15 23:51:54 +08:00
|
|
|
|
{locale === "en-US" ? "Market" : "市场页"}
|
|
|
|
|
|
</a>
|
|
|
|
|
|
) : null}
|
2026-03-09 10:36:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-04-23 22:35:34 +08:00
|
|
|
|
<div
|
|
|
|
|
|
className={clsx(
|
|
|
|
|
|
"panel-body",
|
|
|
|
|
|
isShowingCachedDetailDuringSync && "is-syncing",
|
|
|
|
|
|
)}
|
|
|
|
|
|
>
|
2026-04-18 23:14:25 +08:00
|
|
|
|
{isShowingCachedDetailDuringSync ? (
|
|
|
|
|
|
<div className="panel-sync-blocker" role="status" aria-live="polite">
|
|
|
|
|
|
<span className="panel-loading-spinner" aria-hidden="true" />
|
|
|
|
|
|
<span>
|
|
|
|
|
|
{locale === "en-US"
|
|
|
|
|
|
? `Refreshing ${panelDisplayName}. Current cards are paused until the latest data arrives.`
|
|
|
|
|
|
: `正在刷新 ${panelDisplayName},最新数据返回前暂停展示旧卡片。`}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
) : null}
|
2026-04-23 22:35:34 +08:00
|
|
|
|
<div
|
|
|
|
|
|
className={clsx(
|
|
|
|
|
|
isShowingCachedDetailDuringSync && "panel-content-stale",
|
|
|
|
|
|
)}
|
|
|
|
|
|
>
|
|
|
|
|
|
{!hasBasicPanelContent ? (
|
|
|
|
|
|
<section className="detail-summary-shell detail-empty-state">
|
2026-04-15 23:51:54 +08:00
|
|
|
|
<div className="detail-section-head">
|
|
|
|
|
|
<div>
|
2026-04-23 22:35:34 +08:00
|
|
|
|
<div className="detail-section-kicker">
|
|
|
|
|
|
{locale === "en-US" ? "No city selected" : "尚未选择城市"}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<h3>
|
|
|
|
|
|
{locale === "en-US"
|
|
|
|
|
|
? "Pick a city to start."
|
|
|
|
|
|
: "先选择一个城市。"}
|
|
|
|
|
|
</h3>
|
2026-04-15 23:51:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-04-23 22:35:34 +08:00
|
|
|
|
<div style={{ color: "var(--text-muted)", fontSize: "13px" }}>
|
2026-04-26 10:43:14 +08:00
|
|
|
|
{showPanelSyncing
|
2026-04-23 22:35:34 +08:00
|
|
|
|
? t("detail.loading")
|
|
|
|
|
|
: t("detail.emptyHint")}
|
2026-03-09 10:36:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
2026-04-23 22:35:34 +08:00
|
|
|
|
) : !detail ? (
|
|
|
|
|
|
<div className="detail-mini-meta" role="status" aria-live="polite">
|
2026-04-26 10:43:14 +08:00
|
|
|
|
{showPanelSyncing
|
2026-04-23 22:35:34 +08:00
|
|
|
|
? locale === "en-US"
|
|
|
|
|
|
? "Loading city cards..."
|
|
|
|
|
|
: "正在加载城市卡片..."
|
|
|
|
|
|
: locale === "en-US"
|
|
|
|
|
|
? "City cards will appear here."
|
|
|
|
|
|
: "城市卡片会显示在这里。"}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<>
|
2026-04-15 23:51:54 +08:00
|
|
|
|
<section className="detail-structured-section">
|
|
|
|
|
|
<div className="detail-section-head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div className="detail-section-kicker">
|
2026-04-23 22:35:34 +08:00
|
|
|
|
{locale === "en-US" ? "Profile" : "城市画像"}
|
2026-04-15 23:51:54 +08:00
|
|
|
|
</div>
|
2026-04-23 22:35:34 +08:00
|
|
|
|
<h3>{t("detail.profile")}</h3>
|
2026-04-15 23:51:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-04-23 22:35:34 +08:00
|
|
|
|
<div className="detail-grid">
|
|
|
|
|
|
{profileStats.map((item) => (
|
|
|
|
|
|
<article key={item.label} className="detail-card">
|
|
|
|
|
|
<span className="detail-label">{item.label}</span>
|
|
|
|
|
|
<span className="detail-value">{item.value}</span>
|
|
|
|
|
|
</article>
|
2026-03-21 13:02:07 +08:00
|
|
|
|
))}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
2026-04-23 22:35:34 +08:00
|
|
|
|
{officialLinks.length > 0 ? (
|
|
|
|
|
|
<section className="detail-structured-section">
|
|
|
|
|
|
<div className="detail-section-head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div className="detail-section-kicker">
|
|
|
|
|
|
{locale === "en-US" ? "Primary references" : "官方参考"}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<h3>
|
|
|
|
|
|
{locale === "en-US"
|
|
|
|
|
|
? "Settlement and observation references"
|
|
|
|
|
|
: "结算与观测参考来源"}
|
|
|
|
|
|
</h3>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<p className="detail-source-note">
|
|
|
|
|
|
{locale === "en-US"
|
|
|
|
|
|
? "AGENCY = national meteorological service, METAR = airport observation, AIRPORT = airport official page."
|
|
|
|
|
|
: "AGENCY = 国家气象机构,METAR = 机场实测报文,AIRPORT = 机场官网页面。"}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<div className="detail-source-list">
|
|
|
|
|
|
{officialLinks.map((link) => (
|
|
|
|
|
|
<a
|
|
|
|
|
|
key={`${link.label}-${link.href}`}
|
|
|
|
|
|
className="detail-source-link"
|
|
|
|
|
|
href={link.href}
|
|
|
|
|
|
target="_blank"
|
|
|
|
|
|
rel="noreferrer"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span className="detail-source-kind">
|
|
|
|
|
|
{link.kind.toUpperCase()}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span className="detail-source-label">
|
|
|
|
|
|
{link.label}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
|
|
<section className="detail-structured-section rounded-2xl">
|
|
|
|
|
|
<div className="detail-section-head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div className="detail-section-kicker">
|
|
|
|
|
|
{locale === "en-US" ? "Mini trend" : "温度微趋势"}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<h3>{t("detail.todayMiniTrend")}</h3>
|
2026-04-15 23:51:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-04-23 22:35:34 +08:00
|
|
|
|
{heavyContentReady ? (
|
|
|
|
|
|
<DetailMiniTemperatureChart detail={detail} />
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<div className="detail-mini-meta">{t("detail.loading")}</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</section>
|
2026-03-09 10:36:03 +08:00
|
|
|
|
|
2026-04-23 22:35:34 +08:00
|
|
|
|
{heavyContentReady ? <ForecastTable /> : null}
|
|
|
|
|
|
</>
|
|
|
|
|
|
)}
|
2026-04-18 23:14:25 +08:00
|
|
|
|
</div>
|
2026-03-09 10:36:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</aside>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|