Skip to content

Commit 360e889

Browse files
committed
update creation pages
1 parent 5066dfb commit 360e889

File tree

2 files changed

+15
-77
lines changed
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/assets

2 files changed

+15
-77
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/assets/create-nft/page.tsx

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
44
import { Button } from "@/components/ui/button";
55
import { Input } from "@/components/ui/input";
6-
import {
7-
Select,
8-
SelectContent,
9-
SelectItem,
10-
SelectTrigger,
11-
SelectValue,
12-
} from "@/components/ui/select";
136
import { Separator } from "@/components/ui/separator";
147
import { Textarea } from "@/components/ui/textarea";
158
import { Switch } from "@/components/ui/switch";
@@ -31,8 +24,7 @@ import { FileInput } from "components/shared/FileInput";
3124
import { BasisPointsInput } from "components/inputs/BasisPointsInput";
3225
import { SolidityInput } from "contract-ui/components/solidity-inputs";
3326
import { Form } from "@/components/ui/form";
34-
import { useAllChainsData } from "hooks/chains/allChains";
35-
import type { StoredChain } from "stores/chainStores";
27+
import { NetworkSelectorButton } from "components/selects/NetworkSelectorButton";
3628

3729
// Form schemas
3830
const collectionInfoSchema = z.object({
@@ -106,9 +98,6 @@ export default function CreateNFTPage() {
10698
});
10799
const [showRoyaltySettings, setShowRoyaltySettings] = useState(false);
108100

109-
// Get chain data
110-
const { allChains } = useAllChainsData();
111-
112101
// Forms
113102
const collectionInfoForm = useForm<CollectionInfoValues>({
114103
resolver: zodResolver(collectionInfoSchema),
@@ -278,32 +267,12 @@ export default function CreateNFTPage() {
278267
collectionInfoForm.formState.errors.chain?.message
279268
}
280269
>
281-
<Select
282-
defaultValue={collectionInfoForm.watch("chain")}
283-
onValueChange={(value) =>
284-
collectionInfoForm.setValue("chain", value)
285-
}
286-
>
287-
<SelectTrigger id="chain">
288-
<SelectValue placeholder="Select chain" />
289-
</SelectTrigger>
290-
<SelectContent className="max-h-[300px]">
291-
{allChains.map((chain: StoredChain) => (
292-
<SelectItem key={chain.chainId} value={chain.name}>
293-
<div className="flex items-center gap-2">
294-
{chain.icon?.url && (
295-
<img
296-
src={chain.icon.url}
297-
alt={chain.name}
298-
className="w-4 h-4 rounded-full"
299-
/>
300-
)}
301-
{chain.name}
302-
</div>
303-
</SelectItem>
304-
))}
305-
</SelectContent>
306-
</Select>
270+
<NetworkSelectorButton
271+
className="bg-background"
272+
onSwitchChain={(chain) => {
273+
collectionInfoForm.setValue("chain", chain.name);
274+
}}
275+
/>
307276
</FormFieldSetup>
308277

309278
<FormFieldSetup

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/assets/import/page.tsx

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22

33
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
44
import { Button } from "@/components/ui/button";
5-
import {
6-
Select,
7-
SelectContent,
8-
SelectItem,
9-
SelectTrigger,
10-
SelectValue,
11-
} from "@/components/ui/select";
5+
import { Input } from "@/components/ui/input";
126
import { Separator } from "@/components/ui/separator";
137
import { cn } from "@/lib/utils";
148
import { zodResolver } from "@hookform/resolvers/zod";
@@ -19,8 +13,7 @@ import * as z from "zod";
1913
import { Fieldset } from "components/contract-components/contract-deploy-form/common";
2014
import { SolidityInput } from "contract-ui/components/solidity-inputs";
2115
import { Form } from "@/components/ui/form";
22-
import { useAllChainsData } from "hooks/chains/allChains";
23-
import type { StoredChain } from "stores/chainStores";
16+
import { NetworkSelectorButton } from "components/selects/NetworkSelectorButton";
2417

2518
// Form schema
2619
const contractDetailsSchema = z.object({
@@ -66,9 +59,6 @@ export default function ImportAssetPage() {
6659
const [contractDetails, setContractDetails] =
6760
useState<ContractDetailsValues>();
6861

69-
// Get chain data
70-
const { allChains } = useAllChainsData();
71-
7262
// Form
7363
const contractDetailsForm = useForm<ContractDetailsValues>({
7464
resolver: zodResolver(contractDetailsSchema),
@@ -154,34 +144,13 @@ export default function ImportAssetPage() {
154144
errorMessage={
155145
contractDetailsForm.formState.errors.network?.message
156146
}
157-
helperText="Select the blockchain where the contract is deployed"
158147
>
159-
<Select
160-
defaultValue={contractDetailsForm.watch("network")}
161-
onValueChange={(value) =>
162-
contractDetailsForm.setValue("network", value)
163-
}
164-
>
165-
<SelectTrigger id="network">
166-
<SelectValue placeholder="Select network" />
167-
</SelectTrigger>
168-
<SelectContent className="max-h-[300px]">
169-
{allChains.map((chain: StoredChain) => (
170-
<SelectItem key={chain.chainId} value={chain.name}>
171-
<div className="flex items-center gap-2">
172-
{chain.icon?.url && (
173-
<img
174-
src={chain.icon.url}
175-
alt={chain.name}
176-
className="w-4 h-4 rounded-full"
177-
/>
178-
)}
179-
{chain.name}
180-
</div>
181-
</SelectItem>
182-
))}
183-
</SelectContent>
184-
</Select>
148+
<NetworkSelectorButton
149+
className="bg-background"
150+
onSwitchChain={(chain) => {
151+
contractDetailsForm.setValue("network", chain.name);
152+
}}
153+
/>
185154
</FormFieldSetup>
186155
</div>
187156

0 commit comments

Comments
 (0)