refactor: remove redundant telegram pricing, align daily forecast date, and hide sunrise/sunset from UI
This commit is contained in:
@@ -3015,23 +3015,6 @@ export function AccountCenter() {
|
||||
<p className="text-slate-400 text-sm mb-6">
|
||||
{copy.telegramHint}
|
||||
</p>
|
||||
{backend?.telegram_pricing?.is_group_member ? (
|
||||
<div className="mb-5 rounded-2xl border border-emerald-400/25 bg-emerald-500/8 px-4 py-3">
|
||||
<p className="text-xs font-bold text-emerald-200">
|
||||
Telegram 群成员价格
|
||||
</p>
|
||||
<p className="mt-1 text-[11px] leading-5 text-emerald-100/75">
|
||||
已验证群成员身份,当前会员价{" "}
|
||||
{backend.telegram_pricing.amount_usdc ?? "5"}U。
|
||||
</p>
|
||||
<div className="mt-3">
|
||||
<span className="rounded-full border border-white/10 bg-black/25 px-3 py-1.5 text-[11px] font-bold text-white">
|
||||
当前价格: {backend.telegram_pricing.amount_usdc ?? "5"}U
|
||||
· 群成员
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="mb-4 flex flex-wrap gap-2">
|
||||
{TELEGRAM_TOPICS_GROUP_URL &&
|
||||
|
||||
@@ -29,9 +29,6 @@ export function FutureAnchorStatusCard({
|
||||
currentTempText,
|
||||
weatherSummary,
|
||||
obsTime,
|
||||
daylightProgress,
|
||||
sunrise,
|
||||
sunset,
|
||||
topObservedTemp,
|
||||
tempSymbol,
|
||||
gapToBaseBucket,
|
||||
@@ -41,9 +38,6 @@ export function FutureAnchorStatusCard({
|
||||
currentTempText: string;
|
||||
weatherSummary: WeatherSummaryView;
|
||||
obsTime?: string | null;
|
||||
daylightProgress: DaylightProgressView | null;
|
||||
sunrise?: string | null;
|
||||
sunset?: string | null;
|
||||
topObservedTemp: number | string | null | undefined;
|
||||
tempSymbol: string;
|
||||
gapToBaseBucket: number | null;
|
||||
@@ -74,28 +68,6 @@ export function FutureAnchorStatusCard({
|
||||
</div>
|
||||
</div>
|
||||
<div className="future-v2-hero-obs">@{obsTime || "--"}</div>
|
||||
{daylightProgress ? (
|
||||
<div className="future-v2-daylight">
|
||||
<div className="future-v2-daylight-head">
|
||||
<span>{locale === "en-US" ? "Solar Window" : "昼夜进度"}</span>
|
||||
<strong>
|
||||
{daylightProgress.phase} {Math.round(daylightProgress.percent)}%
|
||||
</strong>
|
||||
</div>
|
||||
<div
|
||||
className="future-v2-daylight-bar"
|
||||
style={
|
||||
{
|
||||
"--daylight-progress": `${daylightProgress.percent}%`,
|
||||
} as CSSProperties & { "--daylight-progress": string }
|
||||
}
|
||||
/>
|
||||
<div className="future-v2-daylight-times">
|
||||
<span>{sunrise || "--"}</span>
|
||||
<span>{sunset || "--"}</span>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="future-v2-mini-grid">
|
||||
<FutureMiniMetric
|
||||
label={locale === "en-US" ? "High so far" : "日内已见高点"}
|
||||
@@ -117,14 +89,6 @@ export function FutureAnchorStatusCard({
|
||||
label={locale === "en-US" ? "Path state" : "路径状态"}
|
||||
value={pathStatus}
|
||||
/>
|
||||
<FutureMiniMetric
|
||||
label={locale === "en-US" ? "Sunrise" : "日出时间"}
|
||||
value={sunrise || "--"}
|
||||
/>
|
||||
<FutureMiniMetric
|
||||
label={locale === "en-US" ? "Sunset" : "日落时间"}
|
||||
value={sunset || "--"}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
@@ -94,9 +94,6 @@ export function FutureForecastTodayLayout(props: FutureForecastTodayLayoutProps)
|
||||
currentTempText={currentTempText}
|
||||
weatherSummary={weatherSummary}
|
||||
obsTime={detail.current?.obs_time}
|
||||
daylightProgress={daylightProgress}
|
||||
sunrise={detail.forecast?.sunrise}
|
||||
sunset={detail.forecast?.sunset}
|
||||
topObservedTemp={topObservedTemp}
|
||||
tempSymbol={detail.temp_symbol}
|
||||
gapToBaseBucket={gapToBaseBucket}
|
||||
|
||||
+34
-6
@@ -1239,11 +1239,26 @@ def _analyze(
|
||||
|
||||
# ── 3. Daily forecast ──
|
||||
daily = om.get("daily", {})
|
||||
dates = daily.get("time", [])[:5]
|
||||
maxtemps = daily.get("temperature_2m_max", [])[:5]
|
||||
sunrises = daily.get("sunrise", [])
|
||||
sunsets = daily.get("sunset", [])
|
||||
sunshine = daily.get("sunshine_duration", [])
|
||||
all_dates = daily.get("time", [])
|
||||
all_maxtemps = daily.get("temperature_2m_max", [])
|
||||
all_sunrises = daily.get("sunrise", [])
|
||||
all_sunsets = daily.get("sunset", [])
|
||||
all_sunshine = daily.get("sunshine_duration", [])
|
||||
|
||||
start_idx = 0
|
||||
if local_date_str in all_dates:
|
||||
start_idx = all_dates.index(local_date_str)
|
||||
else:
|
||||
for idx, d in enumerate(all_dates):
|
||||
if d >= local_date_str:
|
||||
start_idx = idx
|
||||
break
|
||||
|
||||
dates = all_dates[start_idx : start_idx + 5]
|
||||
maxtemps = all_maxtemps[start_idx : start_idx + 5]
|
||||
sunrises = all_sunrises[start_idx : start_idx + 5]
|
||||
sunsets = all_sunsets[start_idx : start_idx + 5]
|
||||
sunshine = all_sunshine[start_idx : start_idx + 5]
|
||||
om_today = _sf(maxtemps[0]) if maxtemps else None
|
||||
|
||||
forecast_daily = _dedupe_forecast_daily(
|
||||
@@ -2067,7 +2082,20 @@ def _analyze_summary(city: str, force_refresh: bool = False) -> Dict[str, Any]:
|
||||
|
||||
om_daily = (open_meteo.get("daily") or {}) if isinstance(open_meteo, dict) else {}
|
||||
om_hourly = (open_meteo.get("hourly") or {}) if isinstance(open_meteo, dict) else {}
|
||||
maxtemps = om_daily.get("temperature_2m_max", [])[:5]
|
||||
|
||||
all_dates = om_daily.get("time", [])
|
||||
all_maxtemps = om_daily.get("temperature_2m_max", [])
|
||||
|
||||
start_idx = 0
|
||||
if local_date_str in all_dates:
|
||||
start_idx = all_dates.index(local_date_str)
|
||||
else:
|
||||
for idx, d in enumerate(all_dates):
|
||||
if d >= local_date_str:
|
||||
start_idx = idx
|
||||
break
|
||||
|
||||
maxtemps = all_maxtemps[start_idx : start_idx + 5]
|
||||
om_today = _sf(maxtemps[0]) if maxtemps else None
|
||||
nws_high = _sf((nws or {}).get("today_high")) if isinstance(nws, dict) else None
|
||||
mgm_high = _sf((mgm or {}).get("today_high")) if isinstance(mgm, dict) else None
|
||||
|
||||
Reference in New Issue
Block a user