diff --git a/src/about/AboutDialog.tsx b/src/about/AboutDialog.tsx index 8eab2970..cd880f1d 100644 --- a/src/about/AboutDialog.tsx +++ b/src/about/AboutDialog.tsx @@ -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 { const { isOpen, onClose, i18n } = this.props; return ( onClose()} > diff --git a/src/app/constants.ts b/src/app/constants.ts index 62987140..c0c849e4 100644 --- a/src/app/constants.ts +++ b/src/app/constants.ts @@ -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'; diff --git a/src/index.tsx b/src/index.tsx index b1158128..778710fc 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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'); }