diff --git a/components/account/AccountHeroStats.tsx b/components/account/AccountHeroStats.tsx index c7fe1265..90071d83 100644 --- a/components/account/AccountHeroStats.tsx +++ b/components/account/AccountHeroStats.tsx @@ -19,6 +19,8 @@ import Change from '@components/shared/Change' import SheenLoader from '@components/shared/SheenLoader' import { PerformanceDataItem } from 'types' import useAccountHourlyVolumeStats from 'hooks/useAccountHourlyVolumeStats' +import { useHiddenMangoAccounts } from 'hooks/useHiddenMangoAccounts' +import { useWallet } from '@solana/wallet-adapter-react' const AccountHeroStats = ({ accountPnl, @@ -38,6 +40,12 @@ const AccountHeroStats = ({ const { mangoAccount, mangoAccountAddress } = useMangoAccount() const { hourlyVolumeData, loadingHourlyVolume } = useAccountHourlyVolumeStats() + const { hiddenAccounts } = useHiddenMangoAccounts() + const { connected } = useWallet() + const accountHidden = + !connected && + mangoAccountAddress && + hiddenAccounts?.includes(mangoAccountAddress) const totalInterestData = mangoStore( (s) => s.mangoAccount.interestTotals.data, @@ -314,7 +322,7 @@ const AccountHeroStats = ({ >

{t('pnl')}

- {mangoAccountAddress ? ( + {mangoAccountAddress && !accountHidden ? (
) : null}
-

- -

-
- -

{t('rolling-change')}

-
+ {!accountHidden ? ( + <> +

+ +

+
+ +

{t('rolling-change')}

+
+ + ) : ( + <> +

+ +

+
+ +

{t('rolling-change')}

+
+ + )}
diff --git a/components/settings/AccountSettings.tsx b/components/settings/AccountSettings.tsx index 5fb58c6d..e6546652 100644 --- a/components/settings/AccountSettings.tsx +++ b/components/settings/AccountSettings.tsx @@ -1,3 +1,4 @@ +import HideMangoAccount from '@components/account/HideMangoAccount' import MangoAccountSizeModal from '@components/modals/MangoAccountSizeModal' import { LinkButton } from '@components/shared/Button' import TokenLogo from '@components/shared/TokenLogo' @@ -286,6 +287,7 @@ const AccountSettings = () => {

{availablePerpOo}

*/} + {showAccountSizeModal ? ( { + // returns Promise + try { + const hideResponse = await fetch( + `${MANGO_DATA_API_URL}/user-data/private-accounts`, + ) + const res = await hideResponse.json() + return res?.private_accounts ?? [] + } catch (e) { + console.log('Failed to fetch spot volume', e) + } +} + +export function useHiddenMangoAccounts() { + const { data: hiddenAccounts, isLoading: loadingHiddenAccounts } = useQuery( + ['all-hidden-accounts'], + () => fetchAllHiddenMangoAccounts(), + { + cacheTime: 1000 * 60 * 10, + staleTime: 1000 * 60, + retry: 3, + refetchOnWindowFocus: false, + }, + ) + + return { + hiddenAccounts, + loadingHiddenAccounts, + } +} diff --git a/public/locales/en/account.json b/public/locales/en/account.json index 86eb4165..fba480fe 100644 --- a/public/locales/en/account.json +++ b/public/locales/en/account.json @@ -2,7 +2,7 @@ "assets": "Assets", "assets-liabilities": "Assets & Liabilities", "collateral-value": "Collateral Value", - "cumulative-interest-chart": "Cumulative Interst Chart", + "cumulative-interest-chart": "Cumulative Interest Chart", "daily-volume": "24h Volume", "export": "Export {{dataType}}", "funding-chart": "Funding Chart", diff --git a/public/locales/es/account.json b/public/locales/es/account.json index 86eb4165..fba480fe 100644 --- a/public/locales/es/account.json +++ b/public/locales/es/account.json @@ -2,7 +2,7 @@ "assets": "Assets", "assets-liabilities": "Assets & Liabilities", "collateral-value": "Collateral Value", - "cumulative-interest-chart": "Cumulative Interst Chart", + "cumulative-interest-chart": "Cumulative Interest Chart", "daily-volume": "24h Volume", "export": "Export {{dataType}}", "funding-chart": "Funding Chart", diff --git a/public/locales/ru/account.json b/public/locales/ru/account.json index 86eb4165..fba480fe 100644 --- a/public/locales/ru/account.json +++ b/public/locales/ru/account.json @@ -2,7 +2,7 @@ "assets": "Assets", "assets-liabilities": "Assets & Liabilities", "collateral-value": "Collateral Value", - "cumulative-interest-chart": "Cumulative Interst Chart", + "cumulative-interest-chart": "Cumulative Interest Chart", "daily-volume": "24h Volume", "export": "Export {{dataType}}", "funding-chart": "Funding Chart",