Skip to content

Commit

Permalink
Fix prime (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenshively committed May 23, 2024
1 parent b2d6545 commit 883ff4a
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 41 deletions.
6 changes: 3 additions & 3 deletions prime/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { AccountRiskResult } from 'shared/lib/data/AccountRisk';
import { screenAddress } from 'shared/lib/data/AccountRisk';
import { PRIVACY_POLICY_URL, TERMS_OF_SERVICE_URL } from 'shared/lib/data/constants/Values';
import { fetchGeoFencing, GeoFencingInfo } from 'shared/lib/data/GeoFencing';
import { AccountRiskContext } from 'shared/lib/data/hooks/UseAccountRisk';
import useEffectOnce from 'shared/lib/data/hooks/UseEffectOnce';
import { GeoFencingContext } from 'shared/lib/data/hooks/UseGeoFencing';
import { AccountRiskContext } from 'shared/lib/hooks/UseAccountRisk';
import useEffectOnce from 'shared/lib/hooks/UseEffectOnce';
import { GeoFencingContext } from 'shared/lib/hooks/UseGeoFencing';
import { getLocalStorageBoolean, setLocalStorageBoolean } from 'shared/lib/util/LocalStorage';
import ScrollToTop from 'shared/lib/util/ScrollToTop';
import { useAccount, usePublicClient, WagmiProvider, serialize, deserialize } from 'wagmi';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { FilledGradientButtonWithIcon } from 'shared/lib/components/common/Butto
import { ALOE_II_FACTORY_ADDRESS, ALOE_II_FRONTEND_MANAGER_ADDRESS } from 'shared/lib/data/constants/ChainSpecific';
import { Q32 } from 'shared/lib/data/constants/Values';
import { GN } from 'shared/lib/data/GoodNumber';
import useChain from 'shared/lib/data/hooks/UseChain';
import useEffectOnce from 'shared/lib/data/hooks/UseEffectOnce';
import { computeOracleSeed } from 'shared/lib/data/OracleSeed';
import { Token } from 'shared/lib/data/Token';
import useChain from 'shared/lib/hooks/UseChain';
import useEffectOnce from 'shared/lib/hooks/UseEffectOnce';
import { Address, erc20Abi, maxUint256 } from 'viem';
import {
Config,
Expand Down
2 changes: 1 addition & 1 deletion prime/src/components/borrow/ManageAccountWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FilledGradientButtonWithIcon } from 'shared/lib/components/common/Butto
import { Display, Text } from 'shared/lib/components/common/Typography';
import { GREY_800 } from 'shared/lib/data/constants/Colors';
import { GN } from 'shared/lib/data/GoodNumber';
import useChain from 'shared/lib/data/hooks/UseChain';
import useChain from 'shared/lib/hooks/UseChain';
import styled from 'styled-components';
import tw from 'twin.macro';
import { Address } from 'viem';
Expand Down
2 changes: 1 addition & 1 deletion prime/src/components/borrow/MarginAccountHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import FeeTierContainer from 'shared/lib/components/common/FeeTierContainer';
import RoundedBadge, { BADGE_TEXT_COLOR } from 'shared/lib/components/common/RoundedBadge';
import { Display } from 'shared/lib/components/common/Typography';
import useChain from 'shared/lib/data/hooks/UseChain';
import { Token } from 'shared/lib/data/Token';
import useChain from 'shared/lib/hooks/UseChain';
import { getEtherscanUrlForChain } from 'shared/lib/util/Chains';
import styled from 'styled-components';
import tw from 'twin.macro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { TickMath } from '@uniswap/v3-sdk';
import JSBI from 'jsbi';
import TokenAmountInput from 'shared/lib/components/common/TokenAmountInput';
import { GNFormat } from 'shared/lib/data/GoodNumber';
import useChain from 'shared/lib/data/hooks/UseChain';
import useEffectOnce from 'shared/lib/data/hooks/UseEffectOnce';
import { UniswapV3PoolBasics, fetchUniswapPoolBasics } from 'shared/lib/data/Uniswap';
import useChain from 'shared/lib/hooks/UseChain';
import useEffectOnce from 'shared/lib/hooks/UseEffectOnce';
import { numericPriceRatioGN, roundDownToNearestN, roundUpToNearestN } from 'shared/lib/util/Numbers';
import { Address } from 'viem';
import { Config, useClient } from 'wagmi';
Expand Down
2 changes: 1 addition & 1 deletion prime/src/components/borrow/modal/PendingTxnModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LoadingModal, MESSAGE_TEXT_COLOR } from 'shared/lib/components/common/Modal';
import { Text } from 'shared/lib/components/common/Typography';
import useChain from 'shared/lib/data/hooks/UseChain';
import useChain from 'shared/lib/hooks/UseChain';
import { getEtherscanUrlForChain } from 'shared/lib/util/Chains';

export type PendingTxnModalProps = {
Expand Down
2 changes: 1 addition & 1 deletion prime/src/components/borrow/uniswap/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SquareInputWithTrailingUnit } from 'shared/lib/components/common/Input'
import Tooltip from 'shared/lib/components/common/Tooltip';
import { Text } from 'shared/lib/components/common/Typography';
import { GREY_700, GREY_800 } from 'shared/lib/data/constants/Colors';
import useClickOutside from 'shared/lib/data/hooks/UseClickOutside';
import useClickOutside from 'shared/lib/hooks/UseClickOutside';
import { formatNumberInput } from 'shared/lib/util/Numbers';
import styled from 'styled-components';
import tw from 'twin.macro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { ethers } from 'ethers';
import { Text } from 'shared/lib/components/common/Typography';
import { GREY_700 } from 'shared/lib/data/constants/Colors';
import { GN, GNFormat } from 'shared/lib/data/GoodNumber';
import useEffectOnce from 'shared/lib/data/hooks/UseEffectOnce';
import { fetchUniswapPoolBasics, UniswapV3PoolBasics } from 'shared/lib/data/Uniswap';
import useEffectOnce from 'shared/lib/hooks/UseEffectOnce';
import { formatPriceRatioGN } from 'shared/lib/util/Numbers';
import styled from 'styled-components';

