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

feat(Safenet): Add Safenet opt-in flow #4791

Draft
wants to merge 2 commits into
base: safenet
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions apps/web/public/images/logo-safenet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 19 additions & 10 deletions apps/web/src/components/dashboard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import FirstSteps from '@/components/dashboard/FirstSteps'
import useSafeInfo from '@/hooks/useSafeInfo'
import { type ReactElement } from 'react'
import dynamic from 'next/dynamic'
import { Grid } from '@mui/material'
import PendingTxsList from '@/components/dashboard/PendingTxs/PendingTxsList'
import AssetsWidget from '@/components/dashboard/Assets'
import FirstSteps from '@/components/dashboard/FirstSteps'
import GovernanceSection from '@/components/dashboard/GovernanceSection/GovernanceSection'
import Overview from '@/components/dashboard/Overview/Overview'
import PendingTxsList from '@/components/dashboard/PendingTxs/PendingTxsList'
import SafeAppsDashboardSection from '@/components/dashboard/SafeAppsDashboardSection/SafeAppsDashboardSection'
import GovernanceSection from '@/components/dashboard/GovernanceSection/GovernanceSection'
import { useIsRecoverySupported } from '@/features/recovery/hooks/useIsRecoverySupported'
import StakingBanner from '@/components/dashboard/StakingBanner'
import { InconsistentSignerSetupWarning } from '@/features/multichain/components/SignerSetupWarning/InconsistentSignerSetupWarning'
import { useIsRecoverySupported } from '@/features/recovery/hooks/useIsRecoverySupported'
import { SafenetHeader } from '@/features/safenet/SafenetHeader'
import useIsStakingBannerEnabled from '@/features/stake/hooks/useIsStakingBannerEnabled'
import { useHasFeature } from '@/hooks/useChains'
import useIsSafenetEnabled from '@/hooks/useIsSafenetEnabled'
import useSafeInfo from '@/hooks/useSafeInfo'
import { FEATURES } from '@/utils/chains'
import { Grid } from '@mui/material'
import dynamic from 'next/dynamic'
import { type ReactElement } from 'react'
import css from './styles.module.css'
import { InconsistentSignerSetupWarning } from '@/features/multichain/components/SignerSetupWarning/InconsistentSignerSetupWarning'
import useIsStakingBannerEnabled from '@/features/stake/hooks/useIsStakingBannerEnabled'

const RecoveryHeader = dynamic(() => import('@/features/recovery/components/RecoveryHeader'))

Expand All @@ -23,6 +25,7 @@ const Dashboard = (): ReactElement => {
const showSafeApps = useHasFeature(FEATURES.SAFE_APPS)
const isStakingBannerEnabled = useIsStakingBannerEnabled()
const supportsRecovery = useIsRecoverySupported()
const isSafenetEnabled = useIsSafenetEnabled()

return (
<>
Expand All @@ -33,6 +36,12 @@ const Dashboard = (): ReactElement => {
<InconsistentSignerSetupWarning />
</Grid>

{!isSafenetEnabled && (
<Grid item xs={12}>
<SafenetHeader />
</Grid>
)}

<Grid item xs={12}>
<Overview />
</Grid>
Expand Down
39 changes: 39 additions & 0 deletions apps/web/src/features/safenet/SafenetHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import darkPalette from '@/components/theme/darkPalette'
import lightPalette from '@/components/theme/lightPalette'
import SafenetLogo from '@/public/images/logo-safenet.svg'
import { Box, Button, Grid, Typography } from '@mui/material'
import { useTheme } from '@mui/material/styles'
import css from './styles.module.css'

export const SafenetHeader = () => {
const { palette } = useTheme()

return (
<Grid className={palette.mode === 'dark' ? css.darkBanner : css.lightBanner}>
<Box className={css.title}>
<Typography
variant="h1"
sx={{
fontSize: 40,
color: darkPalette.text.primary,
}}
>
UPDAGRADE TO
</Typography>
<SafenetLogo />
</Box>
<Typography color={darkPalette.text.primary}>
Supercharge your finances by enjoying a unified experience across networks while keeping the main treasury
secured.
</Typography>
<Button
className={css.bannerButton}
sx={{
color: lightPalette.text.primary,
}}
>
Learn more
</Button>
</Grid>
)
}
40 changes: 40 additions & 0 deletions apps/web/src/features/safenet/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.lightBanner,
.darkBanner {
align-items: flex-start;
border: 2px solid transparent;
border-radius: 16px;
display: flex;
flex-direction: column;
gap: var(--space-2);
padding: var(--space-4);
}

.lightBanner {
background: radial-gradient(94.6% 266.69% at 95.54% 76.33%, #003F54 0%, #000000 100%);
}

.darkBanner {
background-image:
radial-gradient(94.6% 266.69% at 95.54% 76.33%, #003F54 0%, #000000 100%),
radial-gradient(119.01% 132.63% at 119.01% -14.15%, #FF5F00 0%, #FFD200 50%, #12FF80 100%);
background-origin: border-box;
background-clip: padding-box, border-box;
}

.title {
align-items: center;
display: flex;
flex-direction: row;
gap: var(--space-2);
}

.bannerButton {
background: radial-gradient(119.01% 132.63% at 119.01% -14.15%, #FF5F00 0%, #FFD200 50%, #12FF80 100%);
}

@media (max-width: 700px) {
.title {
align-items: flex-start;
flex-direction: column;
}
}
Loading