mirror of
https://github.com/documenso/documenso.git
synced 2026-07-20 15:06:14 +10:00
refactor: useContext & remove enum
This commit is contained in:
@@ -26,7 +26,7 @@ import {
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@documenso/ui/primitives/popover';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@documenso/ui/primitives/tooltip';
|
||||
|
||||
import type { WithStep } from '../stepper';
|
||||
import { useStep } from '../stepper';
|
||||
import type { TAddFieldsFormSchema } from './add-fields.types';
|
||||
import {
|
||||
DocumentFlowFormContainerActions,
|
||||
@@ -65,10 +65,9 @@ export const AddFieldsFormPartial = ({
|
||||
recipients,
|
||||
fields,
|
||||
onSubmit,
|
||||
useStep, // Stepper
|
||||
}: WithStep<AddFieldsFormProps>) => {
|
||||
}: AddFieldsFormProps) => {
|
||||
const { isWithinPageBounds, getFieldPosition, getPage } = useDocumentElement();
|
||||
const { currentStep, totalSteps, nextStep, previousStep } = useStep();
|
||||
const { currentStep, totalSteps, previousStep } = useStep();
|
||||
|
||||
const {
|
||||
control,
|
||||
|
||||
@@ -18,7 +18,7 @@ import { Input } from '@documenso/ui/primitives/input';
|
||||
import { Label } from '@documenso/ui/primitives/label';
|
||||
import { useToast } from '@documenso/ui/primitives/use-toast';
|
||||
|
||||
import type { WithStep } from '../stepper';
|
||||
import { useStep } from '../stepper';
|
||||
import type { TAddSignersFormSchema } from './add-signers.types';
|
||||
import { ZAddSignersFormSchema } from './add-signers.types';
|
||||
import {
|
||||
@@ -43,14 +43,13 @@ export const AddSignersFormPartial = ({
|
||||
document,
|
||||
fields: _fields,
|
||||
onSubmit,
|
||||
useStep, // Stepper
|
||||
}: WithStep<AddSignersFormProps>) => {
|
||||
}: AddSignersFormProps) => {
|
||||
const { toast } = useToast();
|
||||
const { remaining } = useLimits();
|
||||
|
||||
const initialId = useId();
|
||||
|
||||
const { currentStep, totalSteps, nextStep, previousStep } = useStep();
|
||||
const { currentStep, totalSteps, previousStep } = useStep();
|
||||
|
||||
const {
|
||||
control,
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Input } from '@documenso/ui/primitives/input';
|
||||
import { Label } from '@documenso/ui/primitives/label';
|
||||
import { Textarea } from '@documenso/ui/primitives/textarea';
|
||||
|
||||
import type { WithStep } from '../stepper';
|
||||
import { useStep } from '../stepper';
|
||||
import type { TAddSubjectFormSchema } from './add-subject.types';
|
||||
import {
|
||||
DocumentFlowFormContainerActions,
|
||||
@@ -34,8 +34,7 @@ export const AddSubjectFormPartial = ({
|
||||
fields: _fields,
|
||||
document,
|
||||
onSubmit,
|
||||
useStep,
|
||||
}: WithStep<AddSubjectFormProps>) => {
|
||||
}: AddSubjectFormProps) => {
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
@@ -50,7 +49,7 @@ export const AddSubjectFormPartial = ({
|
||||
});
|
||||
|
||||
const onFormSubmit = handleSubmit(onSubmit);
|
||||
const { currentStep, totalSteps, nextStep, previousStep } = useStep();
|
||||
const { currentStep, totalSteps, previousStep } = useStep();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -8,7 +8,7 @@ import { FormErrorMessage } from '@documenso/ui/primitives/form/form-error-messa
|
||||
import { Input } from '@documenso/ui/primitives/input';
|
||||
import { Label } from '@documenso/ui/primitives/label';
|
||||
|
||||
import type { WithStep } from '../stepper';
|
||||
import { useStep } from '../stepper';
|
||||
import type { TAddTitleFormSchema } from './add-title.types';
|
||||
import {
|
||||
DocumentFlowFormContainerActions,
|
||||
@@ -32,8 +32,7 @@ export const AddTitleFormPartial = ({
|
||||
fields: _fields,
|
||||
document,
|
||||
onSubmit,
|
||||
useStep,
|
||||
}: WithStep<AddTitleFormProps>) => {
|
||||
}: AddTitleFormProps) => {
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
|
||||
Reference in New Issue
Block a user