'use client'; import { useServicesQuery } from '@/hooks/api/services'; import { useOrderStore } from '@/stores/order'; import { type ServiceFieldsFragment } from '@repo/graphql/types'; import { cn } from '@repo/ui/lib/utils'; export function ServiceSelect() { const masterId = useOrderStore((store) => store.masterId); const { data: { services } = {} } = useServicesQuery({ filters: { master: { documentId: { eq: masterId, }, }, }, }); if (!services?.length) return null; return (
{services.map((service) => service && )}
); } function ServiceCard({ documentId, name }: Readonly) { const serviceId = useOrderStore((store) => store.serviceId); const setServiceId = useOrderStore((store) => store.setServiceId); const selected = serviceId === documentId; function handleOnSelect() { setServiceId(documentId); } return ( ); }