-
-
Notifications
You must be signed in to change notification settings - Fork 656
/
HealthStats.tsx
312 lines (309 loc) · 11.4 KB
/
HealthStats.tsx
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
import { VFC } from 'react';
import { useThemeMode } from 'hooks/useThemeMode';
import { useTheme } from '@mui/material';
interface IHealthStatsProps {
value?: string | number;
healthy: number;
stale: number;
potentiallyStale: number;
}
export const HealthStats: VFC<IHealthStatsProps> = ({
value,
healthy,
stale,
potentiallyStale,
}) => {
const { themeMode } = useThemeMode();
const isDark = themeMode === 'dark';
const theme = useTheme();
return (
<svg
viewBox='0 0 268 281'
fill='none'
xmlns='http://www.w3.org/2000/svg'
>
<title>Health Stats</title>
<g filter={!isDark ? 'url(#filter0_d_22043_268578)' : undefined}>
<circle
cx='134'
cy='129'
r='97'
fill={theme.palette.charts.health.mainCircleBackground}
/>
</g>
<circle
cx='134'
cy='129'
r='121'
stroke={theme.palette.charts.health.orbit}
strokeWidth='3'
/>
<text
x={134}
y={149}
textAnchor='middle'
fontSize={48}
fill={theme.palette.charts.health.title}
fontWeight={700}
>
{value !== undefined ? `${value}%` : 'N/A'}
</text>
<g filter={!isDark ? 'url(#filter1_d_22043_268578)' : undefined}>
<circle
cx='206'
cy='58'
r='50'
fill={theme.palette.charts.health.circles}
/>
</g>
<text
x={206}
y={56}
fill={theme.palette.charts.health.healthy}
fontWeight={700}
fontSize={20}
textAnchor='middle'
>
{healthy || 0}
</text>
<text
x={206}
y={72}
fill={theme.palette.charts.health.text}
fontSize={13}
textAnchor='middle'
>
Healthy
</text>
<g filter={!isDark ? 'url(#filter2_d_22043_268578)' : undefined}>
<circle
cx='53'
cy='66'
r='41'
fill={theme.palette.charts.health.circles}
/>
</g>
<text
x={53}
y={65}
fill={theme.palette.charts.health.stale}
fontWeight={700}
fontSize={20}
textAnchor='middle'
>
{stale || 0}
</text>
<text
x={53}
y={81}
fill={theme.palette.charts.health.text}
fontSize={13}
textAnchor='middle'
>
Stale
</text>
<g filter={!isDark ? 'url(#filter3_d_22043_268578)' : undefined}>
<circle
cx='144'
cy='224'
r='41'
fill={theme.palette.charts.health.circles}
/>
</g>
<text
x={144}
y={216}
fill={theme.palette.charts.health.potentiallyStale}
fontWeight={700}
fontSize={20}
textAnchor='middle'
>
{potentiallyStale || 0}
</text>
<text
x={144}
y={232}
fill={theme.palette.charts.health.text}
fontSize={13}
textAnchor='middle'
>
<tspan x={144} dy='0'>
Potentially
</tspan>
<tspan x={144} dy='1.2em'>
stale
</tspan>
</text>
<path
d='M99.5 247.275C99.5 251.693 103.082 255.275 107.5 255.275C111.918 255.275 115.5 251.693 115.5 247.275C115.5 242.857 111.918 239.275 107.5 239.275C103.082 239.275 99.5 242.857 99.5 247.275ZM10.8811 92C10.8811 96.4183 14.4629 100 18.8811 100C23.2994 100 26.8811 96.4183 26.8811 92C26.8811 87.5817 23.2994 84 18.8811 84C14.4629 84 10.8811 87.5817 10.8811 92ZM107.827 245.811C54.4151 233.886 14.5 186.258 14.5 129.325H11.5C11.5 187.696 52.4223 236.515 107.173 248.739L107.827 245.811ZM14.5 129.325C14.5 116.458 16.5379 104.07 20.3078 92.4634L17.4545 91.5366C13.5886 103.439 11.5 116.14 11.5 129.325H14.5Z'
fill='url(#paint0_linear_22043_268578)'
/>
<defs>
<filter
id='filter0_d_22043_268578'
x='15'
y='13'
width='238'
height='238'
filterUnits='userSpaceOnUse'
colorInterpolationFilters='sRGB'
>
<feFlood floodOpacity='0' result='BackgroundImageFix' />
<feColorMatrix
in='SourceAlpha'
type='matrix'
values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'
result='hardAlpha'
/>
<feMorphology
radius='2'
operator='dilate'
in='SourceAlpha'
result='effect1_dropShadow_22043_268578'
/>
<feOffset dy='3' />
<feGaussianBlur stdDeviation='10' />
<feComposite in2='hardAlpha' operator='out' />
<feColorMatrix
type='matrix'
values='0 0 0 0 0.505882 0 0 0 0 0.478431 0 0 0 0 0.996078 0 0 0 0.36 0'
/>
<feBlend
mode='normal'
in2='BackgroundImageFix'
result='effect1_dropShadow_22043_268578'
/>
<feBlend
mode='normal'
in='SourceGraphic'
in2='effect1_dropShadow_22043_268578'
result='shape'
/>
</filter>
<filter
id='filter1_d_22043_268578'
x='144'
y='0'
width='124'
height='124'
filterUnits='userSpaceOnUse'
colorInterpolationFilters='sRGB'
>
<feFlood floodOpacity='0' result='BackgroundImageFix' />
<feColorMatrix
in='SourceAlpha'
type='matrix'
values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'
result='hardAlpha'
/>
<feOffset dy='4' />
<feGaussianBlur stdDeviation='6' />
<feComposite in2='hardAlpha' operator='out' />
<feColorMatrix
type='matrix'
values='0 0 0 0 0.380392 0 0 0 0 0.356863 0 0 0 0 0.760784 0 0 0 0.16 0'
/>
<feBlend
mode='normal'
in2='BackgroundImageFix'
result='effect1_dropShadow_22043_268578'
/>
<feBlend
mode='normal'
in='SourceGraphic'
in2='effect1_dropShadow_22043_268578'
result='shape'
/>
</filter>
<filter
id='filter2_d_22043_268578'
x='0'
y='17'
width='106'
height='106'
filterUnits='userSpaceOnUse'
colorInterpolationFilters='sRGB'
>
<feFlood floodOpacity='0' result='BackgroundImageFix' />
<feColorMatrix
in='SourceAlpha'
type='matrix'
values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'
result='hardAlpha'
/>
<feOffset dy='4' />
<feGaussianBlur stdDeviation='6' />
<feComposite in2='hardAlpha' operator='out' />
<feColorMatrix
type='matrix'
values='0 0 0 0 0.380392 0 0 0 0 0.356863 0 0 0 0 0.760784 0 0 0 0.16 0'
/>
<feBlend
mode='normal'
in2='BackgroundImageFix'
result='effect1_dropShadow_22043_268578'
/>
<feBlend
mode='normal'
in='SourceGraphic'
in2='effect1_dropShadow_22043_268578'
result='shape'
/>
</filter>
<filter
id='filter3_d_22043_268578'
x='91'
y='175'
width='106'
height='106'
filterUnits='userSpaceOnUse'
colorInterpolationFilters='sRGB'
>
<feFlood floodOpacity='0' result='BackgroundImageFix' />
<feColorMatrix
in='SourceAlpha'
type='matrix'
values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'
result='hardAlpha'
/>
<feOffset dy='4' />
<feGaussianBlur stdDeviation='6' />
<feComposite in2='hardAlpha' operator='out' />
<feColorMatrix
type='matrix'
values='0 0 0 0 0.380392 0 0 0 0 0.356863 0 0 0 0 0.760784 0 0 0 0.16 0'
/>
<feBlend
mode='normal'
in2='BackgroundImageFix'
result='effect1_dropShadow_22043_268578'
/>
<feBlend
mode='normal'
in='SourceGraphic'
in2='effect1_dropShadow_22043_268578'
result='shape'
/>
</filter>
<linearGradient
id='paint0_linear_22043_268578'
x1='64.2447'
y1='87'
x2='64.2447'
y2='249'
gradientUnits='userSpaceOnUse'
>
<stop
stopColor={theme.palette.charts.health.gradientStale}
/>
<stop
offset='1'
stopColor={
theme.palette.charts.health.gradientPotentiallyStale
}
/>
</linearGradient>
</defs>
</svg>
);
};