Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Button } from "@/components/ui/button";

export function StepCard(props: {
title: string;
errorMessage?: string;
prevButton:
| undefined
| {
Expand Down Expand Up @@ -35,40 +36,50 @@ export function StepCard(props: {
{props.children}

{(props.prevButton || props.nextButton) && (
<div className="flex justify-end gap-3 border-t p-4 md:p-6">
{props.prevButton && (
<Button
className="gap-2"
onClick={() => {
props.prevButton?.onClick();
}}
variant="outline"
>
<ArrowLeftIcon className="size-4" />
Back
</Button>
<div className="flex justify-between items-center gap-3 border-t p-4 md:px-6 md:py-5">
{props.errorMessage ? (
<div className="text-destructive-text text-sm">
{props.errorMessage}
</div>
) : (
<div />
)}

{nextButton && nextButton.type !== "custom" && (
<Button
className="gap-2"
disabled={nextButton.disabled}
onClick={() => {
if (nextButton.type === "click") {
nextButton.onClick();
}
}}
type="submit"
variant="default"
>
Next
<ArrowRightIcon className="size-4" />
</Button>
)}
<div className="flex gap-3">
{props.prevButton && (
<Button
className="gap-2"
onClick={() => {
props.prevButton?.onClick();
}}
variant="outline"
>
<ArrowLeftIcon className="size-4" />
Back
</Button>
)}

{nextButton && nextButton.type !== "custom" && (
<Button
className="gap-2"
disabled={nextButton.disabled}
onClick={() => {
if (nextButton.type === "click") {
nextButton.onClick();
}
}}
type="submit"
variant="default"
>
Next
<ArrowRightIcon className="size-4" />
</Button>
)}

{props.nextButton &&
props.nextButton.type === "custom" &&
props.nextButton.custom}
{props.nextButton &&
props.nextButton.type === "custom" &&
props.nextButton.custom}
</div>
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ export function LaunchNFT(props: {
}

const isComplete = steps.every((step) => step.status.type === "completed");
const isPending = steps.some((step) => step.status.type === "pending");

const isPriceSame = props.values.nfts.every(
(nft) => nft.price_amount === props.values.nfts[0]?.price_amount,
Expand Down Expand Up @@ -392,30 +391,25 @@ export function LaunchNFT(props: {
/>
</div>

<div className="mt-2 flex justify-between gap-4 border-border border-t bg-card p-6">
{isComplete && contractLink ? (
<div>
<Button asChild className="gap-2">
<Link href={contractLink}>
View NFT <ArrowRightIcon className="size-4" />
</Link>
</Button>
</div>
) : (
<div />
)}

<Button
disabled={isPending}
onClick={() => {
setIsModalOpen(false);
// reset steps
setSteps([]);
}}
variant="outline"
>
{isComplete ? "Close" : "Cancel"}
</Button>
<div className="mt-2 flex justify-end gap-4 border-border border-t bg-card p-6">
{!isComplete ? (
<Button
onClick={() => {
setIsModalOpen(false);
// reset steps
setSteps([]);
}}
variant="outline"
>
Cancel
</Button>
) : contractLink ? (
<Button asChild className="gap-2">
<Link href={contractLink}>
View NFT Collection <ArrowRightIcon className="size-4" />
</Link>
</Button>
) : null}
</div>
</DialogContent>
</Dialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function TokenDistributionFieldset(props: {
onClick: props.onPrevious,
}}
title="Coin Distribution"
errorMessage={distributionError}
>
<div>
<div className="p-4 md:px-6 md:py-6">
Expand All @@ -60,13 +61,19 @@ export function TokenDistributionFieldset(props: {
isRequired
label="Total Supply"
>
<div className="relative max-w-96">
<div className="relative lg:max-w-xs">
<Input id={supplyId} {...form.register("supply")} />
<span className="-translate-y-1/2 absolute top-1/2 right-3 text-muted-foreground text-sm">
{props.tokenSymbol || "Tokens"}
</span>
</div>
</FormFieldSetup>

<div className="h-6" />

<TokenDistributionBarChart
distributionFormValues={form.watch()}
/>
</div>

{form.watch("saleMode") === "drop-erc20:token-drop" ? (
Expand All @@ -85,18 +92,6 @@ export function TokenDistributionFieldset(props: {
)}

<TokenAirdropSection client={props.client} form={form} />

<div className="flex flex-col gap-3 p-4 py-8 md:px-6 border-t border-dashed">
<TokenDistributionBarChart
distributionFormValues={form.watch()}
/>

{distributionError && (
<div className="text-destructive-text text-sm">
{distributionError}
</div>
)}
</div>
</div>
</StepCard>
</form>
Expand Down Expand Up @@ -125,7 +120,7 @@ function getDistributionError(form: TokenDistributionForm) {
const totalSumOfSupply = totalAirdrop + saleSupply + ownerSupply;

if (totalSumOfSupply > supply) {
return "Token distribution exceeds total supply";
return "Token allocation exceeds total supply";
}

return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export function LaunchTokenStatus(props: {
}

const isComplete = steps.every((step) => step.status.type === "completed");
const isPending = steps.some((step) => step.status.type === "pending");

async function executeStep(stepId: StepId, gasless: boolean) {
const params = {
Expand Down Expand Up @@ -435,30 +434,25 @@ export function LaunchTokenStatus(props: {
/>
</div>

<div className="mt-2 flex justify-between gap-4 border-border border-t bg-card p-6">
{isComplete && contractLink ? (
<div>
<Button asChild className="gap-2">
<Link href={contractLink}>
View Coin <ArrowRightIcon className="size-4" />
</Link>
</Button>
</div>
) : (
<div />
)}

<Button
disabled={isPending}
onClick={() => {
setIsModalOpen(false);
// reset steps
setSteps([]);
}}
variant="outline"
>
{isComplete ? "Close" : "Cancel"}
</Button>
<div className="mt-2 flex justify-end gap-4 border-border border-t bg-card p-6">
{!isComplete ? (
<Button
onClick={() => {
setIsModalOpen(false);
// reset steps
setSteps([]);
}}
variant="outline"
>
Cancel
</Button>
) : contractLink ? (
<Button asChild className="gap-2">
<Link href={contractLink}>
View Coin <ArrowRightIcon className="size-4" />
</Link>
</Button>
) : null}
</div>
</DialogContent>
</Dialog>
Expand Down
Loading