Implement share button with Web Share API + clipboard fallback
All checks were successful
Build frontend / build (push) Successful in 41s

- Uses navigator.share() on mobile (native share sheet)
- Falls back to clipboard copy on desktop with toast confirmation
This commit is contained in:
Claw AI
2026-03-30 00:17:39 +00:00
parent 0c3b454015
commit ff589e4b0a

View File

@ -342,7 +342,21 @@ export default function PropertyDetailsPage() {
<button className="p-2 hover:bg-gray-100 rounded-full transition-colors"> <button className="p-2 hover:bg-gray-100 rounded-full transition-colors">
<Heart className="w-5 h-5 text-gray-600" /> <Heart className="w-5 h-5 text-gray-600" />
</button> </button>
<button className="p-2 hover:bg-gray-100 rounded-full transition-colors"> <button
onClick={async () => {
const url = window.location.href;
const title = property?.title || 'عقار';
if (navigator.share) {
try {
await navigator.share({ title, text: `تحقق من هذا العقار: ${title}`, url });
} catch {}
} else {
await navigator.clipboard.writeText(url);
toast.success('تم نسخ الرابط');
}
}}
className="p-2 hover:bg-gray-100 rounded-full transition-colors"
>
<Share2 className="w-5 h-5 text-gray-600" /> <Share2 className="w-5 h-5 text-gray-600" />
</button> </button>
</div> </div>