Skip to content

Commit

Permalink
fix: display empty watchlist message and use user preferred currency
Browse files Browse the repository at this point in the history
  • Loading branch information
jmealy committed Feb 6, 2024
1 parent 07267d0 commit 885b9f6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/components/common/Watchlist/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ const Watchlist = ({
</Box>
)}

{!safes && (
<Box display="flex" flexDirection="column" alignItems="center" py={10}>
<Typography variant="body2" color="primary.light" textAlign="center" mt={3}>
{!safes.length && (
<Box display="flex" flexDirection="column" alignItems="center" sx={{ paddingY: '26px' }}>
<Typography variant="body2" color="primary.light" textAlign="center">
Add any Safe account to the watchlist
</Typography>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Watchlist/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
background-color: var(--color-background-paper);
border-radius: 8px;
padding-top: var(--space-3);
padding-bottom: var(--space-2);
padding-bottom: var(--space-3);
margin: var(--space-3) var(--space-2) var(--space-2);
}

Expand Down
1 change: 1 addition & 0 deletions src/hooks/useIsSidebarRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const NO_SIDEBAR_ROUTES = [
AppRoutes.newSafe.load,
AppRoutes.index,
AppRoutes.welcome.index,
AppRoutes.welcome.login,
AppRoutes.welcome.socialLogin,
AppRoutes.imprint,
AppRoutes.privacy,
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/useSafes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import useChains from '@/hooks/useChains'
import { useAppSelector } from '@/store'
import { selectAllAddedSafes } from '@/store/addedSafesSlice'
import useAsync from './useAsync'
import { selectCurrency } from '@/store/settingsSlice'

type SafeListItemDetails = {
chain: ChainInfo
Expand All @@ -26,6 +27,7 @@ export const useWatchedSafes = (): [SafeListItemDetails[], Error | undefined, bo
const currentChainId = useChainId()
const { configs } = useChains()
const watchedSafes = useAppSelector(selectAllAddedSafes)
const currency = useAppSelector(selectCurrency)
const chains = useMemo(() => sortChainsByCurrentChain(configs, currentChainId), [configs, currentChainId])

const [allWatchedSafesWithBalances, error, loading] = useAsync<SafeListItemDetails[]>(
Expand All @@ -41,7 +43,7 @@ export const useWatchedSafes = (): [SafeListItemDetails[], Error | undefined, bo
watchedSafesOnAllChains = [...watchedSafesOnAllChains, ...watchedSafesWithChain]
}
const promises = watchedSafesOnAllChains.map(async ({ safeAddress, chain, threshold, owners }) => {
const fiatBalance = await getBalances(chain.chainId, safeAddress, 'USD').then((result) => result.fiatTotal)
const fiatBalance = await getBalances(chain.chainId, safeAddress, currency).then((result) => result.fiatTotal)
return {
safeAddress,
chain,
Expand Down

0 comments on commit 885b9f6

Please sign in to comment.