diff --git a/apps/dao/src/components/ConnectWallet.tsx b/apps/dao/src/components/ConnectWallet.tsx index 1a110c38a..56c84aa68 100644 --- a/apps/dao/src/components/ConnectWallet.tsx +++ b/apps/dao/src/components/ConnectWallet.tsx @@ -13,7 +13,7 @@ type ConnectWalletProps = { const ConnectWallet: React.FC = ({ description, connectText, loadingText }) => { const updateConnectWalletStateKeys = useStore((state) => state.wallet.updateConnectWalletStateKeys) const connectState = useStore((state) => state.connectState) - const { theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) const loading = isLoading(connectState) diff --git a/apps/dao/src/hooks/usePageOnMount.ts b/apps/dao/src/hooks/usePageOnMount.ts index d7a1db8c6..ebb377bec 100644 --- a/apps/dao/src/hooks/usePageOnMount.ts +++ b/apps/dao/src/hooks/usePageOnMount.ts @@ -27,7 +27,7 @@ function usePageOnMount(params: Params, location: Location, navigate: NavigateFu const updateCurveJs = useStore((state) => state.updateCurveJs) const updateGlobalStoreByKey = useStore((state) => state.updateGlobalStoreByKey) - const { setLocale } = useUserProfileStore() + const setLocale = useUserProfileStore((state) => state.setLocale) const walletChainId = getWalletChainId(wallet) const walletSignerAddress = getWalletSignerAddress(wallet) diff --git a/apps/dao/src/layout/Header.tsx b/apps/dao/src/layout/Header.tsx index c99fe43a9..d9062adc9 100644 --- a/apps/dao/src/layout/Header.tsx +++ b/apps/dao/src/layout/Header.tsx @@ -30,7 +30,9 @@ export const Header = ({ sections, BannerProps }: HeaderProps) => { const routerProps = useStore((state) => state.routerProps) const updateConnectState = useStore((state) => state.updateConnectState) - const { locale, theme, setTheme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const setTheme = useUserProfileStore((state) => state.setTheme) + const locale = useUserProfileStore((state) => state.locale) const location = useLocation() const { rLocalePathname } = getLocaleFromUrl() diff --git a/apps/dao/src/layout/index.tsx b/apps/dao/src/layout/index.tsx index d4c634985..2994e7344 100644 --- a/apps/dao/src/layout/index.tsx +++ b/apps/dao/src/layout/index.tsx @@ -25,7 +25,7 @@ const BaseLayout = ({ children }: { children: React.ReactNode }) => { const updateConnectState = useStore((state) => state.updateConnectState) const updateLayoutHeight = useStore((state) => state.updateLayoutHeight) - const { locale } = useUserProfileStore() + const locale = useUserProfileStore((state) => state.locale) useEffect(() => { updateLayoutHeight('globalAlert', globalAlertHeight) diff --git a/apps/dao/src/pages/_app.tsx b/apps/dao/src/pages/_app.tsx index 5686304cc..9cfc36059 100644 --- a/apps/dao/src/pages/_app.tsx +++ b/apps/dao/src/pages/_app.tsx @@ -46,7 +46,9 @@ function CurveApp({ Component }: AppProps) { const onboard = useStore((state) => state.wallet.onboard) const isPageVisible = useStore((state) => state.isPageVisible) - const { locale, setLocale, theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const locale = useUserProfileStore((state) => state.locale) + const setLocale = useUserProfileStore((state) => state.setLocale) const [appLoaded, setAppLoaded] = useState(false) diff --git a/apps/lend/src/components/AdvancedSettings.tsx b/apps/lend/src/components/AdvancedSettings.tsx index 949efd540..6186f99fb 100644 --- a/apps/lend/src/components/AdvancedSettings.tsx +++ b/apps/lend/src/components/AdvancedSettings.tsx @@ -59,7 +59,7 @@ export const AdvancedSettings = ({ className, buttonIcon, maxSlippage }: React.P const overlayTriggerState = useOverlayTriggerState({}) const isMobile = useStore((state) => state.isMobile) - const { setMaxSlippage } = useUserProfileStore() + const setMaxSlippage = useUserProfileStore((state) => state.setMaxSlippage) const [formValues, setFormValues] = useState(DEFAULT_FORM_VALUES) diff --git a/apps/lend/src/components/ChartOhlcWrapper/index.tsx b/apps/lend/src/components/ChartOhlcWrapper/index.tsx index f1d90334f..429e8c8fa 100644 --- a/apps/lend/src/components/ChartOhlcWrapper/index.tsx +++ b/apps/lend/src/components/ChartOhlcWrapper/index.tsx @@ -39,7 +39,8 @@ const ChartOhlcWrapper: React.FC = ({ rChainId, userActiv (state) => state.loanCollateralRemove.detailInfo[loanCollateralRemoveActiveKey]?.prices ?? null, ) - const { isAdvancedMode, theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const isMdUp = useStore((state) => state.layout.isMdUp) const { diff --git a/apps/lend/src/components/ConnectWallet.tsx b/apps/lend/src/components/ConnectWallet.tsx index 17b585336..89dd7b147 100644 --- a/apps/lend/src/components/ConnectWallet.tsx +++ b/apps/lend/src/components/ConnectWallet.tsx @@ -17,7 +17,7 @@ const ConnectWallet: React.FC = ({ description, connectText, const connectState = useStore((state) => state.connectState) const loading = isLoading(connectState) - const { theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) return ( { - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) return ( diff --git a/apps/lend/src/components/DetailInfoLiqRange.tsx b/apps/lend/src/components/DetailInfoLiqRange.tsx index fc1538e1f..d9e9c89f3 100644 --- a/apps/lend/src/components/DetailInfoLiqRange.tsx +++ b/apps/lend/src/components/DetailInfoLiqRange.tsx @@ -48,7 +48,7 @@ const DetailInfoLiqRange = ({ const userDetailsResp = useStore((state) => state.user.loansDetailsMapper[userActiveKey]) const loanPricesResp = useStore((state) => state.markets.pricesMapper[rChainId]?.[rOwmId]) - const { theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) const { prices: loanPrices } = loanPricesResp ?? {} const { prices: currPrices, bands: currBands } = userDetailsResp?.details ?? {} diff --git a/apps/lend/src/components/DetailsMarket/components/MarketParameters.tsx b/apps/lend/src/components/DetailsMarket/components/MarketParameters.tsx index 600f63a43..59bdbf6b6 100644 --- a/apps/lend/src/components/DetailsMarket/components/MarketParameters.tsx +++ b/apps/lend/src/components/DetailsMarket/components/MarketParameters.tsx @@ -27,7 +27,7 @@ const MarketParameters = ({ const vaultPricePerShareResp = useStore((state) => state.markets.vaultPricePerShare[rChainId]?.[rOwmId]) const fetchVaultPricePerShare = useStore((state) => state.markets.fetchVaultPricePerShare) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const { prices, error: pricesError } = loanPricesResp ?? {} const { parameters, error: parametersError } = parametersResp ?? {} diff --git a/apps/lend/src/components/DetailsUser/components/DetailsUserLoan.tsx b/apps/lend/src/components/DetailsUser/components/DetailsUserLoan.tsx index 9fc497a42..0fc1309d9 100644 --- a/apps/lend/src/components/DetailsUser/components/DetailsUserLoan.tsx +++ b/apps/lend/src/components/DetailsUser/components/DetailsUserLoan.tsx @@ -31,7 +31,7 @@ const DetailsUserLoan = (pageProps: PageContentProps) => { const userLoanDetailsResp = useStore((state) => state.user.loansDetailsMapper[userActiveKey]) const chartExpanded = useStore((state) => state.ohlcCharts.chartExpanded) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) // TODO: handle error const { details: userLoanDetails } = userLoanDetailsResp ?? {} diff --git a/apps/lend/src/components/DetailsUser/components/DetailsUserLoanChartLiquidationRange.tsx b/apps/lend/src/components/DetailsUser/components/DetailsUserLoanChartLiquidationRange.tsx index 54e1b78cf..26981b034 100644 --- a/apps/lend/src/components/DetailsUser/components/DetailsUserLoanChartLiquidationRange.tsx +++ b/apps/lend/src/components/DetailsUser/components/DetailsUserLoanChartLiquidationRange.tsx @@ -9,7 +9,7 @@ const DetailsUserLoanChartLiquidationRange = ({ rChainId, rOwmId, userActiveKey const loanDetailsPrices = useStore((state) => state.markets.pricesMapper[rChainId]?.[rOwmId]?.prices) const userLoanDetails = useStore((state) => state.user.loansDetailsMapper[userActiveKey]?.details) - const { theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) const { prices: currPrices, status } = userLoanDetails ?? {} diff --git a/apps/lend/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoLeverage.tsx b/apps/lend/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoLeverage.tsx index 42d923fb6..3f3e70e6c 100644 --- a/apps/lend/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoLeverage.tsx +++ b/apps/lend/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoLeverage.tsx @@ -45,10 +45,8 @@ const DetailInfoLeverage = ({ const isEditLiqRange = useStore((state) => state.loanCreate.isEditLiqRange) const liqRanges = useStore((state) => state.loanCreate.liqRanges[activeKeyLiqRange]) - const { - isAdvancedMode, - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const { signerAddress } = api ?? {} const { minBands, maxBands, borrowed_token, collateral_token } = market ?? {} diff --git a/apps/lend/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoNonLeverage.tsx b/apps/lend/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoNonLeverage.tsx index c561f0aaa..79d356ede 100644 --- a/apps/lend/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoNonLeverage.tsx +++ b/apps/lend/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoNonLeverage.tsx @@ -36,7 +36,7 @@ const DetailInfoNonLeverage = ({ const isEditLiqRange = useStore((state) => state.loanCreate.isEditLiqRange) const liqRanges = useStore((state) => state.loanCreate.liqRanges[activeKeyLiqRange]) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const { signerAddress } = api ?? {} const { borrowed_token, collateral_token } = market ?? {} diff --git a/apps/lend/src/components/PageLoanCreate/LoanFormCreate/index.tsx b/apps/lend/src/components/PageLoanCreate/LoanFormCreate/index.tsx index 94b6aa0d5..99101a691 100644 --- a/apps/lend/src/components/PageLoanCreate/LoanFormCreate/index.tsx +++ b/apps/lend/src/components/PageLoanCreate/LoanFormCreate/index.tsx @@ -63,11 +63,8 @@ const LoanCreate = ({ isLeverage = false, ...pageProps }: PageContentProps & { i const setFormValues = useStore((state) => state.loanCreate.setFormValues) const resetState = useStore((state) => state.loanCreate.resetState) - const { - isAdvancedMode, - theme, - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const [{ isConfirming, confirmedWarning }, setConfirmWarning] = useState(DEFAULT_CONFIRM_WARNING) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) diff --git a/apps/lend/src/components/PageLoanCreate/Page.tsx b/apps/lend/src/components/PageLoanCreate/Page.tsx index 5af92141b..4d5d19204 100644 --- a/apps/lend/src/components/PageLoanCreate/Page.tsx +++ b/apps/lend/src/components/PageLoanCreate/Page.tsx @@ -56,7 +56,7 @@ const Page: NextPage = () => { const { chartExpanded, setChartExpanded } = useStore((state) => state.ohlcCharts) const provider = useStore((state) => state.wallet.getProvider('')) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const [isLoaded, setLoaded] = useState(false) const [initialLoaded, setInitialLoaded] = useState(false) diff --git a/apps/lend/src/components/PageLoanManage/LoanBorrowMore/components/DetailInfo.tsx b/apps/lend/src/components/PageLoanManage/LoanBorrowMore/components/DetailInfo.tsx index 61eeb6368..a8b497812 100644 --- a/apps/lend/src/components/PageLoanManage/LoanBorrowMore/components/DetailInfo.tsx +++ b/apps/lend/src/components/PageLoanManage/LoanBorrowMore/components/DetailInfo.tsx @@ -29,7 +29,7 @@ const DetailInfo = ({ const formEstGas = useStore((state) => state.loanBorrowMore.formEstGas[activeKey]) const formValues = useStore((state) => state.loanBorrowMore.formValues) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const { signerAddress } = api ?? {} diff --git a/apps/lend/src/components/PageLoanManage/LoanBorrowMore/components/DetailInfoLeverage.tsx b/apps/lend/src/components/PageLoanManage/LoanBorrowMore/components/DetailInfoLeverage.tsx index a77162c32..1daecd769 100644 --- a/apps/lend/src/components/PageLoanManage/LoanBorrowMore/components/DetailInfoLeverage.tsx +++ b/apps/lend/src/components/PageLoanManage/LoanBorrowMore/components/DetailInfoLeverage.tsx @@ -40,10 +40,8 @@ const DetailInfoLeverage = ({ const formEstGas = useStore((state) => state.loanBorrowMore.formEstGas[activeKey]) const formValues = useStore((state) => state.loanBorrowMore.formValues) - const { - isAdvancedMode, - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const { signerAddress } = api ?? {} const { expectedCollateral, routeImage } = detailInfo ?? {} diff --git a/apps/lend/src/components/PageLoanManage/LoanBorrowMore/index.tsx b/apps/lend/src/components/PageLoanManage/LoanBorrowMore/index.tsx index 7e23cd9aa..869aa2edf 100644 --- a/apps/lend/src/components/PageLoanManage/LoanBorrowMore/index.tsx +++ b/apps/lend/src/components/PageLoanManage/LoanBorrowMore/index.tsx @@ -62,9 +62,7 @@ const LoanBorrowMore = ({ const setFormValues = useStore((state) => state.loanBorrowMore.setFormValues) const resetState = useStore((state) => state.loanBorrowMore.resetState) - const { - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const [{ isConfirming, confirmedWarning }, setConfirmWarning] = useState(DEFAULT_CONFIRM_WARNING) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) diff --git a/apps/lend/src/components/PageLoanManage/LoanCollateralAdd/index.tsx b/apps/lend/src/components/PageLoanManage/LoanCollateralAdd/index.tsx index f08d7cfd9..271e1019c 100644 --- a/apps/lend/src/components/PageLoanManage/LoanCollateralAdd/index.tsx +++ b/apps/lend/src/components/PageLoanManage/LoanCollateralAdd/index.tsx @@ -47,7 +47,7 @@ const LoanCollateralAdd = ({ rChainId, rOwmId, api, isLoaded, market, userActive const setFormValues = useStore((state) => state.loanCollateralAdd.setFormValues) const resetState = useStore((state) => state.loanCollateralAdd.resetState) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) const [steps, setSteps] = useState([]) diff --git a/apps/lend/src/components/PageLoanManage/LoanCollateralRemove/index.tsx b/apps/lend/src/components/PageLoanManage/LoanCollateralRemove/index.tsx index 413efbee3..2e45d30cf 100644 --- a/apps/lend/src/components/PageLoanManage/LoanCollateralRemove/index.tsx +++ b/apps/lend/src/components/PageLoanManage/LoanCollateralRemove/index.tsx @@ -48,7 +48,7 @@ const LoanCollateralRemove = ({ rChainId, rOwmId, isLoaded, api, market, userAct const setFormValues = useStore((state) => state.loanCollateralRemove.setFormValues) const resetState = useStore((state) => state.loanCollateralRemove.resetState) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const [{ confirmedWarning }, setConfirmWarning] = useState(DEFAULT_CONFIRM_WARNING) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) diff --git a/apps/lend/src/components/PageLoanManage/LoanRepay/components/DetailInfo.tsx b/apps/lend/src/components/PageLoanManage/LoanRepay/components/DetailInfo.tsx index 5201c91a1..ea29621b9 100644 --- a/apps/lend/src/components/PageLoanManage/LoanRepay/components/DetailInfo.tsx +++ b/apps/lend/src/components/PageLoanManage/LoanRepay/components/DetailInfo.tsx @@ -37,10 +37,8 @@ const DetailInfo = ({ const formEstGas = useStore((state) => state.loanRepay.formEstGas[activeKey]) const formValues = useStore((state) => state.loanRepay.formValues) - const { - isAdvancedMode, - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const detailInfo = detailInfoNonLeverage ?? detailInfoLeverage diff --git a/apps/lend/src/components/PageLoanManage/LoanRepay/index.tsx b/apps/lend/src/components/PageLoanManage/LoanRepay/index.tsx index b928e11f9..7274c6b82 100644 --- a/apps/lend/src/components/PageLoanManage/LoanRepay/index.tsx +++ b/apps/lend/src/components/PageLoanManage/LoanRepay/index.tsx @@ -57,9 +57,7 @@ const LoanRepay = ({ rChainId, rOwmId, isLoaded, api, market, userActiveKey }: P const setFormValues = useStore((state) => state.loanRepay.setFormValues) const resetState = useStore((state) => state.loanRepay.resetState) - const { - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const [{ isConfirming, confirmedWarning }, setConfirmWarning] = useState(DEFAULT_CONFIRM_WARNING) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) diff --git a/apps/lend/src/components/PageLoanManage/LoanSelfLiquidation/index.tsx b/apps/lend/src/components/PageLoanManage/LoanSelfLiquidation/index.tsx index a13df8b8b..ae1047edf 100644 --- a/apps/lend/src/components/PageLoanManage/LoanSelfLiquidation/index.tsx +++ b/apps/lend/src/components/PageLoanManage/LoanSelfLiquidation/index.tsx @@ -49,9 +49,7 @@ const LoanSelfLiquidation = ({ rChainId, rOwmId, isLoaded, api, market, userActi const notifyNotification = useStore((state) => state.wallet.notifyNotification) const resetState = useStore((state) => state.loanSelfLiquidation.resetState) - const { - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const [steps, setSteps] = useState([]) const [txInfoBar, setTxInfoBar] = useState(null) diff --git a/apps/lend/src/components/PageLoanManage/Page.tsx b/apps/lend/src/components/PageLoanManage/Page.tsx index e4e476aab..d7db65c6f 100644 --- a/apps/lend/src/components/PageLoanManage/Page.tsx +++ b/apps/lend/src/components/PageLoanManage/Page.tsx @@ -64,7 +64,7 @@ const Page: NextPage = () => { const { chartExpanded, setChartExpanded } = useStore((state) => state.ohlcCharts) const provider = useStore((state) => state.wallet.getProvider('')) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const { signerAddress } = api ?? {} const { borrowed_token, collateral_token } = market ?? {} diff --git a/apps/lend/src/components/PageMarketList/index.tsx b/apps/lend/src/components/PageMarketList/index.tsx index ff049af33..89c894d70 100644 --- a/apps/lend/src/components/PageMarketList/index.tsx +++ b/apps/lend/src/components/PageMarketList/index.tsx @@ -31,7 +31,7 @@ const MarketList = (pageProps: PageMarketList) => { const setFormValues = useStore((state) => state.marketList.setFormValues) const { initCampaignRewards, initiated } = useStore((state) => state.campaigns) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const { signerAddress } = api ?? {} diff --git a/apps/lend/src/components/PageVault/Page.tsx b/apps/lend/src/components/PageVault/Page.tsx index c80344f6e..274b422de 100644 --- a/apps/lend/src/components/PageVault/Page.tsx +++ b/apps/lend/src/components/PageVault/Page.tsx @@ -54,7 +54,7 @@ const Page: NextPage = () => { const setMarketsStateKey = useStore((state) => state.markets.setStateByKey) const provider = useStore((state) => state.wallet.getProvider('')) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const { signerAddress } = api ?? {} const { borrowed_token } = market ?? {} diff --git a/apps/lend/src/components/SharedCellData/CellTotalCollateralValue.tsx b/apps/lend/src/components/SharedCellData/CellTotalCollateralValue.tsx index 2d3f1962d..2d10f449b 100644 --- a/apps/lend/src/components/SharedCellData/CellTotalCollateralValue.tsx +++ b/apps/lend/src/components/SharedCellData/CellTotalCollateralValue.tsx @@ -13,7 +13,7 @@ const CellTotalCollateralValue = ({ rChainId, rOwmId }: { rChainId: ChainId; rOw const totalCollateralValue = useStore((state) => state.markets.totalCollateralValuesMapper[rChainId]?.[rOwmId]) const fetchTotalCollateralValue = useStore((state) => state.markets.fetchTotalCollateralValue) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const { total = null, tooltipContent = [], error } = totalCollateralValue ?? {} diff --git a/apps/lend/src/hooks/usePageOnMount.ts b/apps/lend/src/hooks/usePageOnMount.ts index b14a003e7..dc5cd6a4b 100644 --- a/apps/lend/src/hooks/usePageOnMount.ts +++ b/apps/lend/src/hooks/usePageOnMount.ts @@ -34,7 +34,7 @@ function usePageOnMount(params: Params, location: Location, navigate: NavigateFu const updateProvider = useStore((state) => state.wallet.updateProvider) const updateGlobalStoreByKey = useStore((state) => state.updateGlobalStoreByKey) - const { setLocale } = useUserProfileStore() + const setLocale = useUserProfileStore((state) => state.setLocale) const walletChainId = getWalletChainId(wallet) const walletSignerAddress = getWalletSignerAddress(wallet) diff --git a/apps/lend/src/layout/Header.tsx b/apps/lend/src/layout/Header.tsx index 362f9979c..25097b4bd 100644 --- a/apps/lend/src/layout/Header.tsx +++ b/apps/lend/src/layout/Header.tsx @@ -34,7 +34,11 @@ const Header = ({ chainId, sections, BannerProps }: HeaderProps) => { const isMdUp = useMediaQuery(isMdUpQuery, { noSsr: true }) const { data: tvl } = useTvl(chainId) - const { locale, isAdvancedMode, setAdvancedMode, theme, setTheme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const setTheme = useUserProfileStore((state) => state.setTheme) + const locale = useUserProfileStore((state) => state.locale) + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const setAdvancedMode = useUserProfileStore((state) => state.setAdvancedMode) const location = useLocation() const { params: routerParams } = routerProps ?? {} diff --git a/apps/lend/src/layout/index.tsx b/apps/lend/src/layout/index.tsx index cfbdd5ff0..487aae79c 100644 --- a/apps/lend/src/layout/index.tsx +++ b/apps/lend/src/layout/index.tsx @@ -26,7 +26,7 @@ const BaseLayout = ({ children }: { children: React.ReactNode }) => { const setLayoutHeight = useStore((state) => state.layout.setLayoutHeight) const updateConnectState = useStore((state) => state.updateConnectState) - const { locale } = useUserProfileStore() + const locale = useUserProfileStore((state) => state.locale) const [networkSwitch, setNetworkSwitch] = useState('') diff --git a/apps/lend/src/pages/_app.tsx b/apps/lend/src/pages/_app.tsx index ded91e8d0..c1b277220 100644 --- a/apps/lend/src/pages/_app.tsx +++ b/apps/lend/src/pages/_app.tsx @@ -33,7 +33,8 @@ function CurveApp({ Component }: AppProps) { const updateGlobalStoreByKey = useStore((state) => state.updateGlobalStoreByKey) const updateWalletStateByKey = useStore((state) => state.wallet.setStateByKey) - const { locale, theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const locale = useUserProfileStore((state) => state.locale) const [appLoaded, setAppLoaded] = useState(false) diff --git a/apps/loan/src/components/AdvancedSettings.tsx b/apps/loan/src/components/AdvancedSettings.tsx index 949efd540..6186f99fb 100644 --- a/apps/loan/src/components/AdvancedSettings.tsx +++ b/apps/loan/src/components/AdvancedSettings.tsx @@ -59,7 +59,7 @@ export const AdvancedSettings = ({ className, buttonIcon, maxSlippage }: React.P const overlayTriggerState = useOverlayTriggerState({}) const isMobile = useStore((state) => state.isMobile) - const { setMaxSlippage } = useUserProfileStore() + const setMaxSlippage = useUserProfileStore((state) => state.setMaxSlippage) const [formValues, setFormValues] = useState(DEFAULT_FORM_VALUES) diff --git a/apps/loan/src/components/ChartOhlcWrapper/index.tsx b/apps/loan/src/components/ChartOhlcWrapper/index.tsx index 90f9b654f..a124f2835 100644 --- a/apps/loan/src/components/ChartOhlcWrapper/index.tsx +++ b/apps/loan/src/components/ChartOhlcWrapper/index.tsx @@ -35,7 +35,8 @@ const ChartOhlcWrapper: React.FC = ({ rChainId, llamma, l (state) => state.loanCollateralDecrease.detailInfo[collateralDecreaseActiveKey]?.prices ?? null, ) - const { isAdvancedMode, theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const isMdUp = useStore((state) => state.layout.isMdUp) const { diff --git a/apps/loan/src/components/ConnectWallet.tsx b/apps/loan/src/components/ConnectWallet.tsx index 17b585336..89dd7b147 100644 --- a/apps/loan/src/components/ConnectWallet.tsx +++ b/apps/loan/src/components/ConnectWallet.tsx @@ -17,7 +17,7 @@ const ConnectWallet: React.FC = ({ description, connectText, const connectState = useStore((state) => state.connectState) const loading = isLoading(connectState) - const { theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) return ( void }) => { - const { theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) const { userPrices: currPrices, userBands: currBands } = userLoanDetails ?? {} diff --git a/apps/loan/src/components/LoanInfoLlamma/index.tsx b/apps/loan/src/components/LoanInfoLlamma/index.tsx index c57e56159..6f3a3b3cc 100644 --- a/apps/loan/src/components/LoanInfoLlamma/index.tsx +++ b/apps/loan/src/components/LoanInfoLlamma/index.tsx @@ -23,7 +23,7 @@ const LoanInfoLlamma = (props: Props) => { const { rChainId, llamma, llammaId } = props const chartExpanded = useStore((state) => state.ohlcCharts.chartExpanded) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) return ( diff --git a/apps/loan/src/components/LoanInfoUser/components/ChartUserLiquidationRange.tsx b/apps/loan/src/components/LoanInfoUser/components/ChartUserLiquidationRange.tsx index cd9e2f84e..959a76c48 100644 --- a/apps/loan/src/components/LoanInfoUser/components/ChartUserLiquidationRange.tsx +++ b/apps/loan/src/components/LoanInfoUser/components/ChartUserLiquidationRange.tsx @@ -9,7 +9,7 @@ const ChartUserLiquidationRange = ({ healthMode, llammaId }: { healthMode: Healt const loanDetails = useStore((state) => state.loans.detailsMapper[llammaId]) const userLoanDetails = useStore((state) => state.loans.userDetailsMapper[llammaId]) - const { theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) const { userPrices: currPrices } = userLoanDetails ?? {} diff --git a/apps/loan/src/components/LoanInfoUser/components/UserInfos.tsx b/apps/loan/src/components/LoanInfoUser/components/UserInfos.tsx index f86218b13..311fc5c9a 100644 --- a/apps/loan/src/components/LoanInfoUser/components/UserInfos.tsx +++ b/apps/loan/src/components/LoanInfoUser/components/UserInfos.tsx @@ -30,7 +30,7 @@ const UserInfos = ({ }) => { const userLoanDetails = useStore((state) => state.loans.userDetailsMapper[llammaId]) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const { coins: [stablecoin], diff --git a/apps/loan/src/components/LoanInfoUser/index.tsx b/apps/loan/src/components/LoanInfoUser/index.tsx index 513ccf01d..47447a67e 100644 --- a/apps/loan/src/components/LoanInfoUser/index.tsx +++ b/apps/loan/src/components/LoanInfoUser/index.tsx @@ -27,7 +27,7 @@ const LoanInfoUser = ({ isReady, llamma, llammaId, rChainId, titleMapper }: Prop const userLoanDetails = useStore((state) => state.loans.userDetailsMapper[llammaId]) const { chartExpanded } = useStore((state) => state.ohlcCharts) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const { userBands, healthFull, healthNotFull, userStatus } = userLoanDetails ?? {} const { activeBand } = loanDetails ?? {} diff --git a/apps/loan/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoLeverage.tsx b/apps/loan/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoLeverage.tsx index 56225f293..462587782 100644 --- a/apps/loan/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoLeverage.tsx +++ b/apps/loan/src/components/PageLoanCreate/LoanFormCreate/components/DetailInfoLeverage.tsx @@ -47,9 +47,7 @@ const DetailInfoLeverage = ({ const loanDetails = useStore((state) => state.loans.detailsMapper[llammaId]) const userLoanDetails = useStore((state) => state.loans.userDetailsMapper[llammaId]) - const { - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const LeverageDetail = () => ( diff --git a/apps/loan/src/components/PageLoanCreate/LoanFormCreate/index.tsx b/apps/loan/src/components/PageLoanCreate/LoanFormCreate/index.tsx index 7d430f951..5a2339f7e 100644 --- a/apps/loan/src/components/PageLoanCreate/LoanFormCreate/index.tsx +++ b/apps/loan/src/components/PageLoanCreate/LoanFormCreate/index.tsx @@ -66,10 +66,8 @@ const LoanCreate = ({ const setStateByKey = useStore((state) => state.loanCreate.setStateByKey) const resetState = useStore((state) => state.loanCreate.resetState) - const { - isAdvancedMode, - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const [confirmedHealthWarning, setConfirmHealthWarning] = useState(false) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) diff --git a/apps/loan/src/components/PageLoanCreate/Page.tsx b/apps/loan/src/components/PageLoanCreate/Page.tsx index 8eff3c6b9..d5e523aa1 100644 --- a/apps/loan/src/components/PageLoanCreate/Page.tsx +++ b/apps/loan/src/components/PageLoanCreate/Page.tsx @@ -58,10 +58,8 @@ const Page: NextPage = () => { const { chartExpanded, setChartExpanded } = useStore((state) => state.ohlcCharts) const provider = useStore((state) => state.wallet.getProvider('')) - const { - isAdvancedMode, - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const [loaded, setLoaded] = useState(false) diff --git a/apps/loan/src/components/PageLoanManage/CollateralDecrease/index.tsx b/apps/loan/src/components/PageLoanManage/CollateralDecrease/index.tsx index 16e4b235d..2cd23260b 100644 --- a/apps/loan/src/components/PageLoanManage/CollateralDecrease/index.tsx +++ b/apps/loan/src/components/PageLoanManage/CollateralDecrease/index.tsx @@ -55,7 +55,7 @@ const CollateralDecrease = ({ curve, llamma, llammaId, rChainId }: Props) => { const setStateByKey = useStore((state) => state.loanCollateralDecrease.setStateByKey) const resetState = useStore((state) => state.loanCollateralDecrease.resetState) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const [confirmedHealthWarning, setConfirmHealthWarning] = useState(false) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) diff --git a/apps/loan/src/components/PageLoanManage/CollateralIncrease/index.tsx b/apps/loan/src/components/PageLoanManage/CollateralIncrease/index.tsx index caa5175ef..c424ac537 100644 --- a/apps/loan/src/components/PageLoanManage/CollateralIncrease/index.tsx +++ b/apps/loan/src/components/PageLoanManage/CollateralIncrease/index.tsx @@ -55,7 +55,7 @@ const CollateralIncrease = ({ curve, isReady, llamma, llammaId }: Props) => { const setStateByKey = useStore((state) => state.loanCollateralIncrease.setStateByKey) const resetState = useStore((state) => state.loanCollateralIncrease.resetState) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const [confirmedHealthWarning, setConfirmHealthWarning] = useState(false) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) diff --git a/apps/loan/src/components/PageLoanManage/LoanDecrease/index.tsx b/apps/loan/src/components/PageLoanManage/LoanDecrease/index.tsx index c85a3375b..4cf662f84 100644 --- a/apps/loan/src/components/PageLoanManage/LoanDecrease/index.tsx +++ b/apps/loan/src/components/PageLoanManage/LoanDecrease/index.tsx @@ -58,7 +58,7 @@ const LoanDecrease = ({ curve, llamma, llammaId, params, rChainId }: Props) => { const setStateByKey = useStore((state) => state.loanDecrease.setStateByKey) const resetState = useStore((state) => state.loanDecrease.resetState) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) const [steps, setSteps] = useState([]) diff --git a/apps/loan/src/components/PageLoanManage/LoanDeleverage/index.tsx b/apps/loan/src/components/PageLoanManage/LoanDeleverage/index.tsx index 2270a7b2f..0fbc04c40 100644 --- a/apps/loan/src/components/PageLoanManage/LoanDeleverage/index.tsx +++ b/apps/loan/src/components/PageLoanManage/LoanDeleverage/index.tsx @@ -69,10 +69,8 @@ const LoanDeleverage = ({ const notifyNotification = useStore((state) => state.wallet.notifyNotification) const setFormValues = useStore((state) => state.loanDeleverage.setFormValues) - const { - isAdvancedMode, - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const [confirmHighPriceImpact, setConfirmHighPriceImpact] = useState(false) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) diff --git a/apps/loan/src/components/PageLoanManage/LoanIncrease/index.tsx b/apps/loan/src/components/PageLoanManage/LoanIncrease/index.tsx index 0ddbc82d9..1badc79a0 100644 --- a/apps/loan/src/components/PageLoanManage/LoanIncrease/index.tsx +++ b/apps/loan/src/components/PageLoanManage/LoanIncrease/index.tsx @@ -62,7 +62,7 @@ const LoanIncrease = ({ curve, isReady, llamma, llammaId }: Props) => { const setStateByKey = useStore((state) => state.loanIncrease.setStateByKey) const resetState = useStore((state) => state.loanIncrease.resetState) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const [confirmedHealthWarning, setConfirmHealthWarning] = useState(false) const [healthMode, setHealthMode] = useState(DEFAULT_HEALTH_MODE) diff --git a/apps/loan/src/components/PageLoanManage/LoanLiquidate/index.tsx b/apps/loan/src/components/PageLoanManage/LoanLiquidate/index.tsx index f845e2d5a..0a1c1492a 100644 --- a/apps/loan/src/components/PageLoanManage/LoanLiquidate/index.tsx +++ b/apps/loan/src/components/PageLoanManage/LoanLiquidate/index.tsx @@ -47,9 +47,7 @@ const LoanLiquidate = ({ curve, llamma, llammaId, params, rChainId }: Props) => const setStateByKey = useStore((state) => state.loanLiquidate.setStateByKey) const resetState = useStore((state) => state.loanLiquidate.resetState) - const { - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const [steps, setSteps] = useState([]) const [txInfoBar, setTxInfoBar] = useState(null) diff --git a/apps/loan/src/components/PageLoanManage/LoanSwap/index.tsx b/apps/loan/src/components/PageLoanManage/LoanSwap/index.tsx index d5d4556c7..c617c8881 100644 --- a/apps/loan/src/components/PageLoanManage/LoanSwap/index.tsx +++ b/apps/loan/src/components/PageLoanManage/LoanSwap/index.tsx @@ -56,10 +56,8 @@ const Swap = ({ curve, llamma, llammaId, rChainId }: Props) => { const setStateByKey = useStore((state) => state.loanSwap.setStateByKey) const resetState = useStore((state) => state.loanSwap.resetState) - const { - isAdvancedMode, - maxSlippage: { global: maxSlippage }, - } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const [steps, setSteps] = useState([]) const [txInfoBar, setTxInfoBar] = useState(null) diff --git a/apps/loan/src/components/PageLoanManage/Page.tsx b/apps/loan/src/components/PageLoanManage/Page.tsx index 435f2c796..df148c7f7 100644 --- a/apps/loan/src/components/PageLoanManage/Page.tsx +++ b/apps/loan/src/components/PageLoanManage/Page.tsx @@ -58,7 +58,7 @@ const Page: NextPage = () => { const { chartExpanded, setChartExpanded } = useStore((state) => state.ohlcCharts) const provider = useStore((state) => state.wallet.getProvider('')) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const [selectedTab, setSelectedTab] = useState('user') const [loaded, setLoaded] = useState(false) diff --git a/apps/loan/src/components/PageMarketList/components/TableStats.tsx b/apps/loan/src/components/PageMarketList/components/TableStats.tsx index 6aa17763f..f3a2cba4d 100644 --- a/apps/loan/src/components/PageMarketList/components/TableStats.tsx +++ b/apps/loan/src/components/PageMarketList/components/TableStats.tsx @@ -9,7 +9,7 @@ import ListInfoItem, { ListInfoItems } from '@/ui/ListInfo' import { useUserProfileStore } from '@ui-kit/features/user-profile' const TableStats = () => { - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const stats = [{ title: t`PegKeepers Debt`, content: }] diff --git a/apps/loan/src/components/SharedCells/TableCellTotalCollateral.tsx b/apps/loan/src/components/SharedCells/TableCellTotalCollateral.tsx index c7c8b725c..8fd28e507 100644 --- a/apps/loan/src/components/SharedCells/TableCellTotalCollateral.tsx +++ b/apps/loan/src/components/SharedCells/TableCellTotalCollateral.tsx @@ -22,7 +22,7 @@ const TableCellTotalCollateral = ({ rChainId, collateralId }: Props) => { const llamma = useStore((state) => state.collaterals.collateralDatasMapper[rChainId]?.[collateralId]?.llamma) const collateralUsdRate = useStore((state) => state.usdRates.tokens[llamma?.collateral ?? '']) - const { isAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) const { totalCollateral, totalStablecoin } = loanDetails ?? {} diff --git a/apps/loan/src/hooks/usePageOnMount.ts b/apps/loan/src/hooks/usePageOnMount.ts index 2dc6edeee..c9abc259a 100644 --- a/apps/loan/src/hooks/usePageOnMount.ts +++ b/apps/loan/src/hooks/usePageOnMount.ts @@ -30,7 +30,7 @@ function usePageOnMount(params: Params, location: Location, navigate: NavigateFu const updateProvider = useStore((state) => state.wallet.updateProvider) const updateGlobalStoreByKey = useStore((state) => state.updateGlobalStoreByKey) - const { setLocale } = useUserProfileStore() + const setLocale = useUserProfileStore((state) => state.setLocale) const walletChainId = getWalletChainId(wallet) const walletSignerAddress = getWalletSignerAddress(wallet) diff --git a/apps/loan/src/layout/Header.tsx b/apps/loan/src/layout/Header.tsx index 2a56eda8f..28e12f640 100644 --- a/apps/loan/src/layout/Header.tsx +++ b/apps/loan/src/layout/Header.tsx @@ -36,7 +36,11 @@ export const Header = ({ sections, BannerProps }: HeaderProps) => { const updateConnectState = useStore((state) => state.updateConnectState) const bannerHeight = useStore((state) => state.layout.height.globalAlert) - const { locale, isAdvancedMode, setAdvancedMode, theme, setTheme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const setTheme = useUserProfileStore((state) => state.setTheme) + const locale = useUserProfileStore((state) => state.locale) + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const setAdvancedMode = useUserProfileStore((state) => state.setAdvancedMode) const location = useLocation() const { rLocalePathname } = getLocaleFromUrl() diff --git a/apps/loan/src/layout/index.tsx b/apps/loan/src/layout/index.tsx index 11c21d776..4e52b68ee 100644 --- a/apps/loan/src/layout/index.tsx +++ b/apps/loan/src/layout/index.tsx @@ -24,7 +24,7 @@ const BaseLayout = ({ children }: { children: React.ReactNode }) => { const layoutHeight = useStore((state) => state.layout.height) const updateConnectState = useStore((state) => state.updateConnectState) - const { locale } = useUserProfileStore() + const locale = useUserProfileStore((state) => state.locale) const [networkSwitch, setNetworkSwitch] = useState('') diff --git a/apps/loan/src/pages/_app.tsx b/apps/loan/src/pages/_app.tsx index e0623f959..d8b1c017f 100644 --- a/apps/loan/src/pages/_app.tsx +++ b/apps/loan/src/pages/_app.tsx @@ -40,7 +40,8 @@ function CurveApp({ Component }: AppProps) { const updateGlobalStoreByKey = useStore((state) => state.updateGlobalStoreByKey) const updateWalletStateByKey = useStore((state) => state.wallet.setStateByKey) - const { locale, theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const locale = useUserProfileStore((state) => state.locale) const [appLoaded, setAppLoaded] = useState(false) diff --git a/apps/main/src/components/AdvancedSettings.tsx b/apps/main/src/components/AdvancedSettings.tsx index 052ddcf00..ee0a00486 100644 --- a/apps/main/src/components/AdvancedSettings.tsx +++ b/apps/main/src/components/AdvancedSettings.tsx @@ -65,7 +65,7 @@ export const AdvancedSettings = ({ testId, }: React.PropsWithChildren) => { const overlayTriggerState = useOverlayTriggerState({}) - const { setMaxSlippage } = useUserProfileStore() + const setMaxSlippage = useUserProfileStore((state) => state.setMaxSlippage) const [formValues, setFormValues] = useState(DEFAULT_FORM_VALUES) diff --git a/apps/main/src/components/ConnectWallet.tsx b/apps/main/src/components/ConnectWallet.tsx index 9c51a00d3..559e78fe0 100644 --- a/apps/main/src/components/ConnectWallet.tsx +++ b/apps/main/src/components/ConnectWallet.tsx @@ -14,7 +14,7 @@ const ConnectWallet: React.FC = ({ description, connectText, const updateConnectWalletStateKeys = useStore((state) => state.wallet.updateConnectWalletStateKeys) const connectState = useStore((state) => state.connectState) - const { theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) const loading = isLoading(connectState) diff --git a/apps/main/src/components/PagePool/PoolDetails/ChartOhlcWrapper/index.tsx b/apps/main/src/components/PagePool/PoolDetails/ChartOhlcWrapper/index.tsx index 2569d4155..08110d762 100644 --- a/apps/main/src/components/PagePool/PoolDetails/ChartOhlcWrapper/index.tsx +++ b/apps/main/src/components/PagePool/PoolDetails/ChartOhlcWrapper/index.tsx @@ -19,7 +19,7 @@ const PoolInfoData: React.FC<{ rChainId: ChainId; pricesApiPoolData: PricesApiPo rChainId, pricesApiPoolData, }) => { - const { theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) const { pricesApiState: { diff --git a/apps/main/src/components/PagePoolList/components/PoolRow.tsx b/apps/main/src/components/PagePoolList/components/PoolRow.tsx index a12759a08..7f568422c 100644 --- a/apps/main/src/components/PagePoolList/components/PoolRow.tsx +++ b/apps/main/src/components/PagePoolList/components/PoolRow.tsx @@ -65,7 +65,7 @@ export const PoolRow: FunctionComponent = ({ const network = useStore((state) => state.networks.networks[rChainId]) const campaignRewardsMapper = useCampaignRewardsMapper() - const { theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) const poolDataCachedOrApi = poolData ?? poolDataCached diff --git a/apps/main/src/components/PageRouterSwap/Page.tsx b/apps/main/src/components/PageRouterSwap/Page.tsx index 62da73cc4..0a3f80523 100644 --- a/apps/main/src/components/PageRouterSwap/Page.tsx +++ b/apps/main/src/components/PageRouterSwap/Page.tsx @@ -34,10 +34,8 @@ const Page: NextPage = () => { const network = useStore((state) => state.networks.networks[rChainId]) const { tokensMapper, tokensMapperStr } = useTokensMapper(rChainId) - const { - maxSlippage: { global: maxSlippage }, - setMaxSlippage, - } = useUserProfileStore() + const maxSlippage = useUserProfileStore((state) => state.maxSlippage.global) + const setMaxSlippage = useUserProfileStore((state) => state.setMaxSlippage) const [loaded, setLoaded] = useState(false) diff --git a/apps/main/src/components/PageRouterSwap/index.tsx b/apps/main/src/components/PageRouterSwap/index.tsx index 8c8b29724..c1c51ab82 100644 --- a/apps/main/src/components/PageRouterSwap/index.tsx +++ b/apps/main/src/components/PageRouterSwap/index.tsx @@ -83,9 +83,7 @@ const QuickSwap = ({ const setSelectToList = useStore((state) => state.quickSwap.setSelectToList) const network = useStore((state) => (chainId ? state.networks.networks[chainId] : null)) - const { - maxSlippage: { global: globalMaxSlippage }, - } = useUserProfileStore() + const globalMaxSlippage = useUserProfileStore((state) => state.maxSlippage.global) const [confirmedLoss, setConfirmedLoss] = useState(false) const [steps, setSteps] = useState([]) diff --git a/apps/main/src/hooks/usePageOnMount.ts b/apps/main/src/hooks/usePageOnMount.ts index 241a685e1..e0917b901 100644 --- a/apps/main/src/hooks/usePageOnMount.ts +++ b/apps/main/src/hooks/usePageOnMount.ts @@ -31,7 +31,7 @@ function usePageOnMount(params: Params, location: Location, navigate: NavigateFu const networksIdMapper = useStore((state) => state.networks.networksIdMapper) const { rChainId } = useNetworkFromUrl() - const { setLocale } = useUserProfileStore() + const setLocale = useUserProfileStore((state) => state.setLocale) const walletChainId = getWalletChainId(wallet) const walletSignerAddress = getWalletSignerAddress(wallet) diff --git a/apps/main/src/layout/default/Header.tsx b/apps/main/src/layout/default/Header.tsx index b0e4a4944..b1b0b8825 100644 --- a/apps/main/src/layout/default/Header.tsx +++ b/apps/main/src/layout/default/Header.tsx @@ -34,7 +34,9 @@ export const Header = ({ sections, BannerProps }: HeaderProps) => { const visibleNetworksList = useStore((state) => state.networks.visibleNetworksList) const bannerHeight = useStore((state) => state.layoutHeight.globalAlert) - const { locale, theme, setTheme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const setTheme = useUserProfileStore((state) => state.setTheme) + const locale = useUserProfileStore((state) => state.locale) const { rChainId, rNetwork, rLocalePathname } = useParamsFromUrl() const { hasRouter } = getNetworkConfigFromApi(rChainId) diff --git a/apps/main/src/layout/default/index.tsx b/apps/main/src/layout/default/index.tsx index 90f6565a4..44749f710 100644 --- a/apps/main/src/layout/default/index.tsx +++ b/apps/main/src/layout/default/index.tsx @@ -25,7 +25,7 @@ const BaseLayout = ({ children }: { children: React.ReactNode }) => { const layoutHeight = useStore((state) => state.layoutHeight) const updateConnectState = useStore((state) => state.updateConnectState) - const { locale } = useUserProfileStore() + const locale = useUserProfileStore((state) => state.locale) const { rChainId, rNetwork } = useNetworkFromUrl() diff --git a/apps/main/src/pages/_app.tsx b/apps/main/src/pages/_app.tsx index ac32d03ac..f7052a822 100644 --- a/apps/main/src/pages/_app.tsx +++ b/apps/main/src/pages/_app.tsx @@ -49,7 +49,8 @@ function CurveApp({ Component }: AppProps) { const updateWalletStoreByKey = useStore((state) => state.wallet.setStateByKey) const network = useStore((state) => state.networks.networks[chainId]) - const { locale, theme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const locale = useUserProfileStore((state) => state.locale) const [appLoaded, setAppLoaded] = useState(false) diff --git a/packages/curve-ui-kit/src/features/user-profile/settings/advanced-mode/AdvancedMode.tsx b/packages/curve-ui-kit/src/features/user-profile/settings/advanced-mode/AdvancedMode.tsx index 7ef890083..8cd29649d 100644 --- a/packages/curve-ui-kit/src/features/user-profile/settings/advanced-mode/AdvancedMode.tsx +++ b/packages/curve-ui-kit/src/features/user-profile/settings/advanced-mode/AdvancedMode.tsx @@ -5,7 +5,8 @@ import { Label, Setting } from '../Setting' import useUserProfileStore from '../../store' export const AdvancedMode = () => { - const { isAdvancedMode, setAdvancedMode } = useUserProfileStore() + const isAdvancedMode = useUserProfileStore((state) => state.isAdvancedMode) + const setAdvancedMode = useUserProfileStore((state) => state.setAdvancedMode) return ( diff --git a/packages/curve-ui-kit/src/features/user-profile/settings/theme-selector/ThemeSelector.tsx b/packages/curve-ui-kit/src/features/user-profile/settings/theme-selector/ThemeSelector.tsx index 560276c9b..7dfc6856c 100644 --- a/packages/curve-ui-kit/src/features/user-profile/settings/theme-selector/ThemeSelector.tsx +++ b/packages/curve-ui-kit/src/features/user-profile/settings/theme-selector/ThemeSelector.tsx @@ -8,7 +8,8 @@ import { Label, Setting } from '../Setting' import useUserProfileStore from '../../store' export const ThemeSelector = () => { - const { theme, setTheme } = useUserProfileStore() + const theme = useUserProfileStore((state) => state.theme) + const setTheme = useUserProfileStore((state) => state.setTheme) return (