Skip to content

Commit

Permalink
Liq banner (#484)
Browse files Browse the repository at this point in the history
* Hide kwenta message when aelin pool closes

* Add banner for liquidation setting changes
  • Loading branch information
0xjocke authored Nov 12, 2022
1 parent 13369dd commit c299f20
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
25 changes: 22 additions & 3 deletions v2/ui/components/BannerManager/BannerManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import useSynthetixQueries from '@synthetixio/queries';
import { EXTERNAL_LINKS } from 'constants/links';
import Connector from 'containers/Connector';
import { isAnyElectionInNomination, isAnyElectionInVoting } from 'utils/governance';
import useLocalStorage from '../../hooks/useLocalStorage';

const kwentaTokenLive = true;
const kwentaAelinPoolActive = new Date() < new Date('2022-11-15T00:00:00.000Z');

const liqSettingDeadlineNotPassed = new Date() < new Date('2022-11-20T00:00:00.000Z');

const BannerManager: FC = () => {
const { subgraph, useGetLiquidationDataQuery, useGetDebtDataQuery, useGetElectionsPeriodStatus } =
Expand All @@ -22,7 +25,7 @@ const BannerManager: FC = () => {

const electionIsInNomination = isAnyElectionInNomination(periodStatusQuery.data);
const electionIsInVoting = isAnyElectionInVoting(periodStatusQuery.data);

const [showLiqSetting] = useLocalStorage(LOCAL_STORAGE_KEYS.LIQUIDATION_SETTING_CHANGES, false);
const liquidationData = useGetLiquidationDataQuery(walletAddress);
const debtData = useGetDebtDataQuery(walletAddress);

Expand Down Expand Up @@ -63,7 +66,22 @@ const BannerManager: FC = () => {
/>
);
}
if (kwentaTokenLive) {
if (liqSettingDeadlineNotPassed && showLiqSetting) {
return (
<Banner
type={BannerType.INFORMATION}
localStorageKey={LOCAL_STORAGE_KEYS.LIQUIDATION_SETTING_CHANGES}
message={
<Trans
i18nKey="user-menu.banner.liq-setting-changes"
components={[<StyledExternalLink href={EXTERNAL_LINKS.sips.sccp246} />]}
/>
}
/>
);
}
if (kwentaAelinPoolActive) {
// TODO remove nov 15
return (
<Banner
type={BannerType.INFORMATION}
Expand All @@ -77,6 +95,7 @@ const BannerManager: FC = () => {
/>
);
}

if (electionIsInVoting) {
return (
<Banner
Expand Down
3 changes: 3 additions & 0 deletions v2/ui/constants/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ export const EXTERNAL_LINKS = {
multichain: {
app: 'https://app.multichain.org/',
},
sips: {
sccp246: 'https://sips.synthetix.io/sccp/sccp-246/',
},
};
1 change: 1 addition & 0 deletions v2/ui/constants/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export const LOCAL_STORAGE_KEYS = {
WARNING_URL_BANNER_VISIBLE: 'isWarningUrlBannerVisible',
RE_ELECTION_NEW_START_TIME: 'reElectionNewStartTimeVisible',
STAKING_V2_ENABLED: 'STAKING_V2_ENABLED',
LIQUIDATION_SETTING_CHANGES: 'LIQUIDATION_SETTING_CHANGES',
};
3 changes: 2 additions & 1 deletion v2/ui/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,8 @@
"thales-staking-info": "ATTENTION: As a SNX staker you are eligible for THALES weekly rewards. If you haven't already, <0>click here to learn more and claim</0>.",
"election-in-nomination": "ATTENTION: Elections are now in nomination. Go to <0>https://governance.synthetix.io</0> to nominate.",
"election-in-voting": "ATTENTION: The Synthetix Governing bodies need your vote! Go to <0>https://governance.synthetix.io</0> to vote.",
"kwenta-token": "KWENTA token is available for SNX stakers via a pool on Aelin. Learn more about how to participate <0>here</0>."
"kwenta-token": "KWENTA token is available for SNX stakers via a pool on Aelin. Learn more about how to participate <0>here</0>.",
"liq-setting-changes": "Liquidation penalties have been increased and flagging period shortened to 8 hours. Read more <0>here</0>."
},
"error": {
"please-install-metamask": "Please install Metamask or manually add the Optimism network to your browser wallet."
Expand Down

5 comments on commit c299f20

@vercel
Copy link

@vercel vercel bot commented on c299f20 Nov 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

v3-snx – ./v3/ui

v3-snx.vercel.app
v3-snx-git-master-synthetixio.vercel.app
v3-snx-synthetixio.vercel.app
v3.synthetix.io

@vercel
Copy link

@vercel vercel bot commented on c299f20 Nov 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

snx-v3-docs – ./v3/docs

snx-v3-docs-synthetixio.vercel.app
snx-v3-docs-git-master-synthetixio.vercel.app
snx-v3-docs.vercel.app

@vercel
Copy link

@vercel vercel bot commented on c299f20 Nov 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

v3-storybook – ./v3/theme

js-monorepo-ten.vercel.app
v3-storybook-git-master-synthetixio.vercel.app
v3-storybook-synthetixio.vercel.app

@vercel
Copy link

@vercel vercel bot commented on c299f20 Nov 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

v2-storybook – ./v2/ui

v2-storybook-synthetixio.vercel.app
v2-storybook-git-master-synthetixio.vercel.app
staking-storybook.vercel.app

@vercel
Copy link

@vercel vercel bot commented on c299f20 Nov 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.