-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: refactor frozen warnings #1141
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a9e1c77
feat: improve frozen warning mappings
defispartan 0d6b55b
fix: clean up logic and make warnings responsive to frozen status
defispartan 60c4ae9
fix: trans tag wrapping
defispartan b0c88b2
fix: simplify MarketWarning component
defispartan 2653398
Merge branch 'main' into feat/refactor-frozen-warnings
defispartan 7fd177a
chore: run i18n
defispartan 6172cc9
remove fantom market from CI while it frozen
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ExclamationIcon } from '@heroicons/react/outline'; | ||
import { Trans } from '@lingui/macro'; | ||
import { Box, SvgIcon } from '@mui/material'; | ||
|
||
import { ContentWithTooltip } from '../ContentWithTooltip'; | ||
import { Link } from '../primitives/Link'; | ||
import { frozenProposalMap } from '../../utils/marketsAndNetworksConfig'; | ||
|
||
interface FrozenTooltipProps { | ||
symbol?: string; | ||
currentMarket?: string; | ||
} | ||
|
||
export const getFrozenProposalLink = ( | ||
symbol: string | undefined, | ||
currentMarket: string | undefined | ||
): string => { | ||
if (currentMarket && currentMarket === 'proto_harmony_v3') { | ||
return 'https://snapshot.org/#/aave.eth/proposal/0x81a78109941e5e0ac6cb5ebf82597c839c20ad6821a8c3ff063dba39032533d4'; | ||
} else if (currentMarket && currentMarket === 'proto_fantom_v3') { | ||
return 'https://snapshot.org/#/aave.eth/proposal/0xeefcd76e523391a14cfd0a79b531ea0a3faf0eb4a058e255fac13a2d224cc647'; | ||
} else if (symbol && frozenProposalMap[symbol]) { | ||
return frozenProposalMap[symbol]; | ||
} else { | ||
return 'https://app.aave.com/governance'; | ||
} | ||
}; | ||
|
||
export const FrozenTooltip = ({ symbol, currentMarket }: FrozenTooltipProps) => { | ||
return ( | ||
<ContentWithTooltip | ||
tooltipContent={ | ||
<Box> | ||
<Trans> | ||
This asset is frozen due to an Aave Protocol Governance decision.{' '} | ||
<Link | ||
href={getFrozenProposalLink(symbol, currentMarket)} | ||
sx={{ textDecoration: 'underline' }} | ||
> | ||
<Trans>More details</Trans> | ||
</Link> | ||
</Trans> | ||
</Box> | ||
} | ||
> | ||
<SvgIcon sx={{ fontSize: '20px', color: 'error.main', ml: 2 }}> | ||
<ExclamationIcon /> | ||
</SvgIcon> | ||
</ContentWithTooltip> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ import { | |
} from '../FlowCommons/TxModalDetails'; | ||
import { AAVEWarning } from '../Warnings/AAVEWarning'; | ||
import { AMPLWarning } from '../Warnings/AMPLWarning'; | ||
import { HarmonyWarning } from '../Warnings/HarmonyWarning'; | ||
import { IsolationModeWarning } from '../Warnings/IsolationModeWarning'; | ||
import { SNXWarning } from '../Warnings/SNXWarning'; | ||
import { SupplyActions } from './SupplyActions'; | ||
|
@@ -217,7 +216,6 @@ export const SupplyModalContent = ({ | |
poolReserve.symbol === 'AAVE' && | ||
isFeatureEnabled.staking(currentMarketData) && <AAVEWarning />} | ||
{poolReserve.symbol === 'SNX' && !maxAmountToSupply.eq('0') && <SNXWarning />} | ||
{currentNetworkConfig.name === 'Harmony' && <HarmonyWarning learnMore={true} />} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This warning is unnecessary since supply is disabled when market is frozen |
||
|
||
<AssetInput | ||
value={amount} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Trans } from '@lingui/macro'; | ||
import { Link, Typography, AlertColor } from '@mui/material'; | ||
|
||
import { Warning } from '../../primitives/Warning'; | ||
|
||
interface MarketWarningProps { | ||
learnMore?: boolean; // Modify wording on link text, | ||
warningMessage: string; | ||
linkHref?: string; | ||
warningType: AlertColor; | ||
} | ||
|
||
export const MarketWarning = ({ | ||
learnMore, | ||
warningMessage, | ||
linkHref, | ||
warningType, | ||
}: MarketWarningProps) => { | ||
return ( | ||
<Warning severity={warningType}> | ||
<Typography variant="caption"> | ||
<Trans> | ||
{warningMessage}{' '} | ||
drewcook marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Link href={linkHref} target="_blank"> | ||
{learnMore ? 'Learn More' : 'Join the community discussion'} | ||
</Link> | ||
</Trans> | ||
</Typography> | ||
</Warning> | ||
); | ||
}; |
Large diffs are not rendered by default.
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Small optimization if you wanted to, you could assign the baseUrl to a var for DRY
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.
For now I'll just keep it as is, but I opened aave/aave-utilities#419 to create an enum so we don't have to hardcode the market names, and we can move these links to a separate config (either in utilities or interface) as well when this is added.