Skip to content

Commit 2247a73

Browse files
committed
changes
1 parent f5c875a commit 2247a73

File tree

3 files changed

+119
-72
lines changed

3 files changed

+119
-72
lines changed

apps/dashboard/src/@/components/blocks/multi-step-status/multi-step-status.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function MultiStepStatus<T extends string>(props: {
3434
}) {
3535
return (
3636
<DynamicHeight>
37-
<div className="space-y-4">
37+
<div className="space-y-4 overflow-hidden">
3838
{props.steps.map((step) => (
3939
<div className="flex items-start space-x-3 " key={step.label}>
4040
{step.status.type === "completed" ? (
@@ -46,7 +46,7 @@ export function MultiStepStatus<T extends string>(props: {
4646
) : (
4747
<CircleIcon className="mt-0.5 size-5 flex-shrink-0 text-muted-foreground/70" />
4848
)}
49-
<div className="flex-1">
49+
<div className="grow">
5050
<p
5151
className={`font-medium ${
5252
step.status.type === "pending"
@@ -73,7 +73,7 @@ export function MultiStepStatus<T extends string>(props: {
7373
{step.status.type === "error"
7474
? props.renderError?.(step, step.status.message) || (
7575
<div className="mt-1 space-y-2">
76-
<p className="mb-1 text-red-500 text-sm">
76+
<p className="mb-1 text-red-500 text-sm whitespace-pre-wrap break-all">
7777
{step.status.message}
7878
</p>
7979
<Button

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/token/distribution/drop-erc20-token-sale.tsx

Lines changed: 108 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22

33
import type { ThirdwebClient } from "thirdweb";
4+
import { DistributionBarChart } from "@/components/blocks/distribution-chart";
45
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
56
import { TokenSelector } from "@/components/blocks/TokenSelector";
67
import { DynamicHeight } from "@/components/ui/DynamicHeight";
@@ -21,6 +22,11 @@ export function DropERC20_TokenSaleSection(props: {
2122
);
2223

2324
const isEnabled = props.form.watch("saleEnabled");
25+
26+
const protocolFee = 2;
27+
const convenienceFee = 0.5;
28+
const recipientFee = 100 - protocolFee - convenienceFee;
29+
2430
return (
2531
<DynamicHeight>
2632
<div className="relative border-t border-dashed p-6">
@@ -56,76 +62,113 @@ export function DropERC20_TokenSaleSection(props: {
5662
</div>
5763

5864
{isEnabled && (
59-
<div className="mt-4 flex flex-col lg:flex-row gap-5 lg:max-w-2xl fade-in-0 duration-300 animate-in">
60-
<FormFieldSetup
61-
errorMessage={
62-
props.form.formState.errors.dropERC20Mode
63-
?.saleAllocationPercentage?.message
64-
}
65-
helperText={`${sellSupply} tokens`}
66-
isRequired
67-
label="Sell % of Total Supply"
68-
>
69-
<div className="relative lg:w-64">
70-
<DecimalInput
71-
maxValue={100}
72-
onChange={(value) => {
73-
props.form.setValue(
65+
<div>
66+
<div className="mt-4 flex flex-col lg:flex-row gap-5 lg:max-w-2xl fade-in-0 duration-300 animate-in">
67+
<FormFieldSetup
68+
errorMessage={
69+
props.form.formState.errors.dropERC20Mode
70+
?.saleAllocationPercentage?.message
71+
}
72+
helperText={`${sellSupply} tokens`}
73+
isRequired
74+
label="Sell % of Total Supply"
75+
>
76+
<div className="relative lg:w-64">
77+
<DecimalInput
78+
maxValue={100}
79+
onChange={(value) => {
80+
props.form.setValue(
81+
"dropERC20Mode.saleAllocationPercentage",
82+
value,
83+
);
84+
}}
85+
value={props.form.watch(
7486
"dropERC20Mode.saleAllocationPercentage",
75-
value,
76-
);
77-
}}
78-
value={props.form.watch(
79-
"dropERC20Mode.saleAllocationPercentage",
80-
)}
81-
/>
82-
<span className="-translate-y-1/2 absolute top-1/2 right-3 text-muted-foreground text-sm">
83-
%
84-
</span>
85-
</div>
86-
</FormFieldSetup>
87+
)}
88+
/>
89+
<span className="-translate-y-1/2 absolute top-1/2 right-3 text-muted-foreground text-sm">
90+
%
91+
</span>
92+
</div>
93+
</FormFieldSetup>
8794

88-
<FormFieldSetup
89-
className="grow"
90-
errorMessage={
91-
props.form.formState.errors.dropERC20Mode?.pricePerToken
92-
?.message ||
93-
props.form.formState.errors.dropERC20Mode?.saleTokenAddress
94-
?.message
95-
}
96-
isRequired
97-
label="Price per Token"
98-
>
99-
<div className="relative flex items-center">
100-
<DecimalInput
101-
onChange={(value) => {
102-
props.form.setValue("dropERC20Mode.pricePerToken", value);
103-
}}
104-
value={props.form.watch("dropERC20Mode.pricePerToken")}
105-
className="rounded-r-none w-42"
106-
/>
95+
<FormFieldSetup
96+
className="grow"
97+
errorMessage={
98+
props.form.formState.errors.dropERC20Mode?.pricePerToken
99+
?.message ||
100+
props.form.formState.errors.dropERC20Mode?.saleTokenAddress
101+
?.message
102+
}
103+
isRequired
104+
label="Price per Token"
105+
>
106+
<div className="relative flex items-center">
107+
<DecimalInput
108+
onChange={(value) => {
109+
props.form.setValue("dropERC20Mode.pricePerToken", value);
110+
}}
111+
value={props.form.watch("dropERC20Mode.pricePerToken")}
112+
className="rounded-r-none w-42"
113+
/>
114+
115+
<TokenSelector
116+
addNativeTokenIfMissing={true}
117+
chainId={Number(props.chainId)}
118+
className="bg-background border-l-0 rounded-l-none"
119+
client={props.client}
120+
disableAddress={true}
121+
popoverContentClassName="!w-[320px]"
122+
onChange={(value) => {
123+
props.form.setValue(
124+
"dropERC20Mode.saleTokenAddress",
125+
value.address,
126+
);
127+
}}
128+
selectedToken={{
129+
address: props.form.watch(
130+
"dropERC20Mode.saleTokenAddress",
131+
),
132+
chainId: Number(props.chainId),
133+
}}
134+
showCheck={true}
135+
/>
136+
</div>
137+
</FormFieldSetup>
138+
</div>
139+
140+
<div className="mt-5 relative border-t border-dashed pt-5">
141+
<p className="text-muted-foreground text-sm mb-3">
142+
All primary sales are subjected to{" "}
143+
<em className="text-foreground font-medium not-italic">2.5%</em>{" "}
144+
fee
145+
</p>
107146

108-
<TokenSelector
109-
addNativeTokenIfMissing={true}
110-
chainId={Number(props.chainId)}
111-
className="bg-background border-l-0 rounded-l-none"
112-
client={props.client}
113-
disableAddress={true}
114-
popoverContentClassName="!w-[320px]"
115-
onChange={(value) => {
116-
props.form.setValue(
117-
"dropERC20Mode.saleTokenAddress",
118-
value.address,
119-
);
120-
}}
121-
selectedToken={{
122-
address: props.form.watch("dropERC20Mode.saleTokenAddress"),
123-
chainId: Number(props.chainId),
124-
}}
125-
showCheck={true}
147+
<div className="relative">
148+
<DistributionBarChart
149+
segments={[
150+
{
151+
label: "Your Wallet",
152+
percent: recipientFee,
153+
color: "hsl(var(--chart-1))",
154+
value: `${recipientFee}%`,
155+
},
156+
{
157+
label: "Protocol",
158+
percent: protocolFee,
159+
color: "hsl(var(--chart-2))",
160+
value: `${protocolFee}%`,
161+
},
162+
{
163+
label: "Convenience Fee",
164+
percent: convenienceFee,
165+
color: "hsl(var(--chart-3))",
166+
value: `${convenienceFee}%`,
167+
},
168+
]}
126169
/>
127170
</div>
128-
</FormFieldSetup>
171+
</div>
129172
</div>
130173
)}
131174
</div>

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/token/launch/launch-token.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,16 @@ export function LaunchTokenStatus(props: {
131131
label: "Set claim conditions",
132132
status: { type: "idle" },
133133
},
134-
{
134+
];
135+
136+
// if user is selling 100% of the tokens, owner share is 0% - so skip minting
137+
if (Number(formValues.dropERC20Mode.saleAllocationPercentage) !== 100) {
138+
initialSteps.push({
135139
id: stepIds["drop-erc20:mint-tokens"],
136140
label: "Mint tokens",
137141
status: { type: "idle" },
138-
},
139-
];
142+
});
143+
}
140144

141145
if (formValues.airdropEnabled && formValues.airdropAddresses.length > 0) {
142146
initialSteps.push({
@@ -364,7 +368,7 @@ export function LaunchTokenStatus(props: {
364368
className="gap-0 overflow-hidden p-0 md:max-w-[480px]"
365369
dialogCloseClassName="hidden"
366370
>
367-
<div className="flex flex-col gap-6 p-6">
371+
<div className="flex flex-col gap-6 p-6 overflow-hidden">
368372
<DialogHeader className="space-y-0.5">
369373
<DialogTitle className="font-semibold text-xl tracking-tight">
370374
Status

0 commit comments

Comments
 (0)