Skip to content

Commit 2b38276

Browse files
committed
cleanup
1 parent f8057a3 commit 2b38276

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import type { ThirdwebContract } from "thirdweb";
2727
import { getNFT as getErc721NFT } from "thirdweb/extensions/erc721";
2828
import { getNFT as getErc1155NFT } from "thirdweb/extensions/erc1155";
2929
import { useReadContract } from "thirdweb/react";
30-
import {} from "tw-components";
3130
import { Button, Card, Heading, Text } from "tw-components";
3231
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
3332
import { shortenString } from "utils/usedapp-external";

apps/dashboard/src/app/team/[team_slug]/[project_slug]/insight/components/BlueprintsExplorer.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"use client";
22

3-
import {} from "@/components/ui/dropdown-menu";
4-
import {} from "@/components/ui/select";
53
import { Layers3 } from "lucide-react";
64
import Link from "next/link";
75

apps/dashboard/src/components/contract-components/contract-publish-form/contract-params-fieldset.tsx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
22
import { Checkbox, CheckboxWithLabel } from "@/components/ui/checkbox";
3+
import { InlineCode } from "@/components/ui/inline-code";
34
import { Input } from "@/components/ui/input";
45
import { Separator } from "@/components/ui/separator";
56
import { Switch } from "@/components/ui/switch";
@@ -11,8 +12,6 @@ import { camelToTitle } from "contract-ui/components/solidity-inputs/helpers";
1112
import { getTemplateValuesForType } from "lib/deployment/template-values";
1213
import { useState } from "react";
1314
import { useFormContext } from "react-hook-form";
14-
import {} from "tw-components";
15-
import { InlineCode } from "../../../@/components/ui/inline-code";
1615
import { DecodedInputArrayFieldset } from "./decoded-bytes-input/decoded-input-array-fieldset";
1716
import { RefInputFieldset } from "./ref-contract-input/ref-input-fieldset";
1817

@@ -25,15 +24,19 @@ export const ContractParamsFieldset: React.FC<ContractParamsFieldsetProps> = ({
2524
const form = useFormContext();
2625
const isMobile = useBreakpointValue({ base: true, md: false });
2726

28-
const [isCustomInputEnabled, setIsCustomInputEnabled] = useState(
27+
const [isCustomInputEnabledArray, setIsCustomInputEnabledArray] = useState(
2928
Array(deployParams.length).fill(false),
3029
);
3130

32-
const handleToggleCustomInput = (index: number) => {
33-
const updated = [...isCustomInputEnabled];
34-
updated[index] = !updated[index];
35-
// Clear values accordingly when toggling between input types
36-
if (updated[index]) {
31+
const handleCustomInputEnabledArrayChange = (
32+
index: number,
33+
newValue: boolean,
34+
) => {
35+
const newIsCustomInputEnabledArray = [...isCustomInputEnabledArray];
36+
newIsCustomInputEnabledArray[index] = newValue;
37+
setIsCustomInputEnabledArray(newIsCustomInputEnabledArray);
38+
39+
if (newValue) {
3740
form.setValue(
3841
`constructorParams.${deployParams[index]?.name || "*"}.defaultValue`,
3942
"",
@@ -59,8 +62,6 @@ export const ContractParamsFieldset: React.FC<ContractParamsFieldsetProps> = ({
5962
},
6063
);
6164
}
62-
63-
setIsCustomInputEnabled(updated);
6465
};
6566

6667
return (
@@ -201,15 +202,17 @@ export const ContractParamsFieldset: React.FC<ContractParamsFieldsetProps> = ({
201202
<div className="flex items-center gap-3 text-sm">
202203
Advanced Input
203204
<Switch
204-
checked={isCustomInputEnabled[idx]}
205-
onCheckedChange={() => handleToggleCustomInput(idx)}
205+
checked={isCustomInputEnabledArray[idx]}
206+
onCheckedChange={(v) =>
207+
handleCustomInputEnabledArrayChange(idx, v)
208+
}
206209
/>
207210
</div>
208211
)}
209212
</div>
210213

211214
{/* Inputs */}
212-
{!isCustomInputEnabled[idx] ? (
215+
{!isCustomInputEnabledArray[idx] ? (
213216
<FormControl>
214217
<SolidityInput
215218
className="!bg-background !text-sm placeholder:!text-sm"
@@ -236,7 +239,7 @@ export const ContractParamsFieldset: React.FC<ContractParamsFieldsetProps> = ({
236239

237240
{/* Checkboxes */}
238241
{paramTemplateValues.length > 0 &&
239-
!isCustomInputEnabled[idx] &&
242+
!isCustomInputEnabledArray[idx] &&
240243
paramTemplateValues[0]?.helperText && (
241244
<CheckboxWithLabel className="text-foreground">
242245
<Checkbox

apps/dashboard/src/components/contract-components/contract-publish-form/decoded-bytes-input/decoded-input.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ export const DecodedInput: React.FC<DecodedInputProps> = ({
3434

3535
// Toggle function to handle custom input visibility and reset fields
3636
const handleToggleCustomInput = (newVal: boolean) => {
37-
const path = `constructorParams.${param.name ? param.name : "*"}.dynamicValue.decodedBytes.${setIndex}.${paramIndex}`;
37+
setIsCustomAddress(newVal);
38+
const path =
39+
`constructorParams.${param.name ? param.name : "*"}.dynamicValue.decodedBytes.${setIndex}.${paramIndex}` as const;
40+
3841
if (newVal) {
3942
form.setValue(`${path}.dynamicValue.type`, selectedType);
4043
form.resetField(`${path}.defaultValue`);
4144
} else {
4245
form.setValue(`${path}.dynamicValue.type`, "");
4346
form.resetField(`${path}.dynamicValue`);
4447
}
45-
46-
setIsCustomAddress(newVal);
4748
};
4849

4950
const showAdvancedInputToggle =

0 commit comments

Comments
 (0)