import { FC, useCallback, useEffect } from 'react'; import { clsx } from 'clsx'; import { useFormContext } from 'react-hook-form'; import { useT } from '@gitroom/react/translation/get.transation.service.client'; export const Total: FC<{ name: string; customOnChange?: () => void; }> = (props) => { const { name, customOnChange } = props; const form = useFormContext(); const value = form.watch(props.name); const changeNumber = useCallback( (value: number) => () => { if (value === 0) { return; } form.setValue(name, value); }, [value] ); useEffect(() => { if (customOnChange) { customOnChange(); } }, [value, customOnChange]); const t = useT(); return (