dev #1

Merged
Michilis merged 2 commits from dev into main 2026-02-12 02:18:08 +00:00
Showing only changes of commit 8315029091 - Show all commits

View File

@@ -1,6 +1,6 @@
'use client'; 'use client';
import { useState } from 'react'; import { useState, useEffect } from 'react';
import { useLanguage } from '@/context/LanguageContext'; import { useLanguage } from '@/context/LanguageContext';
import { import {
ShareIcon, ShareIcon,
@@ -18,6 +18,12 @@ interface ShareButtonsProps {
export default function ShareButtons({ title, url, description }: ShareButtonsProps) { export default function ShareButtons({ title, url, description }: ShareButtonsProps) {
const { locale } = useLanguage(); const { locale } = useLanguage();
const [copied, setCopied] = useState(false); const [copied, setCopied] = useState(false);
const [supportsNativeShare, setSupportsNativeShare] = useState(false);
// Check for native share support only after mount to avoid hydration mismatch
useEffect(() => {
setSupportsNativeShare(typeof navigator !== 'undefined' && typeof navigator.share === 'function');
}, []);
// Use provided URL or current page URL // Use provided URL or current page URL
const shareUrl = url || (typeof window !== 'undefined' ? window.location.href : ''); const shareUrl = url || (typeof window !== 'undefined' ? window.location.href : '');
@@ -133,7 +139,7 @@ export default function ShareButtons({ title, url, description }: ShareButtonsPr
</button> </button>
{/* Native Share (mobile) */} {/* Native Share (mobile) */}
{typeof navigator !== 'undefined' && typeof navigator.share === 'function' && ( {supportsNativeShare && (
<button <button
onClick={handleNativeShare} onClick={handleNativeShare}
className="w-10 h-10 flex items-center justify-center rounded-full bg-primary-yellow text-primary-dark hover:bg-primary-yellow/90 transition-colors" className="w-10 h-10 flex items-center justify-center rounded-full bg-primary-yellow text-primary-dark hover:bg-primary-yellow/90 transition-colors"