File tree Expand file tree Collapse file tree 4 files changed +94
-2
lines changed Expand file tree Collapse file tree 4 files changed +94
-2
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,10 @@ import { ReactComponent as CancelIcon } from 'assets/icons/slash.svg';
32
32
import { ReactComponent as UserPlusIcon } from 'assets/icons/user-plus.svg' ;
33
33
import { ReactComponent as QRCodeIcon } from 'assets/icons/qr.svg' ;
34
34
import { ReactComponent as BoltOutlinedIcon } from 'assets/icons/bolt-outlined.svg' ;
35
+ import { ReactComponent as PlugIcon } from 'assets/icons/plug.svg' ;
35
36
36
37
interface IconProps {
37
- size ?: 'x-small' | 'small' | 'medium' | 'large' ;
38
+ size ?: 'x-small' | 'small' | 'medium' | 'large' | 'x-large' ;
38
39
onClick ?: ( ) => void ;
39
40
disabled ?: boolean ;
40
41
}
@@ -51,7 +52,7 @@ const Icon = styled.span<IconProps>`
51
52
cursor: pointer;
52
53
&:hover {
53
54
color: ${ props . theme . colors . blue } ;
54
- background-color: ${ props . theme . colors . offWhite } ;
55
+ background-color: ${ props . theme . colors . offWhite } ;
55
56
}
56
57
` }
57
58
@@ -88,6 +89,13 @@ const Icon = styled.span<IconProps>`
88
89
width: 36px;
89
90
height: 36px;
90
91
` }
92
+
93
+ ${ props =>
94
+ props . size === 'x-large' &&
95
+ `
96
+ width: 48px;
97
+ height: 48px;
98
+ ` }
91
99
` ;
92
100
93
101
export const AlertTriangle = Icon . withComponent ( AlertTriangleIcon ) ;
@@ -123,3 +131,4 @@ export const BarChart = Icon.withComponent(BarChartIcon);
123
131
export const List = Icon . withComponent ( ListIcon ) ;
124
132
export const QRCode = Icon . withComponent ( QRCodeIcon ) ;
125
133
export const BoltOutlined = Icon . withComponent ( BoltOutlinedIcon ) ;
134
+ export const Plug = Icon . withComponent ( PlugIcon ) ;
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import styled from '@emotion/styled' ;
3
+ import { usePrefixedTranslation } from 'hooks' ;
4
+ import { Plug } from '../base' ;
5
+ import { SubServerStatus } from 'types/state' ;
6
+
7
+ const Styled = {
8
+ Wrapper : styled . div `
9
+ min-height: 100vh;
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ ` ,
14
+ StatusMessage : styled . div `
15
+ display: inline-block;
16
+ border-radius: 24px;
17
+ padding: 3px 16px 3px 6px;
18
+ font-size: ${ props => props . theme . sizes . s } ;
19
+ color: ${ props => props . theme . colors . lightningGray } ;
20
+ font-weight: 600;
21
+ white-space: nowrap;
22
+ text-align: center;
23
+
24
+ svg {
25
+ margin-bottom: 16px;
26
+ color: ${ props => props . theme . colors . gold } ;
27
+ }
28
+ ` ,
29
+ Error : styled . div `
30
+ font-weight: bold;
31
+ ` ,
32
+ } ;
33
+
34
+ interface StatusProps {
35
+ isDisabled : boolean ;
36
+ errorMessage ?: string ;
37
+ }
38
+
39
+ export const SubServerStatusMessage : React . FC < StatusProps > = ( {
40
+ isDisabled,
41
+ errorMessage,
42
+ } ) => {
43
+ const { l } = usePrefixedTranslation ( 'cmps.common.SubServerStatus' ) ;
44
+ const { Wrapper, StatusMessage, Error } = Styled ;
45
+ return (
46
+ < Wrapper >
47
+ < StatusMessage >
48
+ < Plug size = "x-large" />
49
+
50
+ { isDisabled ? (
51
+ < p > { l ( 'isDisabled' ) } </ p >
52
+ ) : (
53
+ < >
54
+ < p > { l ( 'isError' ) } </ p >
55
+ < Error > { errorMessage } </ Error >
56
+ </ >
57
+ ) }
58
+ </ StatusMessage >
59
+ </ Wrapper >
60
+ ) ;
61
+ } ;
62
+
63
+ interface Props {
64
+ status : SubServerStatus ;
65
+ }
66
+
67
+ const SubServerRequired : React . FC < Props > = ( { status, children } ) => {
68
+ if ( status . disabled ) {
69
+ return < SubServerStatusMessage isDisabled /> ;
70
+ } else if ( status . error ) {
71
+ return < SubServerStatusMessage isDisabled = { false } errorMessage = { status . error } /> ;
72
+ }
73
+
74
+ return < > { children } </ > ;
75
+ } ;
76
+
77
+ export default SubServerRequired ;
Original file line number Diff line number Diff line change 31
31
"cmps.common.PageHeader.exportTip" : " Download CSV" ,
32
32
"cmps.common.PageHeader.helpTip" : " Take a Tour" ,
33
33
"cmps.common.Wizard.backTip" : " Back to Previous" ,
34
+ "cmps.common.SubServerStatus.isDisabled" : " This subserver is turned off so this interface is not accessible." ,
35
+ "cmps.common.SubServerStatus.isError" : " This subserver encountered an error and failed to start up." ,
36
+ "cmps.common.SubServerStatus.isNotRunning" : " The {{name}} subserver is not running so this interface is not accessible." ,
34
37
"cmps.connect.AddSession.create" : " Create a new session" ,
35
38
"cmps.connect.AddSession.label" : " Label" ,
36
39
"cmps.connect.AddSession.permissions" : " Permissions" ,
You can’t perform that action at this time.
0 commit comments