-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Wrap up Mana Calculator (#1345)
- Loading branch information
Showing
16 changed files
with
249 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import { EPOCH_DURATION } from '../constants'; | ||
|
||
export function calculateBPS(mana: number, congestion: number): number { | ||
return mana / congestion / EPOCH_DURATION; | ||
return mana / congestion; | ||
} |
60 changes: 0 additions & 60 deletions
60
src/components/ManaCalculator/components/BlocksAllowance.tsx
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
src/components/ManaCalculator/components/DelegatorSettings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import { Details } from '@docusaurus/theme-common/Details'; | ||
import { useManaState } from '../hooks'; | ||
import { fromMicro, toMicro } from '../utils'; | ||
import Select from 'react-select'; | ||
|
||
export function DelegatorSettings() { | ||
const { state, handleOwnStakeChange, handleValidatorChange } = useManaState(); | ||
|
||
const validatorOptions = state.validators.map((_, i) => { | ||
return { value: i, label: `Validator ${i + 1}` }; | ||
}); | ||
|
||
return ( | ||
<Details | ||
summary='Delegator Settings' | ||
className='mana_calculator__card mana_calculator_inner__card' | ||
> | ||
<label className='inlined-label'>Delegating to</label> | ||
<Select | ||
className='mana_calculator__compact inlined' | ||
defaultValue={{ value: 0, label: `Validator 1` }} | ||
onChange={(e) => { | ||
handleValidatorChange(e.value); | ||
}} | ||
classNamePrefix='react-select' | ||
options={validatorOptions} | ||
/> | ||
<br /> | ||
<label className='inlined-label'> | ||
Delegated amount ({state.network}) | ||
</label> | ||
<input | ||
className='mana_calculator__compact inlined' | ||
value={fromMicro(state.stakedOrDelegatedTokens)} | ||
onChange={(e) => handleOwnStakeChange(toMicro(Number(e.target.value)))} | ||
></input> | ||
</Details> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.