Expand Down
4 changes: 2 additions & 2 deletions prime/src/components/graph/PnLGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import Tooltip from 'shared/lib/components/common/Tooltip';
import { Text } from 'shared/lib/components/common/Typography';
import { ALOE_II_FRONTEND_MANAGER_ADDRESS } from 'shared/lib/data/constants/ChainSpecific';
import { GN } from 'shared/lib/data/GoodNumber';
import useChain from 'shared/lib/data/hooks/UseChain';
import { useDebouncedEffect } from 'shared/lib/data/hooks/UseDebouncedEffect';
import useChain from 'shared/lib/hooks/UseChain';
import { useDebouncedEffect } from 'shared/lib/hooks/UseDebouncedEffect';
import { formatNumberInput } from 'shared/lib/util/Numbers';
import styled from 'styled-components';
import tw from 'twin.macro';
Expand Down
2 changes: 1 addition & 1 deletion prime/src/components/header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NavBar, NavBarLink } from 'shared/lib/components/navbar/NavBar';
import { GREY_700 } from 'shared/lib/data/constants/Colors';
import { useGeoFencing } from 'shared/lib/data/hooks/UseGeoFencing';
import { useGeoFencing } from 'shared/lib/hooks/UseGeoFencing';
import { isDappnet } from 'shared/lib/util/Utils';
import styled from 'styled-components';
import tw from 'twin.macro';
Expand Down
17 changes: 0 additions & 17 deletions prime/src/data/hooks/UseMediaQuery.ts

This file was deleted.

8 changes: 4 additions & 4 deletions prime/src/pages/BorrowAccountsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { AltSpinner } from 'shared/lib/components/common/Spinner';
import { Display } from 'shared/lib/components/common/Typography';
import { ALOE_II_FACTORY_ADDRESS, MULTICALL_ADDRESS } from 'shared/lib/data/constants/ChainSpecific';
import { NumericFeeTierToEnum, PrintFeeTier } from 'shared/lib/data/FeeTier';
import useChain from 'shared/lib/data/hooks/UseChain';
import { useChainDependentState } from 'shared/lib/data/hooks/UseChainDependentState';
import useEffectOnce from 'shared/lib/data/hooks/UseEffectOnce';
import { useGeoFencing } from 'shared/lib/data/hooks/UseGeoFencing';
import { getToken } from 'shared/lib/data/TokenData';
import useChain from 'shared/lib/hooks/UseChain';
import { useChainDependentState } from 'shared/lib/hooks/UseChainDependentState';
import useEffectOnce from 'shared/lib/hooks/UseEffectOnce';
import { useGeoFencing } from 'shared/lib/hooks/UseGeoFencing';
import { generateBytes12Salt } from 'shared/lib/util/Salt';
import { Address } from 'viem';
import { Config, useAccount, useClient, usePublicClient, useWriteContract } from 'wagmi';
Expand Down
10 changes: 5 additions & 5 deletions prime/src/pages/BorrowActionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { PreviousPageButton } from 'shared/lib/components/common/Buttons';
import { Text, Display } from 'shared/lib/components/common/Typography';
import { ALOE_II_BORROWER_LENS_ADDRESS } from 'shared/lib/data/constants/ChainSpecific';
import { GN, GNFormat } from 'shared/lib/data/GoodNumber';
import useChain from 'shared/lib/data/hooks/UseChain';
import { useChainDependentState } from 'shared/lib/data/hooks/UseChainDependentState';
import { useDebouncedEffect } from 'shared/lib/data/hooks/UseDebouncedEffect';
import { useGeoFencing } from 'shared/lib/data/hooks/UseGeoFencing';
import { useLendingPair, useLendingPairs } from 'shared/lib/data/hooks/UseLendingPairs';
import useChain from 'shared/lib/hooks/UseChain';
import { useChainDependentState } from 'shared/lib/hooks/UseChainDependentState';
import { useDebouncedEffect } from 'shared/lib/hooks/UseDebouncedEffect';
import { useGeoFencing } from 'shared/lib/hooks/UseGeoFencing';
import { useLendingPair, useLendingPairs } from 'shared/lib/hooks/UseLendingPairs';
import { formatPriceRatio } from 'shared/lib/util/Numbers';
import styled from 'styled-components';
import tw from 'twin.macro';
Expand Down
15 changes: 15 additions & 0 deletions shared/src/hooks/UseDebouncedEffect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { DependencyList, EffectCallback, useEffect } from 'react';

/**
* A debounced useEffect hook.
* @param effect the effect to be debounced
* @param delayMs the delay in milliseconds
* @param deps the dependencies of the effect
*/
export function useDebouncedEffect(effect: EffectCallback, delayMs: number, deps?: DependencyList): void {
useEffect(() => {
const timeoutId = setTimeout(effect, delayMs);
return () => clearTimeout(timeoutId);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [...(deps || []), delayMs]);
}

0 comments on commit 883ff4a

Please sign in to comment.