Skip to content

Commit 635e306

Browse files
authored
fix crashes from grommet layer (#1380)
1 parent e9b3b0c commit 635e306

File tree

5 files changed

+61
-135
lines changed

5 files changed

+61
-135
lines changed

www/src/components/app/AppMetadataPanel.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ export default function AppMetadataPanel({
2727
return (
2828
<InfoPanel
2929
title="Metadata"
30-
width={388}
31-
marginTop="172px"
3230
contentHeight={140}
3331
contentPadding={16}
3432
contentGap={16}

www/src/components/cluster/ClusterMetadataPanel.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ export default function ClusterMetadataPanel({
2727
return (
2828
<InfoPanel
2929
title="Metadata"
30-
width={388}
31-
marginTop="155px"
3230
contentHeight={442}
3331
contentPadding={16}
3432
contentGap={16}

www/src/components/shell/terminal/actionbar/cheatsheet/Cheatsheet.tsx

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import { Layer } from 'grommet'
2-
import { Card, CloseIcon, IconFrame } from '@pluralsh/design-system'
1+
import { Card, CloseIcon, IconFrame, Modal } from '@pluralsh/design-system'
32
import { Div, Flex, Span } from 'honorable'
43

54
import { CheatsheetCommand } from './CheatsheetCommand'
65

76
function Cheatsheet({ onClose }) {
87
return (
9-
<Layer
10-
plain
11-
animation="fadeIn"
12-
position="bottom-right"
13-
modal={false}
14-
margin={{ bottom: '56x' }}
8+
<Modal
9+
open
10+
onOpenChange={onClose}
1511
>
1612
<Card
1713
fillLevel={2}
@@ -50,7 +46,7 @@ function Cheatsheet({ onClose }) {
5046
</Flex>
5147
<CheatsheetCommands />
5248
</Card>
53-
</Layer>
49+
</Modal>
5450
)
5551
}
5652

+26-75
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
import { useCallback, useContext, useEffect, useState } from 'react'
21
import { useMutation } from '@apollo/client'
3-
import { Box, Layer, Text } from 'grommet'
4-
import {
5-
CloseIcon,
6-
ErrorIcon,
7-
IconFrame,
8-
ReloadIcon,
9-
} from '@pluralsh/design-system'
10-
import moment from 'moment'
2+
import { Button, Flex, SendMessageIcon, Toast } from '@pluralsh/design-system'
3+
import { Box } from 'grommet'
4+
import { useCallback, useContext, useEffect, useState } from 'react'
115
import { useParams } from 'react-router-dom'
126

137
import { useTheme } from 'styled-components'
148

15-
import { useIsCurrentlyOnboarding } from '../shell/hooks/useOnboarded'
169
import CurrentUserContext from '../../contexts/CurrentUserContext'
10+
import { useIsCurrentlyOnboarding } from '../shell/hooks/useOnboarded'
1711
import { Alert, AlertStatus, GqlError } from '../utils/Alert'
1812
import LoadingIndicator from '../utils/LoadingIndicator'
1913

14+
import { LoginPortal } from './LoginPortal'
2015
import { CREATE_RESET_TOKEN, REALIZE_TOKEN } from './queries'
2116
import { ResetTokenType } from './types'
22-
import { LoginPortal } from './LoginPortal'
2317

2418
export function EmailConfirmed() {
2519
const { id } = useParams()
@@ -77,74 +71,31 @@ export function VerifyEmailConfirmed() {
7771
return null
7872

7973
return (
80-
<Layer
81-
plain
82-
modal={false}
74+
<Toast
75+
heading="Email not confirmed"
76+
show={open}
77+
onClose={close}
8378
position="top"
84-
margin={{ top: 'medium' }}
85-
onEsc={close}
86-
onClickOutside={close}
79+
severity="danger"
80+
css={{ marginTop: theme.spacing.medium }}
8781
>
88-
<Box
89-
round="xsmall"
90-
direction="row"
82+
<Flex
9183
gap="small"
92-
background={theme.colors['fill-two']}
93-
color={theme.colors.text}
94-
border={{ color: theme.colors['fill-three'] }}
95-
pad="small"
96-
align="center"
84+
direction="column"
9785
>
98-
<Box
99-
flex={false}
100-
align="center"
86+
<span>
87+
Please confirm your email address to continue using your Plural
88+
account.
89+
</span>
90+
<Button
91+
secondary
92+
startIcon={<SendMessageIcon />}
93+
onClick={() => mutation()}
94+
css={{ width: 'fit-content' }}
10195
>
102-
<ErrorIcon
103-
size={24}
104-
color="error"
105-
/>
106-
</Box>
107-
<Box
108-
fill="horizontal"
109-
align="center"
110-
>
111-
<Text
112-
size="small"
113-
weight={500}
114-
>
115-
Your email is not confirmed
116-
</Text>
117-
{me.emailConfirmBy && (
118-
<Text size="small">
119-
you have {moment(me.emailConfirmBy).fromNow(true)} to confirm your
120-
email
121-
</Text>
122-
)}
123-
</Box>
124-
<Box
125-
flex={false}
126-
gap="xsmall"
127-
direction="row"
128-
align="center"
129-
>
130-
<IconFrame
131-
icon={<ReloadIcon />}
132-
clickable
133-
textValue="Resend"
134-
tooltip
135-
tooltipProps={{ placement: 'bottom' }}
136-
onClick={() => mutation()}
137-
/>
138-
<IconFrame
139-
icon={<CloseIcon />}
140-
clickable
141-
textValue="Close"
142-
tooltip
143-
tooltipProps={{ placement: 'bottom' }}
144-
onClick={() => setOpen(false)}
145-
/>
146-
</Box>
147-
</Box>
148-
</Layer>
96+
Resend confirmation email
97+
</Button>
98+
</Flex>
99+
</Toast>
149100
)
150101
}
+30-47
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import { Card, CloseIcon, IconFrame } from '@pluralsh/design-system'
2-
import { Layer } from 'grommet'
1+
import { CloseIcon, IconFrame, Modal } from '@pluralsh/design-system'
32
import { Div, Flex, Span } from 'honorable'
43
import { ReactNode } from 'react'
54

65
type InfoPanelProps = {
76
title: string
87
onClose?: () => void
9-
width?: number | string
10-
marginTop?: string
118
contentHeight?: number | string
129
contentPadding?: number | string
1310
contentGap?: number | string
@@ -17,58 +14,44 @@ type InfoPanelProps = {
1714
export function InfoPanel({
1815
title,
1916
onClose = () => {},
20-
width = 420,
21-
marginTop = '0',
2217
contentHeight = 300,
2318
contentPadding = 0,
2419
contentGap = 0,
2520
children,
2621
}: InfoPanelProps) {
2722
return (
28-
<Layer
29-
plain
30-
onClickOutside={onClose}
31-
position="top-right"
32-
margin={{ top: marginTop }}
23+
<Modal
24+
open
25+
onOpenChange={onClose}
3326
>
34-
<Card
35-
fillLevel={2}
36-
width={width}
37-
overflow="hidden"
38-
margin="large"
39-
>
40-
<Div
41-
padding="medium"
42-
borderBottom="1px solid border-fill-two"
43-
>
44-
<Flex
45-
align="center"
46-
justify="space-between"
47-
>
48-
<Span
49-
fontSize={18}
50-
fontWeight={500}
51-
lineHeight="24px"
52-
>
53-
{title}
54-
</Span>
55-
<IconFrame
56-
clickable
57-
icon={<CloseIcon />}
58-
onClick={(_) => onClose()}
59-
/>
60-
</Flex>
61-
</Div>
27+
<Div borderBottom="1px solid border-fill-two">
6228
<Flex
63-
direction="column"
64-
overflowY="auto"
65-
gap={contentGap}
66-
padding={contentPadding}
67-
height={contentHeight}
29+
align="center"
30+
justify="space-between"
6831
>
69-
{children}
32+
<Span
33+
fontSize={18}
34+
fontWeight={500}
35+
lineHeight="24px"
36+
>
37+
{title}
38+
</Span>
39+
<IconFrame
40+
clickable
41+
icon={<CloseIcon />}
42+
onClick={(_) => onClose()}
43+
/>
7044
</Flex>
71-
</Card>
72-
</Layer>
45+
</Div>
46+
<Flex
47+
direction="column"
48+
overflowY="auto"
49+
gap={contentGap}
50+
padding={contentPadding}
51+
height={contentHeight}
52+
>
53+
{children}
54+
</Flex>
55+
</Modal>
7356
)
7457
}

0 commit comments

Comments
 (0)