-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathindex.tsx
More file actions
161 lines (155 loc) · 5.28 KB
/
index.tsx
File metadata and controls
161 lines (155 loc) · 5.28 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
import React from 'react';
import { useIntl } from 'react-intl';
import isEmpty from 'lodash/isEmpty';
import {
Typography, Grid, Flex, Link,
Card,
CardBody,
CardTitle,
CardSubtitle,
CardContent,
Box,
} from '@strapi/design-system';
import { ExternalLink, PuzzlePiece } from '@strapi/icons';
import { Page, getFetchClient, Layouts } from '@strapi/strapi/admin';
import { useQuery } from 'react-query';
import pluginPermissions from '../../permissions';
import { WebtoolsAddonInfo } from '../../types/addons';
import packageJson from '../../../package.json';
import Loader from '../../components/Loader';
const List = () => {
const { get } = getFetchClient();
const addons = useQuery('addons', async () => get<WebtoolsAddonInfo[]>('/webtools/info/addons'));
const { formatMessage } = useIntl();
if (addons.isLoading) {
return (
<Loader />
);
}
return (
<Page.Protect permissions={pluginPermissions['settings.overview']}>
<Layouts.Header
title={formatMessage({ id: 'webtools.settings.page.overview.title', defaultMessage: 'Overview' })}
subtitle={formatMessage({ id: 'webtools.settings.page.overview.description', defaultMessage: 'Webtools global information' })}
/>
<Layouts.Content>
<Flex direction="column" alignItems="stretch" gap={6}>
<Flex
direction="column"
alignItems="stretch"
gap={4}
hasRadius
background="neutral0"
shadow="tableShadow"
paddingTop={6}
paddingBottom={6}
paddingRight={7}
paddingLeft={7}
>
<Typography variant="delta">
{formatMessage({
id: 'global.details',
defaultMessage: 'Details',
})}
</Typography>
<Grid.Root gap={5}>
<Grid.Item col={6} s={12} direction="column" alignItems="flex-start">
<Typography variant="sigma" textColor="neutral600">
{formatMessage({
id: 'webtools.settings.application.strapiVersion',
defaultMessage: 'Strapi version',
})}
</Typography>
<Flex gap={3} direction="column" alignItems="start">
<Typography>v{packageJson.version}</Typography>
</Flex>
</Grid.Item>
<Grid.Item col={6} s={12} direction="column" alignItems="flex-start">
<Typography variant="sigma" textColor="neutral600">
{formatMessage({
id: 'webtools.settings.links',
defaultMessage: 'Links',
})}
</Typography>
<Flex>
<Link
href="https://www.pluginpal.io/plugin/webtools"
isExternal
endIcon={<ExternalLink />}
>
{formatMessage({
id: 'webtools.settings.website',
defaultMessage: 'Website',
})}
</Link>
</Flex>
<Flex>
<Link
href="https://github.com/pluginpal/strapi-webtools"
isExternal
endIcon={<ExternalLink />}
>
{formatMessage({
id: 'webtools.settings.github',
defaultMessage: 'Github',
})}
</Link>
</Flex>
</Grid.Item>
</Grid.Root>
</Flex>
</Flex>
{!isEmpty(addons.data.data) && (
<Flex
direction="column"
alignItems="stretch"
hasRadius
background="neutral0"
shadow="tableShadow"
paddingTop={6}
paddingBottom={6}
paddingRight={7}
paddingLeft={7}
marginTop={6}
>
<Typography variant="delta">
{formatMessage({
id: 'webtools.settings.addons.title',
defaultMessage: 'Addons',
})}
</Typography>
<Typography variant="pi" textColor="neutral600">
{formatMessage(
{
id: 'webtools.settings.addons.description',
defaultMessage: 'All the installed addons',
},
)}
</Typography>
<Flex marginTop={4}>
{Object.values(addons.data.data).map((addon) => (
<Card
style={{
width: '240px',
}}
id="fourth"
>
<CardBody>
<Box padding={2} background="primary100">
<PuzzlePiece />
</Box>
<CardContent paddingLeft={2}>
<CardTitle>{addon.info.addonName}</CardTitle>
<CardSubtitle>{addon.info.description}</CardSubtitle>
</CardContent>
</CardBody>
</Card>
))}
</Flex>
</Flex>
)}
</Layouts.Content>
</Page.Protect>
);
};
export default List;