Skip to content

Commit

Permalink
feat: add tooltip texts, adjust default values, adjust form layout
Browse files Browse the repository at this point in the history
(cherry picked from commit 0f6fad20da774103a3c2cfb067f8a9b58d5e6ec6)
  • Loading branch information
tmrdlt authored and dincho committed Jan 24, 2025
1 parent 064e35e commit fa425f7
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 18 deletions.
16 changes: 11 additions & 5 deletions src/app/initiate/1/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const InitiatorForm: React.FC<{ initialData: Step1FormValues | null }> = ({ init
resolver: zodResolver(step1FormSchema),
defaultValues: {
networkId: initialData?.networkId || '',
childBlockTime: initialData?.childBlockTime || 3000n
childBlockTime: initialData?.childBlockTime || 6500n
},
mode: 'onBlur'
});
Expand All @@ -42,13 +42,16 @@ const InitiatorForm: React.FC<{ initialData: Step1FormValues | null }> = ({ init
<form
onSubmit={form.handleSubmit(onSubmit)}
className='flex flex-col justify-between gap-10 font-roboto md:gap-36'>
<div className='grid grid-cols-1 gap-x-12 gap-y-8 md:grid-cols-2 md:gap-y-6'>
<div className='grid grid-cols-1 gap-y-8 md:gap-y-6'>
<FormField
control={form.control}
name='networkId'
render={({ field }) => (
<FormItem>
<FormLabelWithTooltip label='Hyperchain ID' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Hyperchain ID'
tooltip='A unique identifier for your Hyperchain network.'
/>
<FormControl>
<Input placeholder='hc_test' {...field} />
</FormControl>
Expand All @@ -61,14 +64,17 @@ const InitiatorForm: React.FC<{ initialData: Step1FormValues | null }> = ({ init
name='childBlockTime'
render={({ field: { value, onChange } }) => (
<FormItem>
<FormLabelWithTooltip label='Hyperchain Block Time' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Hyperchain Block Time'
tooltip='The time (in milliseconds) between each key block creation.'
/>
<div className='flex flex-row gap-6'>
<FormControl>
<Input
value={Number(value)}
onChange={onChange}
className='w-20'
placeholder='0'
placeholder='6500'
/>
</FormControl>
<div className='flex w-full flex-col justify-center gap-1'>
Expand Down
24 changes: 18 additions & 6 deletions src/app/initiate/2/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const InitiatorForm: React.FC<{ initialData: Step2FormValues | null }> = ({ init
parent: initialData?.parent || 'AE',
parentNetworkId: initialData?.parentNetworkId || '',
parentNodeURL: initialData?.parentNodeURL || '',
parentEpochLength: initialData?.parentEpochLength || 10n
parentEpochLength: initialData?.parentEpochLength || 12n
},
mode: 'onBlur'
});
Expand All @@ -52,7 +52,10 @@ const InitiatorForm: React.FC<{ initialData: Step2FormValues | null }> = ({ init
name='parent'
render={({ field: { value, onChange } }) => (
<FormItem>
<FormLabelWithTooltip label='Pinning Chain' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Pinning Chain'
tooltip='The parent blockchain where the Hyperchain commits its states.'
/>
<FormControl>
<Select value={value} onValueChange={onChange} defaultValue={value}>
<SelectTrigger>
Expand All @@ -76,7 +79,10 @@ const InitiatorForm: React.FC<{ initialData: Step2FormValues | null }> = ({ init
name='parentNetworkId'
render={({ field }) => (
<FormItem>
<FormLabelWithTooltip label='Chain Network ID' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Chain Network ID'
tooltip='The unique identifier for the parent chain network the Hyperchain connects to.'
/>
<FormControl>
<Input placeholder='Ex: ae_mainnet | ae_uat' {...field} />
</FormControl>
Expand All @@ -89,7 +95,10 @@ const InitiatorForm: React.FC<{ initialData: Step2FormValues | null }> = ({ init
name='parentNodeURL'
render={({ field }) => (
<FormItem>
<FormLabelWithTooltip label='Parent Node URL' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Parent Node URL'
tooltip='The API endpoint of a node in the parent chain for syncing and block updates.'
/>
<FormControl>
<Input placeholder='https://testnet.aeternity.io' {...field} />
</FormControl>
Expand All @@ -102,14 +111,17 @@ const InitiatorForm: React.FC<{ initialData: Step2FormValues | null }> = ({ init
name='parentEpochLength'
render={({ field: { value, onChange } }) => (
<FormItem>
<FormLabelWithTooltip label='Parent epoch length' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Parent epoch length'
tooltip='The number of blocks that make up an epoch on the parent chain.'
/>
<div className='flex flex-row gap-6'>
<FormControl>
<Input
value={Number(value)}
onChange={onChange}
className='w-20'
placeholder='0'
placeholder='12'
/>
</FormControl>
<div className='flex w-full flex-col justify-center gap-1'>
Expand Down
12 changes: 9 additions & 3 deletions src/app/initiate/3/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ const InitiatorForm: React.FC<{ initialData: Step3FormValues | null }> = ({ init
<form
onSubmit={form.handleSubmit(onSubmit)}
className='flex flex-col justify-between gap-10 font-roboto md:gap-36'>
<div className='grid grid-cols-1 gap-x-12 gap-y-8 md:grid-cols-2 md:gap-y-6'>
<div className='grid grid-cols-1 gap-y-8 md:gap-y-6'>
<FormField
control={form.control}
name='fixedCoinbase'
render={({ field }) => (
<FormItem>
<FormLabelWithTooltip label='Block Reward' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Block Reward'
tooltip='The amount of native Hyperchain tokens rewarded to the validator for producing a new block.'
/>
<FormControl>
<Input {...field} placeholder='100.0' />
</FormControl>
Expand All @@ -62,7 +65,10 @@ const InitiatorForm: React.FC<{ initialData: Step3FormValues | null }> = ({ init
name='pinningReward'
render={({ field }) => (
<FormItem>
<FormLabelWithTooltip label='Pinning Reward' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Pinning Reward'
tooltip='The amount of native Hyperchain tokens rewarded to validators for successfully committing the Hyperchain state to the pinning chain.'
/>
<FormControl>
<Input {...field} placeholder='100.0' />
</FormControl>
Expand Down
17 changes: 13 additions & 4 deletions src/app/initiate/4/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ const InitiatorForm: React.FC<{ initialData: Step4FormValues | null }> = ({ init
<form
onSubmit={form.handleSubmit(onSubmit)}
className='flex flex-col justify-between gap-10 font-roboto md:gap-36'>
<div className='grid grid-cols-1 gap-x-12 gap-y-8 md:grid-cols-2 md:gap-y-6'>
<div className='grid grid-cols-1 gap-y-8 md:gap-y-6'>
<FormField
control={form.control}
name='validatorCount'
render={({ field }) => (
<FormItem>
<FormLabelWithTooltip label='Number Of Validators' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Number Of Validators'
tooltip='The initial number of validators to participate in the Hyperchain network.'
/>
<FormControl>
<Input {...field} placeholder='3' />
</FormControl>
Expand All @@ -62,7 +65,10 @@ const InitiatorForm: React.FC<{ initialData: Step4FormValues | null }> = ({ init
name='validatorBalance'
render={({ field }) => (
<FormItem>
<FormLabelWithTooltip label='Validator Balance' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Validator Balance'
tooltip='The initial balance allocated to validators at the genesis of the Hyperchain.'
/>
<FormControl>
<Input {...field} placeholder='100.0' />
</FormControl>
Expand All @@ -75,7 +81,10 @@ const InitiatorForm: React.FC<{ initialData: Step4FormValues | null }> = ({ init
name='validatorMinStake'
render={({ field }) => (
<FormItem>
<FormLabelWithTooltip label='Minimum Staking Amount' tooltip='Tooltip Text' />
<FormLabelWithTooltip
label='Minimum Staking Amount'
tooltip='The minimum number of native Hyperchain tokens required to stake and become a validator.'
/>
<FormControl>
<Input {...field} placeholder='100.0' />
</FormControl>
Expand Down

0 comments on commit fa425f7

Please sign in to comment.