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

fix: Create safe layout adjustments #997

Merged
merged 3 commits into from
Oct 28, 2022
Merged
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
2 changes: 1 addition & 1 deletion src/components/common/NetworkSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const NetworkSelector = (): ReactElement => {

trackEvent({ ...OVERVIEW_EVENTS.SWITCH_NETWORK, label: selectedChainId })

const shouldKeepPath = [AppRoutes.load, AppRoutes.open].includes(router.pathname)
const shouldKeepPath = [AppRoutes.load, AppRoutes.open, AppRoutes.createSafe].includes(router.pathname)

const newRoute = {
pathname: shouldKeepPath ? router.pathname : '/',
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/PageLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { AppRoutes } from '@/config/routes'
const PageLayout = ({ children }: { children: ReactElement }): ReactElement => {
const router = useRouter()
const [isMobileDrawerOpen, setIsMobileDrawerOpen] = useState<boolean>(false)
const hideSidebar = router.pathname === AppRoutes.share.safeApp
const hideSidebar = [AppRoutes.share.safeApp, AppRoutes.createSafe].includes(router.pathname)

const onMenuToggle = (): void => {
setIsMobileDrawerOpen((prev) => !prev)
Expand Down
2 changes: 1 addition & 1 deletion src/components/new-safe/CardStepper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function CardStepper<StepperData>(props: TxStepperProps<StepperData>) {
const { activeStep, onSubmit, onBack, stepData, setStep } = useCardStepper<StepperData>(props)
const { steps } = props
const currentStep = steps[activeStep]
const progress = (activeStep + 1 / steps.length) * 100
const progress = ((activeStep + 1) / steps.length) * 100
DiogoSoaress marked this conversation as resolved.
Show resolved Hide resolved

return (
<Card className={css.card}>
Expand Down
62 changes: 30 additions & 32 deletions src/components/new-safe/CreateSafe/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useAddressBook from '@/hooks/useAddressBook'
import CreateSafeStep2 from '../steps/Step2'
import { CardStepper } from '../CardStepper'
import Grid from '@mui/material/Grid'
import { Card, CardContent, Typography } from '@mui/material'
import { Card, CardContent, Container, Typography } from '@mui/material'
import { useRouter } from 'next/router'
import { AppRoutes } from '@/config/routes'
import { CREATE_SAFE_CATEGORY } from '@/services/analytics'
Expand Down Expand Up @@ -61,40 +61,38 @@ const CreateSafe = () => {
...(wallet && chain ? [{ title: 'Wallet', component: <WalletInfo wallet={wallet} chain={chain} /> }] : []),
]

// TODO: Improve layout when other widget/responsive design is ready
return (
<Grid container spacing={3}>
<Grid item xs={1} />
<Grid item xs={11}>
<Typography variant="h2" pb={2}>
Create new Safe
</Typography>
</Grid>
<Container>
<Grid container columnSpacing={3} justifyContent="center" mt={[2, null, 7]}>
<Grid item xs={12}>
<Typography variant="h2" pb={2}>
Create new Safe
</Typography>
</Grid>
<Grid item xs={12} md={8} order={[1, null, 0]}>
{wallet?.address ? (
<CardStepper
initialData={initialData}
onClose={onClose}
steps={CreateSafeSteps}
eventCategory={CREATE_SAFE_CATEGORY}
/>
) : (
<Card>
<CardContent>
<Typography variant="h3" fontWeight={700}>
You need to connect a wallet to create a new Safe.
</Typography>
</CardContent>
</Card>
)}
</Grid>

<Grid item xs={1} />
<Grid item xs={12} md={6}>
{wallet?.address ? (
<CardStepper
initialData={initialData}
onClose={onClose}
steps={CreateSafeSteps}
eventCategory={CREATE_SAFE_CATEGORY}
/>
) : (
<Card>
<CardContent>
<Typography variant="h3" fontWeight={700}>
You need to connect a wallet to create a new Safe.
</Typography>
</CardContent>
</Card>
)}
</Grid>
<Grid item xs={12} md={4}>
{wallet?.address && <OverviewWidget rows={rows} />}
<Grid item xs={12} md={4} mb={[3, null, 0]} order={[0, null, 1]}>
{wallet?.address && <OverviewWidget rows={rows} />}
</Grid>
</Grid>
<Grid item xs={1} />
</Grid>
</Container>
)
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/new-safe/steps/Step1/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function CreateSafeStep1({
return (
<form onSubmit={handleSubmit(onSubmit)} id={STEP_1_FORM_ID} className={css.form}>
<Grid container spacing={3}>
<Grid item xs={6}>
<Grid item>
<Box className={css.select}>
<Typography color="text.secondary" pl={2}>
Network
Expand Down Expand Up @@ -86,7 +86,7 @@ function CreateSafeStep1({
{...register(CreateSafeStep1Fields.name)}
/>

<Typography variant="body2">
<Typography variant="body2" mt={3}>
By continuing, you agree to our{' '}
<Link href="https://gnosis-safe.io/terms" target="_blank" rel="noopener noreferrer" fontWeight={700}>
terms of use
Expand Down