-
Notifications
You must be signed in to change notification settings - Fork 6
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 #146 from OriginProtocol/next
Next
- Loading branch information
Showing
34 changed files
with
3,679 additions
and
2,695 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 |
---|---|---|
|
@@ -45,4 +45,5 @@ Thumbs.db | |
# env | ||
.env.local | ||
|
||
.nx/cache | ||
.nx/cache | ||
.nx/workspace-data |
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
/dist | ||
/coverage | ||
generated | ||
/.nx/cache | ||
/.nx/cache | ||
/.nx/workspace-data |
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,6 @@ | ||
{ | ||
"name": "Origin Unified Defi", | ||
"description": "The official dapp for our groundbreaking multichain yield ecosystem", | ||
"iconPath": "https://raw.githubusercontent.com/OriginProtocol/origin-defi/main/libs/shared/icons/src/origin/origin-logo.svg", | ||
"providedBy": { "name": "Origin", "url": "https://www.originprotocol.com/" } | ||
} |
93 changes: 93 additions & 0 deletions
93
apps/defi/src/components/Topnav/components/AlertPopover.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,93 @@ | ||
import { Divider, Stack, Typography } from '@mui/material'; | ||
import { useTxButton } from '@origin/defi/shared'; | ||
import { ClickAwayPopover, TokenIcon } from '@origin/shared/components'; | ||
import { tokens } from '@origin/shared/contracts'; | ||
import { PoweredBySafe } from '@origin/shared/icons'; | ||
import { TxButton } from '@origin/shared/providers'; | ||
import { useIntl } from 'react-intl'; | ||
|
||
import type { StackProps } from '@mui/material'; | ||
import type { ClickAwayPopoverProps } from '@origin/shared/components'; | ||
import type { Contract, Token } from '@origin/shared/contracts'; | ||
|
||
export const AlertPopover = ( | ||
props: Omit<ClickAwayPopoverProps, 'children'>, | ||
) => { | ||
const intl = useIntl(); | ||
|
||
return ( | ||
<ClickAwayPopover | ||
{...props} | ||
paperProps={{ | ||
sx: { | ||
minWidth: 350, | ||
maxWidth: 370, | ||
mt: 1, | ||
borderRadius: 4, | ||
border: '1px solid', | ||
borderColor: 'divider', | ||
backgroundColor: 'background.highlight', | ||
}, | ||
}} | ||
> | ||
<Stack p={3} spacing={2}> | ||
<PoweredBySafe sx={{ width: 1, height: 24 }} /> | ||
<Typography> | ||
{intl.formatMessage({ | ||
defaultMessage: | ||
'It looks like you are minting from a contract and have not opted into yield. Contracts must opt-in to receive yield.', | ||
})} | ||
</Typography> | ||
</Stack> | ||
<Divider /> | ||
<Stack divider={<Divider />}> | ||
<RebaseRow token={tokens.mainnet.OETH} px={3} py={1.5} /> | ||
<RebaseRow token={tokens.mainnet.OUSD} px={3} py={1.5} /> | ||
</Stack> | ||
</ClickAwayPopover> | ||
); | ||
}; | ||
|
||
type RebaseRowProps = { token: Token } & StackProps; | ||
|
||
const RebaseRow = ({ token, ...rest }: RebaseRowProps) => { | ||
const intl = useIntl(); | ||
const { params, callbacks } = useTxButton({ | ||
params: { | ||
contract: token as Contract, | ||
functionName: 'rebaseOptIn', | ||
value: 0n, | ||
}, | ||
activity: { | ||
type: 'rebasing', | ||
status: 'idle', | ||
tokenIdIn: token.id, | ||
}, | ||
}); | ||
|
||
return ( | ||
<Stack | ||
direction="row" | ||
alignItems="center" | ||
justifyContent="space-between" | ||
spacing={0.5} | ||
{...rest} | ||
> | ||
<TokenIcon token={token} sx={{ fontSize: 36 }} /> | ||
<Typography> | ||
{intl.formatMessage( | ||
{ defaultMessage: 'Enable rebasing for {symbol}' }, | ||
{ symbol: token.symbol }, | ||
)} | ||
</Typography> | ||
<TxButton | ||
params={params} | ||
callbacks={callbacks} | ||
label={intl.formatMessage({ defaultMessage: 'Opt in' })} | ||
waitingSignatureLabel={intl.formatMessage({ | ||
defaultMessage: 'Signing', | ||
})} | ||
/> | ||
</Stack> | ||
); | ||
}; |
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
Oops, something went wrong.