Thêm tính năng click chuột phải vào bong bóng để lấy link chia sẻ
This commit is contained in:
@@ -28,7 +28,8 @@ import {
|
||||
Clock,
|
||||
Check,
|
||||
X,
|
||||
MessageSquare
|
||||
MessageSquare,
|
||||
Share2
|
||||
} from 'lucide-react';
|
||||
import L from 'leaflet';
|
||||
|
||||
@@ -263,6 +264,22 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
const handleShare = () => {
|
||||
if (!currentTour) return;
|
||||
// Tạo link với query param ?viewTour=...
|
||||
const shareUrl = `${window.location.origin}?viewTour=${currentTour.id}`;
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
title: currentTour.title,
|
||||
url: shareUrl,
|
||||
}).catch(() => {});
|
||||
} else {
|
||||
navigator.clipboard.writeText(shareUrl).then(() => {
|
||||
notificationModal.openModal('Thành công', 'Đã sao chép liên kết chia sẻ chuyến đi!', 'success');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Thiết lập kết nối WebSocket Real-time
|
||||
useEffect(() => {
|
||||
if (!currentTour) return;
|
||||
@@ -457,7 +474,13 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
|
||||
<h1 className="text-lg font-bold text-gray-800 truncate px-4">
|
||||
{tourInfo.title}
|
||||
</h1>
|
||||
<div className="w-10" /> {/* Spacer */}
|
||||
<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>
|
||||
|
||||
{/* Tour Header Info */}
|
||||
|
||||
Reference in New Issue
Block a user