Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Seedless Onboarding]: Show Safe list sidebar button on welcome page #2609

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/components/welcome/NewSafe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useAppSelector } from '@/store'
import { selectTotalAdded } from '@/store/addedSafesSlice'

import drawerCSS from '@/components/sidebar/Sidebar/styles.module.css'
import useOwnedSafes from '@/hooks/useOwnedSafes'

const BulletListItem = ({ text }: { text: string }) => (
<li>
Expand All @@ -22,7 +23,10 @@ const BulletListItem = ({ text }: { text: string }) => (
)

const NewSafe = () => {
const addedSafes = useAppSelector(selectTotalAdded)
const numberOfAddedSafes = useAppSelector(selectTotalAdded)
const ownedSafes = useOwnedSafes()
const numberOfOwnedSafes = Object.values(ownedSafes).reduce((acc, curr) => acc + curr.length, 0)
const totalNumberOfSafes = numberOfOwnedSafes + numberOfAddedSafes

const [showSidebar, setShowSidebar] = useState(false)

Expand All @@ -46,7 +50,7 @@ const NewSafe = () => {
<Grid item xs={12} lg={6} flex={1}>
<div className={css.content}>
<Box minWidth={{ md: 480 }} className={css.sidebar}>
{addedSafes > 0 && (
{totalNumberOfSafes > 0 ? (
<Box display="flex" flexDirection="column">
<Box flex={1}>
<Accordion className={css.accordion} onClick={() => setShowSidebar(true)} expanded={false}>
Expand All @@ -56,14 +60,14 @@ const NewSafe = () => {
<ChevronRightIcon />
</IconButton>
<Typography sx={{ mr: 'auto' }} variant="h4" display="inline" fontWeight={700}>
My Safe Accounts ({addedSafes})
My Safe Accounts ({totalNumberOfSafes})
</Typography>
</Box>
</AccordionSummary>
</Accordion>
</Box>
</Box>
)}
) : null}
</Box>

<Typography variant="h1" fontSize={[44, null, 52]} lineHeight={1} letterSpacing={-1.5} color="static.main">
Expand Down