feat: thêm tính năng ghi note cho Tour

This commit is contained in:
2026-06-17 12:28:24 +07:00
parent e66f242c2c
commit 7ad785fed9
6 changed files with 681 additions and 16 deletions
+35 -12
View File
@@ -35,7 +35,8 @@ import {
MessageSquare,
Share2,
Tag as TagIcon,
Trash2
Trash2,
FileText
} from 'lucide-react';
import L from 'leaflet';
@@ -171,7 +172,17 @@ const MapContextMenu = ({ onAction }: { onAction: (action: string, latlng: L.Lat
);
};
export const TourDetailPage = ({ onBack, tourId, isPublicView = false }: { onBack: () => void, tourId: string, isPublicView?: boolean }) => {
export const TourDetailPage = ({
onBack,
tourId,
isPublicView = false,
onOpenNotes
}: {
onBack: () => void,
tourId: string,
isPublicView?: boolean,
onOpenNotes?: () => void
}) => {
// Tách biệt các state và actions để tối ưu performance - Chuyển lên đầu để tránh lỗi initialization
const currentTour = useTourStore(state => state.currentTour);
const legs = useTourStore(state => state.legs);
@@ -642,16 +653,28 @@ export const TourDetailPage = ({ onBack, tourId, isPublicView = false }: { onBac
<h1 className="text-lg font-bold text-gray-800 truncate px-4 flex-1 text-center">
{tourInfo.title}
</h1>
{/* Nút chia sẻ: Chỉ dành cho OWNER, MANAGER, MEMBER */}
{canShare && (
<button
onClick={handleShare}
className="p-2 hover:bg-blue-50 text-blue-600 rounded-full transition-colors"
title="Chia sẻ tour"
>
<Share2 className="w-5 h-5" />
</button>
)}
<div className="flex items-center gap-1">
{/* Nút Ghi chú: Chỉ hiển thị cho người dùng đã đăng nhập và không phải view công khai */}
{!isPublicView && onOpenNotes && (
<button
onClick={onOpenNotes}
className="p-2 hover:bg-amber-50 text-amber-600 rounded-full transition-colors"
title="Ghi chú của tôi"
>
<FileText className="w-5 h-5" />
</button>
)}
{/* Nút chia sẻ: Chỉ dành cho OWNER, MANAGER, MEMBER */}
{canShare && (
<button
onClick={handleShare}
className="p-2 hover:bg-blue-50 text-blue-600 rounded-full transition-colors"
title="Chia sẻ tour"
>
<Share2 className="w-5 h-5" />
</button>
)}
</div>
</div>
{/* Tour Header Info */}
<div className="relative min-h-[480px] w-full bg-blue-900 flex flex-col justify-end">