Repository navigation
Expand file tree
/
Copy pathdefault-dashboard.tsx
More file actions
185 lines (173 loc) · 5.74 KB
/
Copy pathdefault-dashboard.tsx
File metadata and controls
185 lines (173 loc) · 5.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
import React from 'react'
import { Box, Button, H2, H5, Illustration, IllustrationProps, Text } from '@adminjs/design-system'
import { styled } from '@adminjs/design-system/styled-components'
import { useTranslation } from '../../hooks/index.js'
import RocketSVG from './utils/rocket-svg.js'
import DiscordLogo from './utils/discord-logo-svg.js'
const pageHeaderHeight = 300
const pageHeaderPaddingY = 74
const pageHeaderPaddingX = 250
export const DashboardHeader: React.FC = () => {
const { translateMessage } = useTranslation()
return (
<Box data-css="default-dashboard">
<Box
position="relative"
overflow="hidden"
bg="white"
height={pageHeaderHeight}
py={pageHeaderPaddingY}
px={['default', 'lg', pageHeaderPaddingX]}
>
<Box position="absolute" top={30} left={0} opacity={0.9} animate display={['none', 'none', 'none', 'block']}>
<RocketSVG />
</Box>
<Text textAlign="center" color="grey100">
<H2 fontWeight="bold">{translateMessage('welcomeOnBoard_title')}</H2>
<Text opacity={0.8}>{translateMessage('welcomeOnBoard_subtitle')}</Text>
</Text>
</Box>
</Box>
)
}
type BoxType = {
variant: string
title: string
subtitle: string
href: string
}
const boxes = ({ translateMessage }): Array<BoxType> => [
{
variant: 'Details',
title: translateMessage('addingResources_title'),
subtitle: translateMessage('addingResources_subtitle'),
href: 'https://docs.adminjs.co/basics/resource#providing-resources-explicitly',
},
{
variant: 'Docs',
title: translateMessage('customizeResources_title'),
subtitle: translateMessage('customizeResources_subtitle'),
href: 'https://docs.adminjs.co/basics/resource#customizing-resources',
},
{
variant: 'Plug',
title: translateMessage('customizeActions_title'),
subtitle: translateMessage('customizeActions_subtitle'),
href: 'https://docs.adminjs.co/basics/action',
},
{
variant: 'Cup',
title: translateMessage('writeOwnComponents_title'),
subtitle: translateMessage('writeOwnComponents_subtitle'),
href: 'https://docs.adminjs.co/ui-customization/writing-your-own-components',
},
{
variant: 'Photos',
title: translateMessage('customDashboard_title'),
subtitle: translateMessage('customDashboard_subtitle'),
href: 'https://docs.adminjs.co/ui-customization/dashboard-customization',
},
{
variant: 'IdentityCard',
title: translateMessage('roleBasedAccess_title'),
subtitle: translateMessage('roleBasedAccess_subtitle'),
href: 'https://docs.adminjs.co/tutorials/adding-role-based-access-control',
},
]
const Card = styled(Box)`
display: ${({ flex }): string => (flex ? 'flex' : 'block')};
color: ${({ theme }) => theme.colors.grey100};
height: 100%;
text-decoration: none;
border: 1px solid transparent;
border-radius: ${({ theme }) => theme.space.md};
transition: all 0.1s ease-in;
&:hover {
border: 1px solid ${({ theme }) => theme.colors.primary60};
box-shadow: ${({ theme }) => theme.shadows.cardHover};
}
& .dsc-icon svg, .gh-icon svg {
width: 64px;
height: 64px;
}
`
Card.defaultProps = {
variant: 'container',
boxShadow: 'card',
}
export const Dashboard: React.FC = () => {
const { translateMessage, translateButton } = useTranslation()
return (
<Box>
<DashboardHeader />
<Box
mt={['xl', 'xl', '-100px']}
mb="xl"
mx={[0, 0, 0, 'auto']}
px={['default', 'lg', 'xxl', '0']}
position="relative"
flex
flexDirection="row"
flexWrap="wrap"
width={[1, 1, 1, 1024]}
>
{boxes({ translateMessage }).map((box, index) => (
// eslint-disable-next-line react/no-array-index-key
<Box key={index} width={[1, 1 / 2, 1 / 2, 1 / 3]} p="lg">
<Card as="a" href={box.href} target="_blank">
<Text textAlign="center">
<Illustration
variant={box.variant as IllustrationProps['variant']}
width={100}
height={70}
/>
<H5 mt="md">{box.title}</H5>
<Text>{box.subtitle}</Text>
</Text>
</Card>
</Box>
))}
<Card width={1} m="lg">
<Text textAlign="center">
<Illustration variant="AdminJSLogo" />
<H5>{translateMessage('needMoreSolutions_title')}</H5>
<Text>{translateMessage('needMoreSolutions_subtitle')}</Text>
<Text mt="xxl">
<Button as="a" variant="contained" href="https://forms.adminjs.co/" target="_blank">
{translateButton('contactUs')}
</Button>
</Text>
</Text>
</Card>
<Box width={[1, 1, 1 / 2]} p="lg">
<Card as="a" flex href="https://adminjs.page.link/discord" target="_blank">
<Box flexShrink={0} className="dsc-icon">
<DiscordLogo />
</Box>
<Box ml="xl">
<H5>{translateMessage('community_title')}</H5>
<Text>{translateMessage('community_subtitle')}</Text>
</Box>
</Card>
</Box>
<Box width={[1, 1, 1 / 2]} p="lg">
<Card
as="a"
flex
href="https://github.com/SoftwareBrothers/adminjs/issues"
target="_blank"
>
<Box flexShrink={0} className="gh-icon">
<Illustration variant="GithubLogo" />
</Box>
<Box ml="xl">
<H5>{translateMessage('foundBug_title')}</H5>
<Text>{translateMessage('foundBug_subtitle')}</Text>
</Box>
</Card>
</Box>
</Box>
</Box>
)
}
export default Dashboard