Skip to content

Commit

Permalink
Merge pull request #474 from 1Hive/fix/membership-stake-amount-decimals
Browse files Browse the repository at this point in the history
fix membership stake amount decimals
  • Loading branch information
Corantin authored Oct 23, 2024
2 parents 54b3ca0 + a8cb885 commit bad46fc
Show file tree
Hide file tree
Showing 2 changed files with 11,432 additions and 8,994 deletions.
14 changes: 10 additions & 4 deletions apps/web/components/Forms/CommunityForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export const CommunityForm = ({
tokenGarden: Pick<TokenGarden, "address" | "symbol" | "decimals">;
registryFactoryAddr: Address;
}) => {
const INPUT_TOKEN_MIN_VALUE = 1 / 10 ** (tokenGarden?.decimals ?? 0);

const {
register,
handleSubmit,
Expand Down Expand Up @@ -226,7 +228,7 @@ export const CommunityForm = ({
}
return isSafe;
};

console.log(INPUT_TOKEN_MIN_VALUE);
return (
<form onSubmit={handleSubmit(handlePreview)} className="w-full">
{showPreview ?
Expand All @@ -252,16 +254,20 @@ export const CommunityForm = ({
label="Membership Stake Amount"
register={register}
required
className="pr-14"
className="pr-[90px]"
errors={errors}
registerKey="stakeAmount"
type="number"
registerOptions={{
min: {
value: 0,
message: "Amount must be greater than 0",
value: INPUT_TOKEN_MIN_VALUE,
message: `Amount must be greater than ${INPUT_TOKEN_MIN_VALUE}`,
},
}}
otherProps={{
step: INPUT_TOKEN_MIN_VALUE,
min: INPUT_TOKEN_MIN_VALUE,
}}
suffix={tokenGarden.symbol}
tooltip="Amount of tokens user must stake to join and participate in community governance. Refundable upon leaving the community."
/>
Expand Down
Loading

0 comments on commit bad46fc

Please sign in to comment.