Refactor weather app logic and simplify related components
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user