diff --git a/src/components/dashboard/FirstSteps/index.tsx b/src/components/dashboard/FirstSteps/index.tsx index b71b9fe1f2..39cff414f7 100644 --- a/src/components/dashboard/FirstSteps/index.tsx +++ b/src/components/dashboard/FirstSteps/index.tsx @@ -1,27 +1,12 @@ import useBalances from '@/hooks/useBalances' import { useAppSelector } from '@/store' import { selectOutgoingTransactions } from '@/store/txHistorySlice' -import { type ReactNode, useMemo } from 'react' +import { useMemo } from 'react' import { Card, WidgetBody, WidgetContainer } from '@/components/dashboard/styled' -import { LinearProgress, List, ListItem, ListItemIcon, Typography } from '@mui/material' +import { Button, CircularProgress, Grid, Link, Typography } from '@mui/material' import CircleOutlinedIcon from '@mui/icons-material/CircleOutlined' import CheckCircleRoundedIcon from '@mui/icons-material/CheckCircleRounded' - -const StatusItem = ({ children, completed = false }: { children: ReactNode; completed?: boolean }) => { - return ( - - theme.palette.primary.main }}> - {completed ? : } - - {children} - - ) -} - -type StatusProgressItems = Array<{ - name: string - completed: boolean -}> +import css from './styles.module.css' const calculateProgress = (items: StatusProgressItems) => { const totalNumberOfItems = items.length @@ -29,34 +14,59 @@ const calculateProgress = (items: StatusProgressItems) => { return Math.round((completedItems.length / totalNumberOfItems) * 100) } -const StatusProgress = ({ items }: { items: StatusProgressItems }) => { - const progress = calculateProgress(items) - +const StatusCard = ({ + badge, + step, + title, + content, + completed, +}: { + badge: string + step: number + title: string + content: string + completed: boolean +}) => { return ( - <> - - {items.map(({ name, completed }) => { - return ( - - {name} - - ) - })} - - - - {progress}% completed + +
+ {badge} +
+
+ {completed ? ( + + ) : ( + + )} +
+ + {step} + {title} - + {content} +
) } -enum FirstStepNames { - AddFunds = 'Add funds', - CreateFirstTx = 'Create your first transaction', - SafeReady = 'Safe is ready', +type StatusProgressItem = { + title: string + content: string + completed?: boolean } +type StatusProgressItems = Array + +const FirstStepsContent: StatusProgressItems = [ + { + title: 'Add funds', + content: 'Receive assets to start interacting with your account.', + }, + { + title: 'Create your first transaction', + content: 'Do a simple transfer or use a safe app to create your first transaction.', + }, +] + const FirstSteps = () => { const { balances } = useBalances() const outgoingTransactions = useAppSelector(selectOutgoingTransactions) @@ -66,22 +76,81 @@ const FirstSteps = () => { const items = useMemo( () => [ - { name: FirstStepNames.AddFunds, completed: hasNonZeroBalance }, - { name: FirstStepNames.CreateFirstTx, completed: hasOutgoingTransactions }, - { name: FirstStepNames.SafeReady, completed: hasNonZeroBalance && hasOutgoingTransactions }, + { ...FirstStepsContent[0], completed: hasNonZeroBalance }, + { ...FirstStepsContent[1], completed: hasOutgoingTransactions }, ], [hasNonZeroBalance, hasOutgoingTransactions], ) + const activateAccount = () => { + // TODO: Open safe deployment flow + } + + const progress = calculateProgress(items) + const stepsCompleted = items.filter((item) => item.completed).length + const isCounterfactual = false // TODO: Add real check here + + if (!isCounterfactual) return null + return ( - - - First steps - - - + + + + + + + + Activate your Safe Account + + + + {stepsCompleted} of {items.length} steps completed. + {' '} + {progress === 100 ? ( + <> + Congratulations! You finished the first steps. Hide this section + + ) : ( + 'Finish the next steps to start using all Safe Account features:' + )} + + + + + {items.map((item, index) => { + return ( + + + + ) + })} + + + + + Skip first steps + + Pay a network fee to immediately access all Safe Account features. + + + + ) diff --git a/src/components/dashboard/FirstSteps/styles.module.css b/src/components/dashboard/FirstSteps/styles.module.css new file mode 100644 index 0000000000..5462677854 --- /dev/null +++ b/src/components/dashboard/FirstSteps/styles.module.css @@ -0,0 +1,43 @@ +.circleProgress { + color: var(--color-secondary-main); +} + +.circleBg { + color: var(--color-border-light); + position: absolute; +} + +.circleBadge { + width: 24px; + height: 24px; + border-radius: 50%; + background-color: var(--color-secondary-light); + text-align: center; + font-weight: normal; + font-size: 16px; + display: inline-block; + margin-right: var(--space-1); +} + +.card { + display: flex; + flex-direction: column; + justify-content: flex-end; + align-items: flex-start; + min-height: 240px; +} + +.topBadge { + position: absolute; + top: 0; + right: 24px; + background-color: var(--color-secondary-light); + border-radius: 0 0 4px 4px; + padding: 4px var(--space-1); +} + +.status { + align-self: flex-start; + margin-bottom: auto; + color: var(--color-border-light); +} diff --git a/src/components/dashboard/index.tsx b/src/components/dashboard/index.tsx index 6ae0f9f838..77d1e59239 100644 --- a/src/components/dashboard/index.tsx +++ b/src/components/dashboard/index.tsx @@ -34,11 +34,7 @@ const Dashboard = (): ReactElement => { - - - - - +