/* eslint-disable canonical/id-match */ 'use client'; import { useCustomerQuery } from '@/hooks/api/customers'; import { useSubscriptionQuery } from '@/hooks/api/subscriptions'; import { Enum_Customer_Role } from '@repo/graphql/types'; import { cn } from '@repo/ui/lib/utils'; import { ChevronRight } from 'lucide-react'; import Link from 'next/link'; export function SubscriptionInfoBar() { const { data, error, isLoading } = useSubscriptionQuery(); const { data: { customer } = {} } = useCustomerQuery(); const isActive = data?.hasActiveSubscription; const remainingOrdersCount = data?.remainingOrdersCount; const remainingDays = data?.remainingDays; const maxOrdersPerMonth = data?.maxOrdersPerMonth; if (customer?.role === Enum_Customer_Role.Client) return null; if (error) return null; const title = isActive ? 'Pro доступ активен' : 'Pro доступ неактивен'; let description = 'Попробуйте бесплатно'; if (!isLoading && remainingOrdersCount && maxOrdersPerMonth) { description = `Доступно ${remainingOrdersCount} из ${maxOrdersPerMonth} записей в этом месяце`; } if (isActive) { description = `Осталось ${remainingDays} дней`; } return (