"use client";

import React, { useState, useEffect } from 'react'
import { useRouter } from 'next/navigation';
import Link from 'next/link';
import {
    Dialog,
    DialogTrigger,
} from "@/components/ui/dialog"

export function PrivacyPolicyModal() {
    const [open, setOpen] = useState(false);
    const router = useRouter();

    useEffect(() => {
        if (window.location.hash === '#privacy') {
            router.push('/privacy');
        }
    }, [router]);

    return (
        <Dialog open={open} onOpenChange={setOpen}>
            <DialogTrigger asChild>
                <Link href="/privacy" className="text-sm underline underline-offset-4">Privacy Policy</Link>
            </DialogTrigger>
        </Dialog>
    )
}

