diff --git a/app/property/[id]/PropertyDetail.js b/app/property/[id]/PropertyDetail.js index 5c65812..b927a1f 100644 --- a/app/property/[id]/PropertyDetail.js +++ b/app/property/[id]/PropertyDetail.js @@ -49,6 +49,30 @@ import { getRentProperty, getSaleProperty, bookReservation, checkAvailability, g import AuthService from '../../services/AuthService'; import { BuildingTypeKeys, PropertyStatusKeys, extractCity } from '../../enums'; +// Copy to clipboard that works on HTTP too +async function copyToClipboard(text) { + try { + await navigator.clipboard.writeText(text); + return true; + } catch { + // Fallback for HTTP / older browsers + const textarea = document.createElement('textarea'); + textarea.value = text; + textarea.style.position = 'fixed'; + textarea.style.opacity = '0'; + document.body.appendChild(textarea); + textarea.select(); + try { + document.execCommand('copy'); + return true; + } catch { + return false; + } finally { + document.body.removeChild(textarea); + } + } +} + // Map API response to the UI format function mapApiDetail(item) { if (!item) return null; @@ -478,9 +502,13 @@ export default function PropertyDetailsPage() { {/* Instagram (copy link) */}