Skip to content

Commit

Permalink
SOV-3371: update maintenance mode state for Zero - Open LOC (#685)
Browse files Browse the repository at this point in the history
* feat: update maintenance mode state for Zero - Open LOC

* Create sweet-gorillas-drop.md

* fix: resolve PR comments

---------

Co-authored-by: Rick <[email protected]>
  • Loading branch information
Rickk137 and rick23p authored Nov 20, 2023
1 parent 27645c8 commit 42c092e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sweet-gorillas-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"frontend": patch
---

SOV-3371: update maintenance mode state for Zero - Open LOC
17 changes: 16 additions & 1 deletion apps/frontend/src/app/5_pages/ZeroPage/ZeroPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
DialogBody,
DialogHeader,
DialogSize,
ErrorBadge,
ErrorLevel,
Paragraph,
ParagraphSize,
ParagraphStyle,
Expand All @@ -37,6 +39,7 @@ import { LIQUIDATION_RESERVE_AMOUNT } from '../../../constants/general';
import { getTokenDisplayName } from '../../../constants/tokens';
import { useTransactionContext } from '../../../contexts/TransactionContext';
import { useAccount } from '../../../hooks/useAccount';
import { useMaintenance } from '../../../hooks/useMaintenance';
import { translations } from '../../../locales/i18n';
import { decimalic } from '../../../utils/math';
import { OpenLocButton } from './components/OpenLocButton/OpenLocButton';
Expand All @@ -51,6 +54,8 @@ type ZeroPageProps = {

const ZeroPage: FC<ZeroPageProps> = ({ deferred: [price] }) => {
const { liquity } = useLoaderData() as ZeroPageLoaderData;
const { checkMaintenance, States } = useMaintenance();
const openLocLocked = checkMaintenance(States.ZERO_OPEN_LOC);

const { isOpen: isTxOpen } = useTransactionContext();
const [open, toggle] = useReducer(v => !v, false);
Expand Down Expand Up @@ -153,11 +158,21 @@ const ZeroPage: FC<ZeroPageProps> = ({ deferred: [price] }) => {
onWithdraw={claimCollateralSurplus}
/>
)}
{account && showWelcomeBanner && !isLoading && (
{account && showWelcomeBanner && !isLoading && !openLocLocked && (
<div className="mt-6 lg:mt-12">
<OpenLocButton openLOC={toggle} className="mb-10 md:mb-4" />
</div>
)}

{openLocLocked && !hasLoc && !isLoading && (
<div className="my-2 flex justify-center">
<ErrorBadge
className="px-8"
level={ErrorLevel.Warning}
message={t(translations.maintenanceMode.openingLOC)}
/>
</div>
)}
<div className="flex-col-reverse lg:flex-row flex items-stretch md:p-4 md:bg-gray-90 rounded gap-9 md:gap-20">
<div className="md:min-w-[23rem] min-w-auto">
<SystemStats />
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/src/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"maintenanceMode": {
"fastBtc": "Fast BTC is locked",
"featureDisabled": "This feature is currently disabled",
"openingLOC": "Opening a line of credit is currently disabled",
"fullD2": {
"title": "Sovryn is in maintenance mode.",
"description": "Follow the social channels linked in the footer for further updates."
Expand Down

0 comments on commit 42c092e

Please sign in to comment.