Skip to content

Commit

Permalink
Capitalization and remove underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenshively committed Feb 24, 2024
1 parent 1fd94d2 commit d799ba2
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions earn/src/pages/AdvancedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ const LinkContainer = styled.div`
`;

enum OpenedModal {
None,
NewSmartWallet,
AddCollateral,
RemoveCollateral,
Borrow,
Repay,
WithdrawAnte,
PendingTxn,
NONE,
NEW_SMART_WALLET,
ADD_COLLATERAL,
REMOVE_COLLATERAL,
BORROW,
REPAY,
WITHDRAW_ANTE,
PENDING_TXN,
}

export type UniswapPoolInfo = {
Expand All @@ -151,7 +151,7 @@ export default function AdvancedPage() {
activeChain.id
);
const [uniswapNFTPositions, setUniswapNFTPositions] = useSafeState<Map<number, UniswapNFTPosition>>(new Map());
const [openedModal, setOpenedModal] = useState(OpenedModal.None);
const [openedModal, setOpenedModal] = useState(OpenedModal.NONE);
const [pendingTxn, setPendingTxn] = useState<SendTransactionResult | null>(null);
const [pendingTxnModalStatus, setPendingTxnModalStatus] = useSafeState<PendingTxnModalStatus | null>(null);

Expand Down Expand Up @@ -223,7 +223,7 @@ export default function AdvancedPage() {
(async () => {
if (!pendingTxn) return;
setPendingTxnModalStatus(PendingTxnModalStatus.PENDING);
setOpenedModal(OpenedModal.PendingTxn);
setOpenedModal(OpenedModal.PENDING_TXN);
const receipt = await pendingTxn.wait();
if (receipt.status === 1) {
setPendingTxnModalStatus(PendingTxnModalStatus.SUCCESS);
Expand Down Expand Up @@ -313,17 +313,17 @@ export default function AdvancedPage() {
</div>
<GridAreaForButtons>
<ManageAccountButtons
onAddCollateral={() => setOpenedModal(OpenedModal.AddCollateral)}
onRemoveCollateral={() => setOpenedModal(OpenedModal.RemoveCollateral)}
onBorrow={() => setOpenedModal(OpenedModal.Borrow)}
onRepay={() => setOpenedModal(OpenedModal.Repay)}
onAddCollateral={() => setOpenedModal(OpenedModal.ADD_COLLATERAL)}
onRemoveCollateral={() => setOpenedModal(OpenedModal.REMOVE_COLLATERAL)}
onBorrow={() => setOpenedModal(OpenedModal.BORROW)}
onRepay={() => setOpenedModal(OpenedModal.REPAY)}
onGetLeverage={() => {
if (selectedMarginAccount != null) {
const primeAccountUrl = `${primeUrl()}borrow/account/${selectedMarginAccount.address}`;
window.open(primeAccountUrl, '_blank');
}
}}
onWithdrawAnte={() => setOpenedModal(OpenedModal.WithdrawAnte)}
onWithdrawAnte={() => setOpenedModal(OpenedModal.WITHDRAW_ANTE)}
isWithdrawAnteDisabled={isUnableToWithdrawAnte}
isDisabled={!selectedMarginAccount || !isConnected}
/>
Expand All @@ -346,7 +346,7 @@ export default function AdvancedPage() {
))}
<NewSmartWalletButton
userHasNoMarginAccounts={userHasNoMarginAccounts}
onClick={() => setOpenedModal(OpenedModal.NewSmartWallet)}
onClick={() => setOpenedModal(OpenedModal.NEW_SMART_WALLET)}
/>
</GridAreaForNFTList>
<GridAreaForData>
Expand Down Expand Up @@ -388,8 +388,8 @@ export default function AdvancedPage() {
<NewSmartWalletModal
availablePools={availablePools}
defaultPool={defaultPool}
isOpen={openedModal === OpenedModal.NewSmartWallet}
setIsOpen={(_open) => setOpenedModal(_open ? OpenedModal.NewSmartWallet : OpenedModal.None)}
isOpen={openedModal === OpenedModal.NEW_SMART_WALLET}
setIsOpen={(isOpen) => setOpenedModal(isOpen ? OpenedModal.NEW_SMART_WALLET : OpenedModal.NONE)}
setPendingTxn={setPendingTxn}
/>
)}
Expand All @@ -398,50 +398,50 @@ export default function AdvancedPage() {
<AddCollateralModal
borrower={selectedMarginAccount}
uniswapNFTPositions={filteredNonZeroUniswapNFTPositions}
isOpen={openedModal === OpenedModal.AddCollateral}
setIsOpen={(_open) => setOpenedModal(_open ? OpenedModal.AddCollateral : OpenedModal.None)}
isOpen={openedModal === OpenedModal.ADD_COLLATERAL}
setIsOpen={(isOpen) => setOpenedModal(isOpen ? OpenedModal.ADD_COLLATERAL : OpenedModal.NONE)}
setPendingTxn={setPendingTxn}
/>
<RemoveCollateralModal
borrower={selectedMarginAccount}
isOpen={openedModal === OpenedModal.RemoveCollateral}
setIsOpen={(_open) => setOpenedModal(_open ? OpenedModal.RemoveCollateral : OpenedModal.None)}
isOpen={openedModal === OpenedModal.REMOVE_COLLATERAL}
setIsOpen={(isOpen) => setOpenedModal(isOpen ? OpenedModal.REMOVE_COLLATERAL : OpenedModal.NONE)}
setPendingTxn={setPendingTxn}
/>
<BorrowModal
borrower={selectedMarginAccount}
market={market}
accountEtherBalance={accountEtherBalance}
isOpen={openedModal === OpenedModal.Borrow}
setIsOpen={(_open) => setOpenedModal(_open ? OpenedModal.Borrow : OpenedModal.None)}
isOpen={openedModal === OpenedModal.BORROW}
setIsOpen={(isOpen) => setOpenedModal(isOpen ? OpenedModal.BORROW : OpenedModal.NONE)}
setPendingTxn={setPendingTxn}
/>
<RepayModal
marginAccount={selectedMarginAccount}
isOpen={openedModal === OpenedModal.Repay}
setIsOpen={(_open) => setOpenedModal(_open ? OpenedModal.Repay : OpenedModal.None)}
isOpen={openedModal === OpenedModal.REPAY}
setIsOpen={(isOpen) => setOpenedModal(isOpen ? OpenedModal.REPAY : OpenedModal.NONE)}
setPendingTxn={setPendingTxn}
/>
<WithdrawAnteModal
borrower={selectedMarginAccount}
accountEthBalance={accountEtherBalance}
isOpen={openedModal === OpenedModal.WithdrawAnte}
setIsOpen={(_open) => setOpenedModal(_open ? OpenedModal.WithdrawAnte : OpenedModal.None)}
isOpen={openedModal === OpenedModal.WITHDRAW_ANTE}
setIsOpen={(isOpen) => setOpenedModal(isOpen ? OpenedModal.WITHDRAW_ANTE : OpenedModal.NONE)}
setPendingTxn={setPendingTxn}
/>
</>
)}
<PendingTxnModal
isOpen={openedModal === OpenedModal.PendingTxn}
isOpen={openedModal === OpenedModal.PENDING_TXN}
setIsOpen={(isOpen: boolean) => {
setOpenedModal(isOpen ? OpenedModal.PendingTxn : OpenedModal.None);
setOpenedModal(isOpen ? OpenedModal.PENDING_TXN : OpenedModal.NONE);
if (!isOpen) {
setPendingTxn(null);
}
}}
txnHash={pendingTxn?.hash}
onConfirm={() => {
setOpenedModal(OpenedModal.None);
setOpenedModal(OpenedModal.NONE);
setTimeout(() => {
navigate(0);
}, 100);
Expand Down

0 comments on commit d799ba2

Please sign in to comment.