Refactor weather app logic and simplify related components

This commit is contained in:
2569718930@qq.com
2026-04-03 01:47:03 +08:00
parent e32eff6e31
commit 3e265d2764
6 changed files with 28 additions and 4 deletions
+3
View File
@@ -239,6 +239,7 @@ export interface MarketPrimary {
id?: string | null;
question?: string | null;
slug?: string | null;
market_url?: string | null;
condition_id?: string | null;
end_date?: string | null;
active?: boolean;
@@ -266,6 +267,8 @@ export interface MarketScan {
available?: boolean;
reason?: string | null;
primary_market?: MarketPrimary | null;
market_url?: string | null;
primary_market_url?: string | null;
selected_date?: string | null;
selected_condition_id?: string | null;
selected_slug?: string | null;
+10
View File
@@ -98,6 +98,16 @@ export function getTodayPolymarketUrl(
detail?: CityDetail | null,
locale: Locale = "en-US",
) {
const directMarketUrl = String(
detail?.market_scan?.market_url ||
detail?.market_scan?.primary_market_url ||
detail?.market_scan?.primary_market?.market_url ||
"",
).trim();
if (directMarketUrl) {
return directMarketUrl;
}
const cityKey = normalizeCityKey(detail);
const citySlug = CITY_TO_MARKET_SLUG[cityKey] || slugifyCityName(cityKey);
const dateParts = normalizeDateParts(detail?.local_date);