feat: Tạo trang bản đồ chỉ đường độc lập TourNavigationPage

- Thêm trang TourNavigationPage.tsx hiển thị full màn hình với
  top-bar, bản đồ fullscreen và nút la bàn nổi ở góc dưới bên phải
- Cập nhật ItineraryTimeline.tsx: thay thế LocationNavigationModal
  bằng callback onOpenNavigationPage để chuyển đến trang mới
- Đăng ký trang tourNavigation trong App.tsx với navigationPayload
- Cập nhật TourDetailPage.tsx truyền onOpenNavigationPage xuống
- Thêm INSTALL_MAP.md hướng dẫn thực hiện tính năng
This commit is contained in:
2026-06-25 10:17:23 +07:00
parent a135196cb5
commit f74587376e
6 changed files with 502 additions and 26 deletions
+4 -14
View File
@@ -5,7 +5,6 @@ import { useTourStore } from '@/store/useTourStore';
import { useConfirm } from '@/hooks/useConfirm';
import { useNotification } from '@/hooks/useNotification';
import { CommentModal } from '@/components/CommentModal';
import { LocationNavigationModal } from '@/components/LocationNavigationModal';
const TimeVariance = ({ planned, actual }: { planned: string, actual: string | null }) => {
if (!actual) return null;
@@ -51,6 +50,7 @@ export const ItineraryTimeline = ({
onEditLocation?: (location: any) => void,
onQuickNote?: (data: { legId: string; location: any; leg: any }) => void,
onNavigate?: (location: any) => void,
onOpenNavigationPage?: (routeData: { origin: { lat: number; lng: number }; destination: { lat: number; lng: number; name: string }; tourTitle: string }) => void,
onSuccess?: () => void,
isPublicView?: boolean
}) => {
@@ -78,11 +78,6 @@ export const ItineraryTimeline = ({
// State to track single expanded stage (exclusive single-expansion mode)
const [expandedStageId, setExpandedStageId] = useState<string | null>(legs.length > 0 ? legs[0]?.id : null);
const [navRouteData, setNavRouteData] = useState<{
origin: { lat: number; lng: number } | null;
destination: { lat: number; lng: number; name: string } | null;
}>({ origin: null, destination: null });
const [isNavModalOpen, setIsNavModalOpen] = useState(false);
const toggleStageExpanded = (legId: string) => {
// Exclusive mode: if clicking the same stage, close it. Otherwise, open only the clicked one.
@@ -146,7 +141,7 @@ export const ItineraryTimeline = ({
navigator.geolocation.getCurrentPosition(
(position) => {
setNavRouteData({
onOpenNavigationPage?.({
origin: {
lat: position.coords.latitude,
lng: position.coords.longitude
@@ -155,9 +150,9 @@ export const ItineraryTimeline = ({
lat: parseFloat(location.latitude),
lng: parseFloat(location.longitude),
name: location.name || "Điểm đến chọn sẵn"
}
},
tourTitle: currentTour?.title || "Chi tiết hành trình"
});
setIsNavModalOpen(true);
},
(error) => {
console.error("Error fetching native geolocation metrics:", error);
@@ -763,11 +758,6 @@ export const ItineraryTimeline = ({
onCommentAdded={() => handleCommentIncrement(commentLocationId)}
onCommentDeleted={() => handleCommentDecrement(commentLocationId)}
/>
<LocationNavigationModal
isOpen={isNavModalOpen}
onClose={() => setIsNavModalOpen(false)}
routeData={navRouteData}
/>
</div>
);
};