Skip to content

Commit

Permalink
fix(dcd): remove SelectRolePanel
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-stumpf committed Jul 26, 2024
1 parent 2d35c26 commit 960fb06
Showing 1 changed file with 3 additions and 28 deletions.
31 changes: 3 additions & 28 deletions src/requirements/Form/components/AddFormButton.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Button, Modal, ModalOverlay } from "@chakra-ui/react"
import SelectRolePanel from "components/[guild]/AddRewardButton/SelectRolePanel"
import { Button } from "@chakra-ui/react"
import { ADD_REWARD_FORM_DEFAULT_VALUES } from "components/[guild]/AddRewardButton/constants"
import { AddRewardForm } from "components/[guild]/AddRewardButton/types"
import {
AddRewardProvider,
useAddRewardContext,
} from "components/[guild]/AddRewardContext"
import { FormProvider, useForm, useFormContext, useWatch } from "react-hook-form"
import { FormProvider, useForm, useWatch } from "react-hook-form"
import CreateFormModal from "./CreateFormModal"

const AddFormButton = ({ baseFieldPath, isDisabled }) => {
const AddFormButton = ({ isDisabled }) => {
const { setSelection, step, setStep, isOpen, onOpen, onClose } =
useAddRewardContext()

Expand All @@ -29,17 +28,6 @@ const AddFormButton = ({ baseFieldPath, isDisabled }) => {
setSelection("FORM")
}

const { setValue } = useFormContext()

const handleSuccess = (res: any) => {
const formId =
res?.platformGuildData?.formId ??
res?.createdGuildPlatforms?.[0]?.platformGuildData?.formId
setValue(`${baseFieldPath}.data.id`, formId, {
shouldDirty: true,
})
}

return (
<FormProvider {...methods}>
<Button
Expand Down Expand Up @@ -74,19 +62,6 @@ const AddFormButton = ({ baseFieldPath, isDisabled }) => {
}}
/>
)}

{step === "SELECT_ROLE" && (
<Modal
isOpen={isOpen}
onClose={onClose}
size={"2xl"}
scrollBehavior="inside"
colorScheme="dark"
>
<ModalOverlay />
<SelectRolePanel onSuccess={handleSuccess} />
</Modal>
)}
</FormProvider>
)
}
Expand Down

0 comments on commit 960fb06

Please sign in to comment.