63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
import { Flex, Link } from "@chakra-ui/react";
|
|
import { AppLayout } from "components/app-layouts/app";
|
|
import { DeployableContractTable } from "components/contract-components/contract-table";
|
|
import { useTrack } from "hooks/analytics/useTrack";
|
|
import { useRouter } from "next/router";
|
|
import { ReactElement, useMemo } from "react";
|
|
import { Badge, Heading, Text } from "tw-components";
|
|
|
|
export default function ContractsDeployPage() {
|
|
const { Track } = useTrack({
|
|
page: "deploy",
|
|
});
|
|
|
|
const router = useRouter();
|
|
|
|
const ipfsHashes = useMemo(() => {
|
|
const uri = router.query.uri;
|
|
const ipfs = router.query.ipfs;
|
|
let array: string[] = [];
|
|
// handle both ipfs and uri
|
|
if (ipfs) {
|
|
array = Array.isArray(ipfs) ? ipfs : [ipfs];
|
|
} else if (uri) {
|
|
array = (Array.isArray(uri) ? uri : [uri]).map((hash) =>
|
|
hash.replace("ipfs://", ""),
|
|
);
|
|
}
|
|
return array;
|
|
}, [router.query]);
|
|
|
|
return (
|
|
<Track>
|
|
<Flex gap={8} direction="column">
|
|
<Flex gap={2} direction="column">
|
|
<Heading size="title.md">
|
|
Deploy Contract{" "}
|
|
<Badge variant="outline" colorScheme="purple">
|
|
beta
|
|
</Badge>
|
|
</Heading>
|
|
<Text fontStyle="italic" maxW="container.md">
|
|
Welcome to the new thirdweb contract deployment flow.
|
|
<br />
|
|
<Link
|
|
color="primary.500"
|
|
isExternal
|
|
href="https://portal.thirdweb.com/thirdweb-deploy"
|
|
>
|
|
Learn more about deploying your contracts.
|
|
</Link>
|
|
</Text>
|
|
</Flex>
|
|
|
|
<DeployableContractTable contractIds={ipfsHashes} />
|
|
</Flex>
|
|
</Track>
|
|
);
|
|
}
|
|
|
|
ContractsDeployPage.getLayout = function getLayout(page: ReactElement) {
|
|
return <AppLayout>{page}</AppLayout>;
|
|
};
|