-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c54487
commit 69625f8
Showing
4 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
packages/protocol-dashboard/src/components/Bounds/Bounds.module.css
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,34 @@ | ||
.container { | ||
display: inline-flex; | ||
flex-direction: column; | ||
align-items: center; | ||
padding: 0px; | ||
width: 300px; | ||
min-width: 300px; | ||
margin-bottom: 8px; | ||
} | ||
|
||
.rowContainer { | ||
display: inline-flex; | ||
width: 100%; | ||
justify-content: space-between; | ||
margin-bottom: 2px; | ||
} | ||
|
||
.label { | ||
font-weight: var(--font-bold); | ||
font-size: var(--font-m); | ||
letter-spacing: 0.01em; | ||
text-transform: uppercase; | ||
color: var(--neutral-light-4); | ||
} | ||
|
||
.value { | ||
font-weight: var(--font-bold); | ||
font-size: var(--font-m); | ||
|
||
text-align: right; | ||
letter-spacing: 0.01em; | ||
text-transform: uppercase; | ||
color: var(--neutral); | ||
} |
51 changes: 51 additions & 0 deletions
51
packages/protocol-dashboard/src/components/Bounds/Bounds.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,51 @@ | ||
import React, { ReactNode } from 'react' | ||
|
||
import Paper from 'components/Paper' | ||
import styles from './Bounds.module.css' | ||
import { Address } from 'types' | ||
import DisplayAudio from 'components/DisplayAudio' | ||
import { useUser } from 'store/cache/user/hooks' | ||
|
||
const messages = { | ||
minimumTotalStake: 'Min Allowed Stake', | ||
maximumTotalStake: 'Max Allowed Stake' | ||
} | ||
|
||
type RowStatProps = { | ||
label: string | ||
value: ReactNode | ||
} | ||
const RowStat: React.FC<RowStatProps> = ({ label, value }) => { | ||
return ( | ||
<div className={styles.rowContainer}> | ||
<div className={styles.label}>{label}</div> | ||
<div className={styles.value}>{value}</div> | ||
</div> | ||
) | ||
} | ||
|
||
type OwnProps = { | ||
wallet: Address | ||
} | ||
|
||
type BoundsProps = OwnProps | ||
|
||
/** | ||
* Shows stats about staking. Lives on the SP page | ||
*/ | ||
const Bounds: React.FC<BoundsProps> = ({ wallet }) => { | ||
const { user } = useUser({ wallet }) | ||
if (!user || !('serviceProvider' in user)) { | ||
return null | ||
} | ||
const min = <DisplayAudio amount={user.serviceProvider.minAccountStake} /> | ||
const max = <DisplayAudio amount={user.serviceProvider.maxAccountStake} /> | ||
return ( | ||
<Paper className={styles.container}> | ||
<RowStat label={messages.minimumTotalStake} value={min} /> | ||
<RowStat label={messages.maximumTotalStake} value={max} /> | ||
</Paper> | ||
) | ||
} | ||
|
||
export default Bounds |
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 @@ | ||
export { default } from './Bounds' |
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