Skip to content

Commit

Permalink
fix: add field bug
Browse files Browse the repository at this point in the history
  • Loading branch information
avp1598 committed Apr 8, 2023
1 parent b39ade3 commit ef54947
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
13 changes: 11 additions & 2 deletions app/modules/Collection/AddField/MilestoneOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ const Input = styled.input`
type Props = {
networks?: Registry;
setNetworks: React.Dispatch<React.SetStateAction<Registry | undefined>>;
setIsDirty?: React.Dispatch<React.SetStateAction<boolean>>;
};

export default function MilestoneOptions({ networks, setNetworks }: Props) {
export default function MilestoneOptions({
networks,
setNetworks,
setIsDirty,
}: Props) {
const [title, setTitle] = useState(true);
const [description, setDescription] = useState(true);
const [dueDate, setDueDate] = useState(true);
Expand Down Expand Up @@ -80,7 +85,11 @@ export default function MilestoneOptions({ networks, setNetworks }: Props) {
/>
</Box>
</Stack>
<RewardTokenOptions networks={networks} setNetworks={setNetworks} />
<RewardTokenOptions
networks={networks}
setNetworks={setNetworks}
setIsDirty={setIsDirty}
/>
</Box>
);
}
4 changes: 4 additions & 0 deletions app/modules/Collection/AddField/RewardTokenOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Props = {
customTooltip?: string;
newTokenOpen?: boolean;
singleSelect?: boolean;
setIsDirty?: React.Dispatch<React.SetStateAction<boolean>>;
};

export default function RewardTokenOptions({
Expand All @@ -33,6 +34,7 @@ export default function RewardTokenOptions({
customTooltip,
newTokenOpen,
singleSelect,
setIsDirty,
}: Props) {
const { registry, circle, setRegistryData } = useCircle();
const [newToken, setNewToken] = useState(newTokenOpen || false);
Expand Down Expand Up @@ -135,6 +137,7 @@ export default function RewardTokenOptions({
shape="circle"
cursor="pointer"
onClick={() => {
setIsDirty && setIsDirty(true);
const newNetworks = networks;
delete newNetworks[chainId].tokenDetails[
tokenAddress
Expand Down Expand Up @@ -334,6 +337,7 @@ export default function RewardTokenOptions({
variant="tertiary"
size="small"
onClick={() => {
setIsDirty && setIsDirty(true);
setNewToken(true);
}}
disabled={tokenLoading}
Expand Down
7 changes: 6 additions & 1 deletion app/modules/Collection/AddField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,15 @@ export default function AddField({ propertyName, pageId, handleClose }: Props) {
<RewardTokenOptions
networks={networks}
setNetworks={setNetworks}
setIsDirty={setIsDirty}
/>
)}
{type.value === "milestone" && (
<MilestoneOptions networks={networks} setNetworks={setNetworks} />
<MilestoneOptions
networks={networks}
setNetworks={setNetworks}
setIsDirty={setIsDirty}
/>
)}
{type.value === "payWall" && (
<PayWall
Expand Down

0 comments on commit ef54947

Please sign in to comment.