Show syncing state while loading city snapshot
This commit is contained in:
@@ -199,6 +199,8 @@ export function DetailPanel() {
|
|||||||
selectedCityItem?.airport ||
|
selectedCityItem?.airport ||
|
||||||
selectedSummary?.icao ||
|
selectedSummary?.icao ||
|
||||||
(locale === "en-US" ? "Airport pending" : "机场待确认");
|
(locale === "en-US" ? "Airport pending" : "机场待确认");
|
||||||
|
const isBasicSummaryLoading =
|
||||||
|
!detail && !selectedSummary && store.loadingState.cityDetail;
|
||||||
const blurActiveElement = () => {
|
const blurActiveElement = () => {
|
||||||
if (typeof document === "undefined") return;
|
if (typeof document === "undefined") return;
|
||||||
const active = document.activeElement;
|
const active = document.activeElement;
|
||||||
@@ -379,6 +381,13 @@ export function DetailPanel() {
|
|||||||
<>
|
<>
|
||||||
<section className="detail-section">
|
<section className="detail-section">
|
||||||
<h3>{locale === "en-US" ? "City Snapshot" : "城市概览"}</h3>
|
<h3>{locale === "en-US" ? "City Snapshot" : "城市概览"}</h3>
|
||||||
|
{isBasicSummaryLoading ? (
|
||||||
|
<div className="detail-mini-meta">
|
||||||
|
{locale === "en-US"
|
||||||
|
? "Syncing public city snapshot..."
|
||||||
|
: "正在同步城市基础信息..."}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
<div className="detail-grid">
|
<div className="detail-grid">
|
||||||
<div className="detail-card">
|
<div className="detail-card">
|
||||||
<span className="detail-label">
|
<span className="detail-label">
|
||||||
@@ -406,8 +415,12 @@ export function DetailPanel() {
|
|||||||
{basicDeb != null
|
{basicDeb != null
|
||||||
? `${basicDeb}${selectedSummary?.temp_symbol || ""}`
|
? `${basicDeb}${selectedSummary?.temp_symbol || ""}`
|
||||||
: locale === "en-US"
|
: locale === "en-US"
|
||||||
? "Pending"
|
? isBasicSummaryLoading
|
||||||
: "待更新"}
|
? "Syncing..."
|
||||||
|
: "Pending"
|
||||||
|
: isBasicSummaryLoading
|
||||||
|
? "同步中..."
|
||||||
|
: "待更新"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="detail-card">
|
<div className="detail-card">
|
||||||
|
|||||||
@@ -588,6 +588,7 @@ export function DashboardStoreProvider({
|
|||||||
}
|
}
|
||||||
const access = proAccessRef.current;
|
const access = proAccessRef.current;
|
||||||
if (!access.authenticated || !access.subscriptionActive) {
|
if (!access.authenticated || !access.subscriptionActive) {
|
||||||
|
setLoadingState((current) => ({ ...current, cityDetail: true }));
|
||||||
if (!citySummariesRef.current[cityName]) {
|
if (!citySummariesRef.current[cityName]) {
|
||||||
try {
|
try {
|
||||||
const summary = await dashboardClient.getCitySummary(cityName);
|
const summary = await dashboardClient.getCitySummary(cityName);
|
||||||
@@ -595,7 +596,12 @@ export function DashboardStoreProvider({
|
|||||||
...current,
|
...current,
|
||||||
[cityName]: summary,
|
[cityName]: summary,
|
||||||
}));
|
}));
|
||||||
} catch {}
|
} catch {
|
||||||
|
} finally {
|
||||||
|
setLoadingState((current) => ({ ...current, cityDetail: false }));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setLoadingState((current) => ({ ...current, cityDetail: false }));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user