1
- import { Box , Button , Grid , Paper , styled , Typography } from '@mui/material' ;
1
+ import {
2
+ Box ,
3
+ Button ,
4
+ Grid ,
5
+ Paper ,
6
+ styled ,
7
+ Typography ,
8
+ useMediaQuery ,
9
+ useTheme ,
10
+ } from '@mui/material' ;
2
11
import { useInstanceStats } from 'hooks/api/getters/useInstanceStats/useInstanceStats' ;
3
- import { useInstanceStatus } from 'hooks/api/getters/useInstanceStatus/useInstanceStatus' ;
4
12
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig' ;
5
13
import ArrowOutwardIcon from '@mui/icons-material/ArrowOutward' ;
6
14
import { formatAssetPath } from 'utils/formatPath' ;
7
15
import easyToDeploy from 'assets/img/easyToDeploy.png' ;
8
16
import { useNavigate } from 'react-router-dom' ;
9
17
18
+ const UI_SWITCH_WIDGET_RATIO_BREAKPOINT = 1505 ;
19
+
10
20
const StyledContainer = styled ( Grid ) ( ( { theme } ) => ( {
11
21
display : 'flex' ,
12
22
flexDirection : 'column' ,
@@ -21,6 +31,12 @@ const StyledInstanceWidget = styled(Paper)(({ theme }) => ({
21
31
color : 'white' ,
22
32
backgroundColor : theme . palette . web . main ,
23
33
overflow : 'hidden' ,
34
+ [ theme . breakpoints . down ( UI_SWITCH_WIDGET_RATIO_BREAKPOINT ) ] : {
35
+ height : theme . spacing ( 24 ) ,
36
+ } ,
37
+ [ theme . breakpoints . down ( 800 ) ] : {
38
+ height : theme . spacing ( 30 ) ,
39
+ } ,
24
40
} ) ) ;
25
41
26
42
const StyledWidget = styled ( Paper ) ( ( { theme } ) => ( {
@@ -43,6 +59,9 @@ const StyledHeader = styled(Typography)(({ theme }) => ({
43
59
44
60
const StyledLicenseSection = styled ( 'div' ) ( ( { theme } ) => ( {
45
61
marginBottom : theme . spacing ( 6 ) ,
62
+ [ theme . breakpoints . down ( UI_SWITCH_WIDGET_RATIO_BREAKPOINT ) ] : {
63
+ marginBottom : theme . spacing ( 2 ) ,
64
+ } ,
46
65
} ) ) ;
47
66
48
67
const StyledParagraph = styled ( Typography ) ( ( { theme } ) => ( {
@@ -53,6 +72,13 @@ const StyledParagraph = styled(Typography)(({ theme }) => ({
53
72
display : 'flex' ,
54
73
gap : theme . spacing ( 1 ) ,
55
74
justifyContent : 'space-between' ,
75
+ [ theme . breakpoints . down ( UI_SWITCH_WIDGET_RATIO_BREAKPOINT ) ] : {
76
+ maxWidth : theme . spacing ( 65 ) ,
77
+ } ,
78
+ [ theme . breakpoints . down ( 800 ) ] : {
79
+ flexDirection : 'column' ,
80
+ justifyContent : 'start' ,
81
+ } ,
56
82
} ) ) ;
57
83
58
84
const StyledParamName = styled ( 'div' ) ( ( { theme } ) => ( {
@@ -117,6 +143,10 @@ const ImageContainer = styled('div')(({ theme }) => ({
117
143
justifyContent : 'flex-end' ,
118
144
marginTop : theme . spacing ( - 6 ) ,
119
145
marginRight : theme . spacing ( - 10 ) ,
146
+ [ theme . breakpoints . down ( UI_SWITCH_WIDGET_RATIO_BREAKPOINT ) ] : {
147
+ marginTop : theme . spacing ( - 22 ) ,
148
+ marginRight : theme . spacing ( - 12 ) ,
149
+ } ,
120
150
} ) ) ;
121
151
122
152
const StyledImg = styled ( 'img' ) ( ( { theme } ) => ( {
@@ -218,6 +248,12 @@ const InstanceStatsWidget = ({
218
248
219
249
export const AdminHome = ( ) => {
220
250
const stats = useInstanceStats ( ) ;
251
+ const theme = useTheme ( ) ;
252
+ const isBreakpoint = useMediaQuery (
253
+ theme . breakpoints . down ( UI_SWITCH_WIDGET_RATIO_BREAKPOINT ) ,
254
+ ) ;
255
+ const breakpointedInstanceStatsWidgetSize = isBreakpoint ? 12 : 7 ;
256
+ const breakpointedInstanceWidgetSize = isBreakpoint ? 12 : 5 ;
221
257
const { isOss, isPro, isEnterprise } = useUiConfig ( ) ;
222
258
const plan = isOss ( )
223
259
? 'Open source'
@@ -226,12 +262,16 @@ export const AdminHome = () => {
226
262
: isEnterprise ( )
227
263
? 'Enterprise'
228
264
: 'Unknown' ;
229
- const { instanceStatus } = useInstanceStatus ( ) ;
230
265
return (
231
266
< StyledContainer >
232
267
{ stats && ! stats . loading && (
233
268
< Grid container spacing = { 3 } >
234
- < Grid item md = { 5 } sm = { 12 } xs = { 12 } >
269
+ < Grid
270
+ item
271
+ md = { breakpointedInstanceWidgetSize }
272
+ sm = { 12 }
273
+ xs = { 12 }
274
+ >
235
275
< InstanceWidget
236
276
plan = { plan }
237
277
instanceId = { stats . stats ?. instanceId ?? 'unknown' }
@@ -240,7 +280,12 @@ export const AdminHome = () => {
240
280
}
241
281
/>
242
282
</ Grid >
243
- < Grid item md = { 7 } sm = { 12 } xs = { 12 } >
283
+ < Grid
284
+ item
285
+ md = { breakpointedInstanceStatsWidgetSize }
286
+ sm = { 12 }
287
+ xs = { 12 }
288
+ >
244
289
< InstanceStatsWidget
245
290
environments = { stats . stats ?. environments ?? 0 }
246
291
featureToggles = { stats . stats ?. featureToggles ?? 0 }
0 commit comments