@
修复移动端城市列表搜索无数据显示:非 Pro 用户回退到基础城市数据源 MobileCityPicker 原依赖扫描终端 API rows,该 API 仅 Pro 用户触发, 导致访客/免费用户 cityListRows 为空,所有城市被 pickCityRow 过滤掉。 现新增 cityListRows fallback:无 scan 数据时从 store.cities + citySummariesByName 构建行数据,保证所有用户可见并搜索城市列表。 Constraint: fallback rows 缺少 metar/target 字段,但 MobileCityPicker 仅消费 display/temp/deb/airport 字段,不影响渲染。 @
This commit is contained in:
@@ -136,6 +136,43 @@ function ScanTerminalScreen() {
|
||||
() => sortRowsByUserTime(terminalData?.rows || []),
|
||||
[terminalData?.rows],
|
||||
);
|
||||
|
||||
const cityListRows = useMemo(() => {
|
||||
if (timeSortedRows.length > 0) return timeSortedRows;
|
||||
return store.cities.map((city, index) => {
|
||||
const cityKey = normalizeCityKey(city.name);
|
||||
const summary =
|
||||
store.citySummariesByName[cityKey] ??
|
||||
Object.values(store.citySummariesByName).find(
|
||||
(s) => normalizeCityKey(s?.name) === cityKey,
|
||||
) ??
|
||||
null;
|
||||
return {
|
||||
id: `city-fallback:${cityKey}:${index}`,
|
||||
city: cityKey,
|
||||
city_display_name: city.display_name || city.name,
|
||||
display_name: city.display_name || city.name,
|
||||
temp_symbol: city.temp_unit === "fahrenheit" ? "°F" : "°C",
|
||||
current_temp: summary?.current?.temp ?? null,
|
||||
current_max_so_far: summary?.current?.temp ?? null,
|
||||
deb_prediction: summary?.deb?.prediction ?? null,
|
||||
airport: city.airport || null,
|
||||
local_time: summary?.local_time ?? null,
|
||||
risk_level: city.risk_level || "low",
|
||||
market_slug: null,
|
||||
market_question: null,
|
||||
target_label: null,
|
||||
side: null,
|
||||
edge_percent: null,
|
||||
final_score: null,
|
||||
window_phase: null,
|
||||
tradable: false,
|
||||
active: false,
|
||||
closed: false,
|
||||
accepting_orders: false,
|
||||
} satisfies ScanOpportunityRow;
|
||||
});
|
||||
}, [timeSortedRows, store.cities, store.citySummariesByName]);
|
||||
const {
|
||||
addAiPinnedCity,
|
||||
aiPinnedCities,
|
||||
@@ -347,8 +384,8 @@ function ScanTerminalScreen() {
|
||||
return (
|
||||
<MobileCityPicker
|
||||
isEn={isEn}
|
||||
rows={timeSortedRows}
|
||||
onSelectCity={handleOpenDecisionRow}
|
||||
rows={cityListRows}
|
||||
onSelectCity={isPro ? handleOpenDecisionRow : handleSelectRow}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user