move app version to constants

This commit is contained in:
David Lechner
2021-02-01 13:02:06 -06:00
parent a8b3f5dcf7
commit 1e5d25086b
3 changed files with 8 additions and 4 deletions
+2 -3
View File
@@ -9,6 +9,7 @@ import React from 'react';
import { connect } from 'react-redux';
import {
appName,
appVersion,
legoDisclaimer,
pybricksCopyright,
pybricksWebsiteUrl,
@@ -20,8 +21,6 @@ import en from './i18n.en.json';
import './about.scss';
const version = process.env.REACT_APP_VERSION;
type OwnProps = { isOpen: boolean; onClose: () => void };
type AboutDialogProps = OwnProps & WithI18nProps;
@@ -35,7 +34,7 @@ class AboutDialog extends React.Component<AboutDialogProps> {
const { isOpen, onClose, i18n } = this.props;
return (
<Dialog
title={`${appName} v${version}`}
title={`${appName} v${appVersion}`}
isOpen={isOpen}
onClose={() => onClose()}
>
+4
View File
@@ -9,6 +9,10 @@ export const tooltipDelay = 1000;
/** Official name of the app. */
export const appName = process.env.REACT_APP_NAME || 'REACT_APP_NAME is undefined';
/** The version of the app (without the "v" prefix). */
export const appVersion =
process.env.REACT_APP_VERSION || 'REACT_APP_VERSION is undefined';
/** URL to main Pybricks website. */
export const pybricksWebsiteUrl = 'https://pybricks.com';
+2 -1
View File
@@ -11,6 +11,7 @@ import { createLogger } from 'redux-logger';
import createSagaMiddleware from 'redux-saga';
import './index.scss';
import App from './app/App';
import { appVersion } from './app/constants';
import { i18nManager } from './i18n';
import * as I18nToaster from './notifications/I18nToaster';
import { rootReducer } from './reducers';
@@ -65,7 +66,7 @@ store.subscribe(() => {
});
// special styling for beta versions
if (process.env.REACT_APP_VERSION?.match(/beta/)) {
if (appVersion.match(/beta/)) {
document.body.classList.add('pb-beta');
}