From e4d43ddf8cabe181b4a8c0744ea49f48cdf694a8 Mon Sep 17 00:00:00 2001
From: "2569718930@qq.com" <2569718930@qq.com>
Date: Thu, 23 Apr 2026 06:08:10 +0800
Subject: [PATCH] Remove view-all links and preserve manual map zoom
---
.../components/dashboard/Dashboard.module.css | 13 -------------
.../dashboard/PolyWeatherDashboard.tsx | 4 ----
frontend/hooks/useLeafletMap.ts | 16 ++++++++++++++++
3 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/frontend/components/dashboard/Dashboard.module.css b/frontend/components/dashboard/Dashboard.module.css
index b492b69e..877e502a 100644
--- a/frontend/components/dashboard/Dashboard.module.css
+++ b/frontend/components/dashboard/Dashboard.module.css
@@ -2131,12 +2131,6 @@
line-height: 1.2;
}
-.root :global(.home-summary-card-head span) {
- color: #60a5fa;
- font-size: 10px;
- font-weight: 700;
-}
-
.root :global(.home-summary-card-body) {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
@@ -2197,13 +2191,6 @@
line-height: 1.25;
}
-.root :global(.opportunity-view-all) {
- color: #60a5fa;
- text-decoration: none;
- font-size: 12px;
- font-weight: 700;
-}
-
.root :global(.opportunity-card-grid) {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
diff --git a/frontend/components/dashboard/PolyWeatherDashboard.tsx b/frontend/components/dashboard/PolyWeatherDashboard.tsx
index 3c45c7f1..504d50b5 100644
--- a/frontend/components/dashboard/PolyWeatherDashboard.tsx
+++ b/frontend/components/dashboard/PolyWeatherDashboard.tsx
@@ -1153,7 +1153,6 @@ function OpportunityStrip({ snapshots }: { snapshots: CitySnapshot[] }) {
{card.title}
- {locale === "en-US" ? "View all" : "查看全部"}
{card.items.map((item) => (
@@ -1189,9 +1188,6 @@ function OpportunityStrip({ snapshots }: { snapshots: CitySnapshot[] }) {
: "当前市场问题 · YES/NO 价格 · Edge · 小趋势线"}
-
- {locale === "en-US" ? "View all" : "查看全部"}
-
{items.length > 0 ? (
diff --git a/frontend/hooks/useLeafletMap.ts b/frontend/hooks/useLeafletMap.ts
index d76ec555..5b1536bb 100644
--- a/frontend/hooks/useLeafletMap.ts
+++ b/frontend/hooks/useLeafletMap.ts
@@ -33,6 +33,7 @@ const AUTO_NEARBY_MIN_ZOOM = 8;
const AUTO_NEARBY_MAX_DISTANCE_M = 120000;
const AUTO_NEARBY_IDLE_REFRESH_DELAY_MS = 10_000;
const AUTO_NEARBY_MIN_REFRESH_INTERVAL_MS = 60_000;
+const USER_CAMERA_OVERRIDE_MS = 10 * 60_000;
const MAP_MAX_ZOOM = 19;
const MAP_TILE_URLS = {
dark: "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",
@@ -405,6 +406,8 @@ export function useLeafletMap({
const loadingAutoNearbyRef = useRef(false);
const handlingAutoNearbyRef = useRef(false);
const lastMovedCityRef = useRef(null);
+ const lastCameraSelectionRef = useRef(null);
+ const lastUserCameraInteractionAtRef = useRef(0);
const suspendMotionRef = useRef(suspendMotion);
const hasFittedInitialBoundsRef = useRef(false);
const onClosePanelRef = useRef(onClosePanel);
@@ -482,6 +485,7 @@ export function useLeafletMap({
map.on("click", handleMapClick);
const markInteracting = () => {
+ lastUserCameraInteractionAtRef.current = Date.now();
if (interactionIdleTimerRef.current) {
clearTimeout(interactionIdleTimerRef.current);
interactionIdleTimerRef.current = null;
@@ -887,6 +891,7 @@ export function useLeafletMap({
useEffect(() => {
if (!selectedCity) {
lastMovedCityRef.current = null;
+ lastCameraSelectionRef.current = null;
return;
}
@@ -903,6 +908,17 @@ export function useLeafletMap({
const entry = markersRef.current[selectedCity];
if (!entry) return;
+ const selectionChanged = lastCameraSelectionRef.current !== selectedCity;
+ lastCameraSelectionRef.current = selectedCity;
+
+ if (
+ !selectionChanged &&
+ Date.now() - lastUserCameraInteractionAtRef.current < USER_CAMERA_OVERRIDE_MS
+ ) {
+ lastMovedCityRef.current = selectedCity;
+ return;
+ }
+
// Lock the move
lastMovedCityRef.current = selectedCity;