Sửa hiển thị điểm đầu và điểm cuối của chặng

This commit is contained in:
2026-06-14 09:28:33 +07:00
parent ed437cdb0f
commit 14bf43487e
17 changed files with 189 additions and 12 deletions
+8
View File
@@ -89,6 +89,7 @@ export const TourDetailPage = ({ onBack }) => {
const setMapCenter = useTourStore(state => state.setMapCenter);
const updateTourStartPoint = useTourStore(state => state.updateTourStartPoint);
const updateTourEndPoint = useTourStore(state => state.updateTourEndPoint);
const initializeLegs = useTourStore(state => state.initializeLegs);
const addLocation = useTourStore(state => state.addLocation);
const [mapZoom] = useState(initialViewState?.zoom || 13);
const allLocations = useMemo(() => legs.flatMap(l => l.locations), [legs]);
@@ -108,6 +109,13 @@ export const TourDetailPage = ({ onBack }) => {
fetchTour(publicTours[0].id);
}
}, [publicTours, currentTour, fetchTour]);
const handleDeclareLegs = async () => {
const countStr = window.prompt("Chuyến đi này bạn muốn chia làm bao nhiêu chặng?", "3");
const count = parseInt(countStr || "0");
if (count > 0 && currentTour) {
await initializeLegs(currentTour.id, count);
}
};
const handleMapAction = async (action, latlng) => {
console.log(`[FRONTEND] Triggered ${action} at:`, { lat: latlng.lat, lng: latlng.lng });
const currentLegs = useTourStore.getState().legs;