-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: owned Safes in the welcome page sidebar (#943)
* Feat: owned Safes in the welcome page sidebar * Increase title bottom margin
- Loading branch information
Showing
5 changed files
with
56 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,38 @@ | ||
import useChainId from '@/hooks/useChainId' | ||
import { useCurrentChain } from '@/hooks/useChains' | ||
import useOwnedSafes from '@/hooks/useOwnedSafes' | ||
import { List } from '@mui/material' | ||
import { List, Typography } from '@mui/material' | ||
import { type ReactElement } from 'react' | ||
import SafeListItem from '../SafeListItem' | ||
|
||
const OwnedSafes = (): ReactElement | null => { | ||
const chainId = useChainId() | ||
const chain = useCurrentChain() | ||
const allOwnedSafes = useOwnedSafes() | ||
const ownedSafesOnChain = allOwnedSafes[chainId] | ||
const ownedSafesOnChain = chain ? allOwnedSafes[chain.chainId] : undefined | ||
|
||
return ownedSafesOnChain?.length > 0 ? ( | ||
<List sx={{ py: 0 }}> | ||
{ownedSafesOnChain?.map((address) => ( | ||
<SafeListItem | ||
key={address} | ||
address={address} | ||
chainId={chainId} | ||
closeDrawer={() => void null} | ||
shouldScrollToSafe={false} | ||
/> | ||
))} | ||
</List> | ||
) : null | ||
if (!chain || !ownedSafesOnChain?.length) { | ||
return null | ||
} | ||
|
||
return ( | ||
<> | ||
<Typography variant="body2" display="inline" color="primary.light" textAlign="center" mt={1} mb={2}> | ||
Safes owned on {chain.chainName} | ||
</Typography> | ||
|
||
<List sx={{ py: 0 }}> | ||
{ownedSafesOnChain?.map((address) => ( | ||
<SafeListItem | ||
key={address} | ||
address={address} | ||
chainId={chain.chainId} | ||
closeDrawer={() => void null} | ||
shouldScrollToSafe={false} | ||
noActions | ||
/> | ||
))} | ||
</List> | ||
</> | ||
) | ||
} | ||
|
||
export default OwnedSafes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
|
||
.safe { | ||
border-radius: 8px; | ||
padding-left: 22px; | ||
} | ||
|
||
.open { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters