Add app version page (#375)

* Add app version page

* add github link
pull/380/head
Vladimir Volek 5 years ago committed by Maroš
parent 3829f6e67f
commit c975303469

@ -6,7 +6,8 @@
], ],
"globals": { "globals": {
"LOCAL": true, "LOCAL": true,
"COMMITHASH": true "COMMITHASH": true,
"VERSION": true
}, },
"env": { "env": {
"browser": true, "browser": true,

@ -12,8 +12,6 @@ import colors from 'config/colors';
import { FONT_SIZE } from 'config/variables'; import { FONT_SIZE } from 'config/variables';
import * as LogActions from 'actions/LogActions'; import * as LogActions from 'actions/LogActions';
declare var COMMITHASH: string;
type Props = { type Props = {
opened: boolean, opened: boolean,
isLanding: boolean, isLanding: boolean,
@ -60,7 +58,7 @@ const Right = styled.div`
const Footer = ({ opened, toggle, isLanding }: Props) => ( const Footer = ({ opened, toggle, isLanding }: Props) => (
<Wrapper> <Wrapper>
<Left> <Left>
<Copy title={COMMITHASH}>&copy; {getYear(new Date())}</Copy> <Copy>&copy; {getYear(new Date())}</Copy>
<StyledLink href="http://satoshilabs.com" isGreen>SatoshiLabs</StyledLink> <StyledLink href="http://satoshilabs.com" isGreen>SatoshiLabs</StyledLink>
<StyledLink href="./assets/tos.pdf" isGreen>Terms</StyledLink> <StyledLink href="./assets/tos.pdf" isGreen>Terms</StyledLink>
<StyledLink onClick={toggle} isGreen>{ opened ? 'Hide Log' : 'Show Log' }</StyledLink> <StyledLink onClick={toggle} isGreen>{ opened ? 'Hide Log' : 'Show Log' }</StyledLink>

@ -12,6 +12,11 @@ export const routes: Array<Route> = [
pattern: '/', pattern: '/',
fields: [], fields: [],
}, },
{
name: 'landing-version',
pattern: '/version',
fields: ['version'],
},
{ {
name: 'landing-bridge', name: 'landing-bridge',
pattern: '/bridge', pattern: '/bridge',

@ -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 = () => (
<LandingWrapper>
<Wrapper>
<H3>APPLICATION VERSION</H3>
<H2>{VERSION}</H2>
<Line />
<H3>LAST COMMIT HASH</H3>
<Link href={`https://github.com/trezor/trezor-wallet/commits/${COMMITHASH}`}>
<H2>{COMMITHASH}</H2>
</Link>
</Wrapper>
</LandingWrapper>
);
export default Version;

@ -7,6 +7,7 @@ import { ConnectedRouter } from 'connected-react-router';
// general // general
import ErrorBoundary from 'support/ErrorBoundary'; import ErrorBoundary from 'support/ErrorBoundary';
import ImagesPreloader from 'support/ImagesPreloader'; import ImagesPreloader from 'support/ImagesPreloader';
import Version from 'views/Landing/views/Version';
import { getPattern } from 'support/routes'; import { getPattern } from 'support/routes';
// landing views // landing views
@ -38,6 +39,7 @@ const App = () => (
<ConnectedRouter history={history}> <ConnectedRouter history={history}>
<Switch> <Switch>
<Route exact path={getPattern('landing-home')} component={RootView} /> <Route exact path={getPattern('landing-home')} component={RootView} />
<Route exact path={getPattern('landing-version')} component={Version} />
<Route exact path={getPattern('landing-bridge')} component={InstallBridge} /> <Route exact path={getPattern('landing-bridge')} component={InstallBridge} />
<Route exact path={getPattern('landing-import')} component={ImportView} /> <Route exact path={getPattern('landing-import')} component={ImportView} />
<Route> <Route>

@ -3,14 +3,15 @@ import GitRevisionPlugin from 'git-revision-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin';
import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'; import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin';
import WebpackBuildNotifierPlugin from 'webpack-build-notifier'; import WebpackBuildNotifierPlugin from 'webpack-build-notifier';
import packageJson from '../package.json';
// turn on for bundle analyzing
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { import {
SRC, BUILD, PORT, PUBLIC, SRC, BUILD, PORT, PUBLIC,
} from './constants'; } from './constants';
// turn on for bundle analyzing
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
const gitRevisionPlugin = new GitRevisionPlugin(); const gitRevisionPlugin = new GitRevisionPlugin();
module.exports = { module.exports = {
@ -103,6 +104,7 @@ module.exports = {
suppressSuccess: true, suppressSuccess: true,
}), }),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
VERSION: JSON.stringify(packageJson.version),
COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()), COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()),
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({

@ -3,6 +3,7 @@ import GitRevisionPlugin from 'git-revision-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin';
import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'; import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin'; import CopyWebpackPlugin from 'copy-webpack-plugin';
import packageJson from '../package.json';
import { SRC, BUILD, PUBLIC } from './constants'; import { SRC, BUILD, PUBLIC } from './constants';
const gitRevisionPlugin = new GitRevisionPlugin(); const gitRevisionPlugin = new GitRevisionPlugin();
@ -65,6 +66,7 @@ module.exports = {
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env.BUILD': JSON.stringify(process.env.BUILD), 'process.env.BUILD': JSON.stringify(process.env.BUILD),
VERSION: JSON.stringify(packageJson.version),
COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()), COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()),
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({

Loading…
Cancel
Save