From c975303469ac68e9f25ce620ad21066fa8bb5b06 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Tue, 19 Feb 2019 21:48:48 +0100 Subject: [PATCH] Add app version page (#375) * Add app version page * add github link --- .eslintrc | 3 ++- src/components/Footer/index.js | 4 +-- src/support/routes.js | 5 ++++ src/views/Landing/views/Version/index.js | 33 ++++++++++++++++++++++++ src/views/index.js | 2 ++ webpack/dev.babel.js | 8 +++--- webpack/production.babel.js | 2 ++ 7 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 src/views/Landing/views/Version/index.js diff --git a/.eslintrc b/.eslintrc index 4e457674..37d11b68 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,7 +6,8 @@ ], "globals": { "LOCAL": true, - "COMMITHASH": true + "COMMITHASH": true, + "VERSION": true }, "env": { "browser": true, diff --git a/src/components/Footer/index.js b/src/components/Footer/index.js index b9df79fc..7dfd026c 100644 --- a/src/components/Footer/index.js +++ b/src/components/Footer/index.js @@ -12,8 +12,6 @@ import colors from 'config/colors'; import { FONT_SIZE } from 'config/variables'; import * as LogActions from 'actions/LogActions'; -declare var COMMITHASH: string; - type Props = { opened: boolean, isLanding: boolean, @@ -60,7 +58,7 @@ const Right = styled.div` const Footer = ({ opened, toggle, isLanding }: Props) => ( - © {getYear(new Date())} + © {getYear(new Date())} SatoshiLabs Terms { opened ? 'Hide Log' : 'Show Log' } diff --git a/src/support/routes.js b/src/support/routes.js index 90452679..717bed03 100644 --- a/src/support/routes.js +++ b/src/support/routes.js @@ -12,6 +12,11 @@ export const routes: Array = [ pattern: '/', fields: [], }, + { + name: 'landing-version', + pattern: '/version', + fields: ['version'], + }, { name: 'landing-bridge', pattern: '/bridge', diff --git a/src/views/Landing/views/Version/index.js b/src/views/Landing/views/Version/index.js new file mode 100644 index 00000000..dee88428 --- /dev/null +++ b/src/views/Landing/views/Version/index.js @@ -0,0 +1,33 @@ +import React from 'react'; +import styled from 'styled-components'; +import { H3, H2 } from 'components/Heading'; +import LandingWrapper from 'views/Landing/components/LandingWrapper'; +import Link from 'components/Link'; + +const Wrapper = styled.div` + display: flex; + flex: 1; + flex-direction: column; + align-items: center; + justify-content: center; +`; + +const Line = styled.div` + padding: 20px; +`; + +const Version = () => ( + + +

APPLICATION VERSION

+

{VERSION}

+ +

LAST COMMIT HASH

+ +

{COMMITHASH}

+ +
+
+); + +export default Version; \ No newline at end of file diff --git a/src/views/index.js b/src/views/index.js index 62221dce..1b0a8963 100644 --- a/src/views/index.js +++ b/src/views/index.js @@ -7,6 +7,7 @@ import { ConnectedRouter } from 'connected-react-router'; // general import ErrorBoundary from 'support/ErrorBoundary'; import ImagesPreloader from 'support/ImagesPreloader'; +import Version from 'views/Landing/views/Version'; import { getPattern } from 'support/routes'; // landing views @@ -38,6 +39,7 @@ const App = () => ( + diff --git a/webpack/dev.babel.js b/webpack/dev.babel.js index 89e45dab..5c770fc9 100644 --- a/webpack/dev.babel.js +++ b/webpack/dev.babel.js @@ -3,14 +3,15 @@ import GitRevisionPlugin from 'git-revision-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'; import WebpackBuildNotifierPlugin from 'webpack-build-notifier'; - -// turn on for bundle analyzing -// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; +import packageJson from '../package.json'; import { SRC, BUILD, PORT, PUBLIC, } from './constants'; +// turn on for bundle analyzing +// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; + const gitRevisionPlugin = new GitRevisionPlugin(); module.exports = { @@ -103,6 +104,7 @@ module.exports = { suppressSuccess: true, }), new webpack.DefinePlugin({ + VERSION: JSON.stringify(packageJson.version), COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()), }), new HtmlWebpackPlugin({ diff --git a/webpack/production.babel.js b/webpack/production.babel.js index 0a6bc979..9be7e0b5 100644 --- a/webpack/production.babel.js +++ b/webpack/production.babel.js @@ -3,6 +3,7 @@ import GitRevisionPlugin from 'git-revision-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'; import CopyWebpackPlugin from 'copy-webpack-plugin'; +import packageJson from '../package.json'; import { SRC, BUILD, PUBLIC } from './constants'; const gitRevisionPlugin = new GitRevisionPlugin(); @@ -65,6 +66,7 @@ module.exports = { plugins: [ new webpack.DefinePlugin({ 'process.env.BUILD': JSON.stringify(process.env.BUILD), + VERSION: JSON.stringify(packageJson.version), COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()), }), new HtmlWebpackPlugin({