Skip to content

Commit

Permalink
type title as ReactNode and rename flag to isOnWatchlist
Browse files Browse the repository at this point in the history
  • Loading branch information
jmealy committed Feb 15, 2024
1 parent 203d467 commit 77a3732
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/components/welcome/MyAccounts/PaginatedSafeList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReactElement } from 'react'
import type { ReactElement, ReactNode } from 'react'
import { useMemo, useState } from 'react'
import { Button, Box, Paper, Typography } from '@mui/material'
import AccountItem from './AccountItem'
Expand All @@ -9,7 +9,7 @@ import css from './styles.module.css'

type PaginatedSafeListProps = {
safes: SafeItems
title: ReactElement
title: ReactNode
safeCount?: number
action?: ReactElement
onLinkClick?: () => void
Expand All @@ -20,7 +20,7 @@ const MAX_DEFAULT_SHOWN = 7
const PAGE_SIZE = 5

const PaginatedSafeList = ({ safes, title, action, safeCount, onLinkClick }: PaginatedSafeListProps) => {
const [maxShownSafes, setMaxSafes] = useState<number>(DEFAULT_SHOWN)
const [maxShownSafes, setMaxShownSafes] = useState<number>(DEFAULT_SHOWN)

const shownSafes = useMemo(() => {
if (safes.length <= MAX_DEFAULT_SHOWN) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/welcome/MyAccounts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type AccountsListProps = {
onLinkClick?: () => void
}
const AccountsList = ({ safes, onLinkClick }: AccountsListProps) => {
const ownedSafes = useMemo(() => safes.filter(({ isWatchlist }) => !isWatchlist), [safes])
const watchlistSafes = useMemo(() => safes.filter(({ isWatchlist }) => isWatchlist), [safes])
const ownedSafes = useMemo(() => safes.filter(({ isOnWatchlist }) => !isOnWatchlist), [safes])
const watchlistSafes = useMemo(() => safes.filter(({ isOnWatchlist }) => isOnWatchlist), [safes])

return (
<Box className={css.container}>
Expand All @@ -31,7 +31,7 @@ const AccountsList = ({ safes, onLinkClick }: AccountsListProps) => {
</Box>

<PaginatedSafeList
title={<span>My accounts</span>}
title="My accounts"
safes={ownedSafes}
safeCount={ownedSafes.length}
onLinkClick={onLinkClick}
Expand Down
4 changes: 2 additions & 2 deletions src/components/welcome/MyAccounts/useAllSafes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import useWallet from '@/hooks/wallets/useWallet'
export type SafeItems = Array<{
chainId: string
address: string
isWatchlist: boolean
isOnWatchlist: boolean
threshold?: number
owners?: number
}>
Expand Down Expand Up @@ -48,7 +48,7 @@ const useAllSafes = (): SafeItems => {
return uniqueAddresses.map((address) => ({
address,
chainId,
isWatchlist: !(ownedOnChain || []).includes(address),
isOnWatchlist: !(ownedOnChain || []).includes(address),
threshold: allAdded[chainId]?.[address]?.threshold,
owners: allAdded[chainId]?.[address]?.owners.length,
}))
Expand Down

0 comments on commit 77a3732

Please sign in to comment.