'use client'; import { useSubscriptionQuery } from '@/hooks/api/subscriptions'; import { getRemainingDays } from '@repo/utils/datetime-format'; import { ChevronRight } from 'lucide-react'; import Link from 'next/link'; export function SubscriptionInfoBar() { const { data, error, isLoading } = useSubscriptionQuery(); const isActive = data?.subscription?.isActive; const remainingOrdersCount = data?.remainingOrdersCount; const maxOrdersPerMonth = data?.maxOrdersPerMonth; const expiresAt = data?.subscription?.expiresAt; if (error) return null; const title = isActive ? 'Подписка Pro активна' : 'Подписка неактивна'; let description = 'Попробуйте бесплатно'; if (isActive && expiresAt) { description = `Осталось ${getRemainingDays(expiresAt)} дней`; } if (!isLoading && remainingOrdersCount && maxOrdersPerMonth) { description = `Осталось ${remainingOrdersCount} из ${maxOrdersPerMonth} записей в этом месяце`; } return (