import { Dialog, DialogContent } from "@/components/ui/dialog"; import { useTranslation } from "@/hooks/useTranslation"; import { ExternalLink } from "lucide-react"; import { useQuery } from "@tanstack/react-query"; import { supabase } from "@/integrations/supabase/client"; export const StatsDialog = ({ open, onOpenChange, }: { open: boolean; onOpenChange: (open: boolean) => void; }) => { const t = useTranslation(); const { data: todayResults } = useQuery({ queryKey: ["game-results-today"], queryFn: async () => { const today = new Date(); today.setHours(0, 0, 0, 0); const { count } = await supabase .from("game_results") .select("*", { count: "exact" }) .gte("created_at", today.toISOString()); return count || 0; }, }); const { data: totalResults } = useQuery({ queryKey: ["game-results-total"], queryFn: async () => { const { count } = await supabase .from("game_results") .select("*", { count: "exact" }); return count || 0; }, }); return (

{t.welcome.stats.title}

{t.welcome.stats.dailyGuesses}: {todayResults || 0}

{t.welcome.stats.totalGuesses}: {totalResults || 0}

{t.welcome.stats.visitDashboard}
); };