import { useQuery } from '@tanstack/react-query'; import { Link } from '@tanstack/react-router'; import { fetchPinnedLiveBlogs } from '@/lib/api'; import { Button } from '@/components/ui/button'; import { Calendar, Eye, MessageSquare, Pin } from 'lucide-react'; export function PinnedLiveBlogsSidebar() { const { data: liveBlogs, isLoading, error } = useQuery({ queryKey: ['pinned-live-blogs'], queryFn: fetchPinnedLiveBlogs, }); const getStatusBadge = (status: string) => { switch (status) { case 'live': return ( LIVE ); case 'ended': return ( ENDED ); case 'archived': return ( ARCHIVED ); default: return ( DRAFT ); } }; const formatDate = (dateString: string) => { const date = new Date(dateString); return date.toLocaleDateString('mk-MK', { day: 'numeric', month: 'short', }); }; if (isLoading) { return (
Pin live blogs from the admin panel.
{liveBlog.description}
)}