Skip to content

Commit 84e1a8e

Browse files
committed
Display a neutral warning icon if version check is disabled
Extend he WarningIcon template to allow custom coloring with fallback to theme's "warningIcon" color. If version check is disabled, show a corresponding info with a "infoIcon" (gray) colored icon instead.
1 parent ede6682 commit 84e1a8e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

frontend/src/components/Version/Version.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { gitCommitPath } from 'lib/paths';
44
import { useLatestVersion } from 'lib/hooks/api/latestVersion';
55
import { formatTimestamp } from 'lib/dateTimeHelpers';
66
import { useTimezone } from 'lib/hooks/useTimezones';
7+
import { useTheme } from 'styled-components';
78

89
import * as S from './Version.styled';
910

@@ -22,8 +23,15 @@ const Version: React.FC = () => {
2223
timezone: currentTimezone.value,
2324
});
2425

26+
const theme = useTheme();
27+
2528
return (
2629
<S.Wrapper>
30+
{isLatestRelease === null && (
31+
<S.OutdatedWarning title="Version check disabled.">
32+
<WarningIcon color={theme.icons.infoIcon} />
33+
</S.OutdatedWarning>
34+
)}
2735
{isLatestRelease === false && (
2836
<S.OutdatedWarning
2937
title={`Your app version is outdated. Latest version is ${

frontend/src/components/common/Icons/WarningIcon.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import styled from 'styled-components';
2+
import styled, { useTheme } from 'styled-components';
33

44
const WarningIconContainer = styled.span`
55
align-items: center;
@@ -9,7 +9,8 @@ const WarningIconContainer = styled.span`
99
width: 1.5rem;
1010
`;
1111

12-
const WarningIcon: React.FC = () => {
12+
const WarningIcon: React.FC<{ color?: string }> = ({ color }) => {
13+
const theme = useTheme();
1314
return (
1415
<WarningIconContainer>
1516
<svg
@@ -24,7 +25,7 @@ const WarningIcon: React.FC = () => {
2425
fillRule="evenodd"
2526
clipRule="evenodd"
2627
d="M8.09265 1.06679C7.60703 0.250524 6.39297 0.250524 5.90735 1.06679L0.170916 10.7089C-0.314707 11.5252 0.292322 12.5455 1.26357 12.5455H12.7364C13.7077 12.5455 14.3147 11.5252 13.8291 10.7089L8.09265 1.06679ZM6 5.00006C6 4.44778 6.44772 4.00006 7 4.00006C7.55228 4.00006 8 4.44778 8 5.00006V7.00006C8 7.55235 7.55228 8.00006 7 8.00006C6.44772 8.00006 6 7.55235 6 7.00006V5.00006ZM6 10.0001C6 9.44778 6.44772 9.00006 7 9.00006C7.55228 9.00006 8 9.44778 8 10.0001C8 10.5523 7.55228 11.0001 7 11.0001C6.44772 11.0001 6 10.5523 6 10.0001Z"
27-
fill="#F2C94C"
28+
fill={color || theme.icons.warningIcon}
2829
/>
2930
</svg>
3031
</WarningIconContainer>

0 commit comments

Comments
 (0)