Vlad Chikalkin 10981e2afb
Issues/66 (#67)
* feat(profile): add 'Услуги' link button to LinksCard for service management

* feat(services): add create and update service functionalities with corresponding API actions and hooks
2025-08-01 19:54:10 +03:00

28 lines
735 B
TypeScript

'use client';
import FloatingActionPanel from '@/components/shared/action-panel';
import { useServiceMutation, useServiceQuery } from '@/hooks/api/services';
type Props = {
serviceId: string;
};
export function ServiceButtons({ serviceId }: Readonly<Props>) {
const { data: { service } = {}, isPending: isPendingQuery } = useServiceQuery({
documentId: serviceId,
});
const { isPending: isPendingUpdate, mutate: updateService } = useServiceMutation({
documentId: serviceId,
});
const active = Boolean(service?.active);
return (
<FloatingActionPanel
isLoading={isPendingQuery || isPendingUpdate}
isOpen={active}
onToggle={() => updateService({ data: { active: !active } })}
/>
);
}