Skip to content

Commit 4b7fffe

Browse files
committed
Quality turns gray if no service is on
Signed-off-by: Mantas Domaševičius <mantas@mysterium.network>
1 parent 10938dc commit 4b7fffe

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

src/Pages/Authenticated/Components/Quality/Quality.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ import { tequila } from '../../../../api/tequila'
1111
import styled from 'styled-components'
1212
import { Link } from '../../../../Components/Common/Link'
1313
import { NODE_QUALITY } from '../../../../constants/urls'
14+
import { useAppSelector } from '../../../../commons/hooks'
15+
import { selectors } from '../../../../redux/selectors'
1416

15-
type IndicatorVariants = 'good' | 'normal' | 'poor'
17+
type IndicatorVariants = 'good' | 'normal' | 'poor' | 'unknown'
1618
interface IndicatorProps {
1719
$variant: IndicatorVariants
1820
}
@@ -35,6 +37,8 @@ const Tooltip = styled.div`
3537

3638
export const Quality = () => {
3739
const [quality, setQuality] = useState(0)
40+
const services = useAppSelector(selectors.runningServices)
41+
const anyOnline = services.length > 0
3842

3943
useEffect(() => {
4044
tequila.api.provider.quality().then((r) => setQuality(r.quality))
@@ -74,7 +78,7 @@ export const Quality = () => {
7478
</Link>
7579
</Tooltip>
7680
}
77-
content={<Indicator $variant={resolveVariant(quality)} />}
81+
content={<Indicator $variant={anyOnline ? resolveVariant(quality) : 'unknown'} />}
7882
/>
7983
)
8084
}

src/theme/dark.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ const dark: Omit<Theme, 'common'> = {
169169
good: themeCommon.colorGreen,
170170
normal: themeCommon.colorWarning,
171171
poor: themeCommon.colorRed,
172+
unknown: themeCommon.colorGrayBlue2,
172173
},
173174
},
174175
adminPanel: {

src/theme/light.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ const light: Omit<Theme, 'common'> = {
166166
good: themeCommon.colorGreen,
167167
normal: themeCommon.colorWarning,
168168
poor: themeCommon.colorRed,
169+
unknown: themeCommon.colorGrayBlue2,
169170
},
170171
},
171172
adminPanel: {

src/types/theme.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export type Theme = {
174174
good: string
175175
normal: string
176176
poor: string
177+
unknown: string
177178
}
178179
}
179180
notifications: {

0 commit comments

Comments
 (0)