Skip to content

Commit

Permalink
chore: replace missing cardPropsHook
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-stumpf committed Jul 29, 2024
1 parent 8221267 commit a9c445d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DISPLAY_CARD_INTERACTIVITY_STYLES } from "components/common/DisplayCard
import { useState } from "react"
import { useFormContext, useWatch } from "react-hook-form"
import rewards, { PlatformAsRewardRestrictions } from "rewards"
import { cardPropsHooks } from "rewards/cardPropsHooks"
import rewardComponents from "rewards/components"
import { PlatformType, Requirement, RoleFormType, RolePlatform } from "types"
import EditRolePlatformModal from "../../EditRolePlatformModal"
Expand Down Expand Up @@ -90,11 +91,8 @@ const SelectExistingPlatform = ({ onClose, onSelect }: Props) => {

<SimpleGrid columns={{ base: 1, sm: 2, md: 3 }} gap={4}>
{filteredPlatforms?.map((platform) => {
const platformComponents =
rewardComponents[PlatformType[platform.platformId]]
if (!platformComponents) return null

const { cardPropsHook } = platformComponents
const cardPropsHook = cardPropsHooks[PlatformType[platform.platformId]]
if (!cardPropsHook) return null

const isGoogleReward = platform.platformId === PlatformType.GOOGLE
const isForm =
Expand Down
6 changes: 2 additions & 4 deletions src/rewards/Token/EditDynamicRewardModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import OptionImage from "components/common/StyledSelect/components/CustomSelectO
import useToast from "hooks/useToast"
import dynamic from "next/dynamic"
import { FormProvider, useForm } from "react-hook-form"
import rewardComponents from "rewards/components"
import { cardPropsHooks } from "rewards/cardPropsHooks"
import { PlatformType, Requirement, RolePlatform } from "types"

const DynamicSetup = dynamic(
Expand Down Expand Up @@ -57,10 +57,8 @@ const EditDynamicRewardModal = ({
})

const rewardName = rolePlatform.guildPlatform.platformGuildData.name

const propsHook =
rewardComponents[PlatformType[rolePlatform.guildPlatform.platformId]]
?.cardPropsHook
cardPropsHooks[PlatformType[rolePlatform.guildPlatform.platformId]]

const { image = null } = propsHook ? propsHook(rolePlatform.guildPlatform) : {}
const ImageComponent =
Expand Down

0 comments on commit a9c445d

Please sign in to comment.