on master help sign in
qol: address PR feedback

- single source of truth for Bridge version label in `flags`

commit033b55078fb8a6228d97e413aea39424f6a0fe8d authortomholford <tomholford@users.noreply.github.com> dateFri 23 Jul 2021, 03:12 (5 years ago) parent2b57c77
3 files changed+7−8
src/components/GlobalErrorBoundary.js+2−2 src/lib/flags.js+3 src/views/Login.tsx+2−6
src/components/GlobalErrorBoundary.js+2−2
@@ -1,7 +1,7 @@
11import React, { useMemo } from 'react';
22import newGithubIssueUrl from 'new-github-issue-url';
33import { OutButton, RestartButton } from './Buttons';
4−import { version } from '../../package.json';
4+import { versionLabel } from 'lib/flags';
55
66const buildTitle = error => `Error Report: ${error.message}`;
77
@@ -19,7 +19,7 @@ const buildBody = error => `\n
1919${error.stack}
2020\`\`\`
2121\n
22−In Bridge version ${version}.\n
22+In Bridge version ${versionLabel}.\n
2323`;
2424
2525/**
src/lib/flags.js+3
@@ -1,3 +1,6 @@
1+import { version } from '../../package.json';
2+
13// are we running bridge in a development build
24export const isDevelopment = process.env.NODE_ENV === 'development';
35export const isRopsten = process.env.REACT_APP_ROPSTEN === 'true';
6+export const versionLabel = `${version}${isRopsten ? 'r' : ''}`;
src/views/Login.tsx+2−6
@@ -1,8 +1,7 @@
11import React, { useCallback, useState } from 'react';
22import { Grid, Text, Button, Flex, LinkButton } from 'indigo-react';
33
4−import { version } from '../../package.json';
5−import { isRopsten } from 'lib/flags';
4+import { versionLabel } from 'lib/flags';
65
76import { useHistory } from 'store/history';
87
@@ -125,10 +124,7 @@ export default function Login() {
125124 className="us-none pointer">
126125 <span className="underline">Offline</span> ↗
127126 </Flex.Item>
128− <Flex.Item className="gray4">
129− v{version}
130− {isRopsten ? 'r' : ''}
131− </Flex.Item>
127+ <Flex.Item className="gray4">{versionLabel}</Flex.Item>
132128 </Flex>
133129 </Footer>
134130 </View>