"use client"; import { useQuery } from "@tanstack/react-query"; import { ExternalLink, Share2 } from "lucide-react"; import { http, toUserError } from "@/lib/api"; import { Panel } from "@/components/panel"; import { Button } from "@/components/ui/button"; export type SocialLink = { name: string; url: string }; export type CommunityPayload = { socials: SocialLink[]; }; export function CommunityPanel() { const { data, isLoading, isError, error, refetch } = useQuery({ queryKey: ["community"], queryFn: () => http.get("/api/community"), }); if (isLoading) { return
; } if (isError) { return (

{toUserError(error)}

); } const socials = data?.socials ?? []; return (
} tint="bg-primary/15 text-primary" > {socials.length === 0 ? (

هنوز شبکه‌ای ثبت نشده است.

) : ( )}
); }