-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from blend-capital/pool-status-comps
pool status banners
- Loading branch information
Showing
27 changed files
with
262 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "blend-ui", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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 @@ | ||
import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; | ||
import SevereColdIcon from '@mui/icons-material/SevereCold'; | ||
import { Box, Typography, useTheme } from '@mui/material'; | ||
import { OpaqueButton } from '../common/OpaqueButton'; | ||
|
||
export const PoolFrozenBanner = () => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<OpaqueButton | ||
onClick={() => | ||
window.open(`https://docs.blend.capital/pool-creators/pool-management#frozen`, '_blank') | ||
} | ||
palette={theme.palette.error} | ||
sx={{ | ||
width: '100%', | ||
display: 'flex', | ||
margin: '6px', | ||
padding: '12px', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
paddingRight: '20px', | ||
}} | ||
> | ||
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center' }}> | ||
<SevereColdIcon sx={{ marginRight: '6px' }} /> | ||
<Typography variant="body2"> | ||
This pool is frozen. Supplying and borrowing are suspended. You CAN withdraw and repay. | ||
</Typography> | ||
</Box> | ||
<ArrowForwardIcon fontSize="inherit" /> | ||
</OpaqueButton> | ||
); | ||
}; |
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,22 @@ | ||
import { Box } from '@mui/material'; | ||
import { usePool, usePoolOracle } from '../../hooks/api'; | ||
import { PoolComponentProps } from '../common/PoolComponentProps'; | ||
import { Row } from '../common/Row'; | ||
import { PoolOracleError } from './PoolOracleErrorBanner'; | ||
import { PoolStatusBanner } from './PoolStatusBanner'; | ||
|
||
export const PoolHealthBanner: React.FC<PoolComponentProps> = ({ poolId, ...props }) => { | ||
const { data: pool } = usePool(poolId); | ||
const { isError: isOracleError } = usePoolOracle(pool); | ||
|
||
return ( | ||
<Box sx={{ width: '100%', display: 'flex', flexDirection: 'column' }}> | ||
<PoolStatusBanner status={pool?.config?.status} /> | ||
{isOracleError && ( | ||
<Row> | ||
<PoolOracleError /> | ||
</Row> | ||
)} | ||
</Box> | ||
); | ||
}; |
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,33 @@ | ||
import AcUnitIcon from '@mui/icons-material/AcUnit'; | ||
import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; | ||
import { Box, Typography, useTheme } from '@mui/material'; | ||
import { OpaqueButton } from '../common/OpaqueButton'; | ||
|
||
export const PoolOnIceBanner = () => { | ||
const theme = useTheme(); | ||
return ( | ||
<OpaqueButton | ||
onClick={() => | ||
window.open(`https://docs.blend.capital/pool-creators/pool-management#on-ice`, '_blank') | ||
} | ||
palette={theme.palette.warning} | ||
sx={{ | ||
width: '100%', | ||
display: 'flex', | ||
margin: '6px', | ||
padding: '12px', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
paddingRight: '20px', | ||
}} | ||
> | ||
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center' }}> | ||
<AcUnitIcon sx={{ marginRight: '6px' }} /> | ||
<Typography variant="body2"> | ||
This pool is on-ice. Borrowing is suspended. You CAN supply, withdraw, and repay. | ||
</Typography> | ||
</Box> | ||
<ArrowForwardIcon fontSize="inherit" /> | ||
</OpaqueButton> | ||
); | ||
}; |
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,29 @@ | ||
import WarningIcon from '@mui/icons-material/Warning'; | ||
import { Box, Typography, useTheme } from '@mui/material'; | ||
|
||
export const PoolOracleError = () => { | ||
const theme = useTheme(); | ||
return ( | ||
<Box | ||
sx={{ | ||
width: '100%', | ||
display: 'flex', | ||
margin: '6px', | ||
padding: '12px', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
paddingRight: '20px', | ||
borderRadius: '4px', | ||
color: theme.palette.warning.main, | ||
backgroundColor: theme.palette.warning.opaque, | ||
}} | ||
> | ||
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center' }}> | ||
<WarningIcon sx={{ marginRight: '6px' }} /> | ||
<Typography variant="body2"> | ||
{"This pool's oracle is currently experiencing issues. Please check back later."} | ||
</Typography> | ||
</Box> | ||
</Box> | ||
); | ||
}; |
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,20 @@ | ||
import { BoxProps } from '@mui/material'; | ||
import { Row } from '../common/Row'; | ||
import { PoolFrozenBanner } from './PoolFrozenBanner'; | ||
import { PoolOnIceBanner } from './PoolOnIceBanner'; | ||
|
||
export interface PoolStatusBannerProps extends BoxProps { | ||
status: number | undefined; | ||
} | ||
|
||
export const PoolStatusBanner: React.FC<PoolStatusBannerProps> = ({ status, ...props }) => { | ||
// status of 1 or 0 indicated an active pool. if a status is currently loading or unable to be resolved, | ||
// do not display a banner | ||
const status_issue = status !== undefined && status > 1; | ||
|
||
if (!status_issue) { | ||
return <></>; | ||
} | ||
|
||
return <Row {...props}>{status <= 3 ? <PoolOnIceBanner /> : <PoolFrozenBanner />}</Row>; | ||
}; |
Oops, something went wrong.
7ba05ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit was deployed on ipfs