Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new release banner - Closes #2144 #2300

Merged
merged 25 commits into from Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c51fd1d
:recycle: Refactor flashMessage toolbox component to be more generic
massao Aug 1, 2019
53b1191
:recycle: Create header component to render correct one in each route
massao Aug 2, 2019
497ebcc
:recycle: Add flashMessageHolder singleton to be easier to display me…
massao Aug 2, 2019
73f9b24
:nail_care: Fix css issues on electron after updating app component
massao Aug 2, 2019
546619e
:recycle: Update flashMessageHolder to deleteMessage on dismiss
massao Aug 2, 2019
c9eee2b
:recycle: Update newReleaseMessage component to correct styling
massao Aug 2, 2019
cf0b88b
:recycle: Add newRelease util to get info form ipc and render flashMe…
massao Aug 2, 2019
6fa4eaa
:recycle: Adjust autoUpdater to send information to react
massao Aug 2, 2019
27e588a
:recycle: Update generated strings
massao Aug 2, 2019
767524b
:white_check_mark: Add FlashMessageHolder unit tests
massao Aug 3, 2019
8e29375
:recycle: Adjust newRelease util and message and add unit test
massao Aug 3, 2019
65a4b11
:recycle: Fix initialization banner not showing up.
massao Aug 5, 2019
07bf2ac
:white_check_mark: Improve FlashMessageHolder unit test
massao Aug 5, 2019
83ae15e
:recycle: Improve newReleaseMessage to be more presentational
massao Aug 5, 2019
22f151a
:recycle: Improve newRelease util to remove istanbul comment
massao Aug 5, 2019
8da96c2
:nail_care: Adjust css file for tertiary button and for flashMessage
massao Aug 5, 2019
818b4de
:recycle: Add border-bottom to flashMessage
massao Aug 5, 2019
b1da817
:recycle: Add htmlParser util to handle parsing HTML inside strings
massao Aug 5, 2019
153e3ac
:recycle: Update regex of releaseSummary
massao Aug 5, 2019
88347c9
:recycle: Improve htmlParser to handle text before tag openning
massao Aug 5, 2019
6302967
:recycle: Fix issue with resizing on flashMessage
massao Aug 5, 2019
67594a5
:recycle: Renamed parser util to htmlStringToReact to be more descrip…
massao Aug 5, 2019
68ff5cb
:nail_care: Remove unecessary rules from offlineWrapper css
massao Aug 5, 2019
a50256c
:white_check_mark: Adjust newRelease to delete ipc from window after …
massao Aug 5, 2019
62829a5
:nail_care: Adjust css pages centered vertically after change on header
massao Aug 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/src/modules/autoUpdater.js
Expand Up @@ -43,6 +43,7 @@ export default ({ // eslint-disable-line max-statements

autoUpdater.on('update-available', ({ releaseNotes, version }) => {
updater.error = undefined;
const { ipcMain } = electron;
const versions = {
oldVersion: electron.app.getVersion(),
newVersion: version,
Expand All @@ -58,7 +59,16 @@ export default ({ // eslint-disable-line max-statements
}
}, 500);
};
updateModal(electron, releaseNotes, updateApp, versions);

ipcMain.removeAllListeners('update:clicked');
ipcMain.on('update:clicked', () => {
updateModal(electron, releaseNotes, updateApp, versions);
});

win.send({
event: 'update:available',
value: { releaseNotes, version },
});
});

autoUpdater.on('update-not-available', () => {
Expand Down
5 changes: 4 additions & 1 deletion app/src/modules/autoUpdater.test.js
Expand Up @@ -68,6 +68,7 @@ describe('autoUpdater', () => {
showErrorBox: spy(),
},
win: {
send: spy(),
browser: {
setProgressBar: spy(),
},
Expand Down Expand Up @@ -160,10 +161,12 @@ describe('autoUpdater', () => {
expect(params.autoUpdater.quitAndInstall).to.not.have.been.calledWith();
});

it('should download the update if update is available and the "Update" button was pressed', () => {
it('should Send information to renderer when update is available', () => {
const newPrams = { ...params, electron };
autoUpdater(newPrams);
callbacks['update-available']({ version });
expect(params.win.send).to.have.been.calledWith();
ipcRenderer.send('update:clicked');
clock.tick(1001);
ipcRenderer.send('update', { text: 'update' });
clock.tick(100);
Expand Down
2 changes: 2 additions & 0 deletions i18n/locales/en/common.json
Expand Up @@ -2,6 +2,7 @@
" - Confirm transaction on your {{deviceModel}}": " - Confirm transaction on your {{deviceModel}}",
" LSK": " LSK",
" Make sure that you are using the latest version of Lisk Hub.": " Make sure that you are using the latest version of Lisk Hub.",
" is out. ": " is out. ",
"% of successfully forged blocks in relation to total blocks that were available for this particular delegate to forge": "% of successfully forged blocks in relation to total blocks that were available for this particular delegate to forge",
"%s Connected. Welcome %s!": "%s Connected. Welcome %s!",
"%s Disconnected. See you %s!": "%s Disconnected. See you %s!",
Expand Down Expand Up @@ -230,6 +231,7 @@
"Lisk Hub": "Lisk Hub",
"Lisk Hub currently supports Ledger Nano S and Trezor Model T wallets": "Lisk Hub currently supports Ledger Nano S and Trezor Model T wallets",
"Lisk Hub {{newVersion}} is here!": "Lisk Hub {{newVersion}} is here!",
"Lisk Hub {{version}}": "Lisk Hub {{version}}",
"Lisk Terms of Use": "Lisk Terms of Use",
"Lisk Website": "Lisk Website",
"Lisk accounts on {{WalletModel}}": "Lisk accounts on {{WalletModel}}",
Expand Down
4 changes: 2 additions & 2 deletions jest.config.js
Expand Up @@ -20,7 +20,7 @@ module.exports = {
'src/store/middlewares/socket.test.js',
'src/components/delegatesListView/*',
'src/components/register/register.test.js',
'src/components/header/header.test.js',
'src/components/header/signInHeader/signInHeader.test.js',
],
verbose: false,
cache: false,
Expand Down Expand Up @@ -125,7 +125,7 @@ module.exports = {
'src/components/login/login.js',
'src/utils/hwWallet.js',
'src/components/delegatesListView/*',
'src/components/header/header.js',
'src/components/header/signInHeader/signInHeader.js',
'src/components/register/register.js',
],
coverageThreshold: process.env.NO_COV ? {} : {
Expand Down
16 changes: 13 additions & 3 deletions src/components/app/app.css
Expand Up @@ -17,6 +17,8 @@ body {
position: absolute;
right: 0;
top: 0;
display: flex;
flex-direction: column;
z-index: var(--normal-index);
}

Expand Down Expand Up @@ -57,15 +59,23 @@ body {
text-align: center;
}

.mainBox {
.mainContent {
display: flex;
flex-direction: column;
flex-grow: 1;
margin: 0 auto;
width: 100%;
}

.mainBox {
max-width: var(--main-box-width);
flex-grow: 1;
}

:global(.offlineWrapper) {
height: 100%;
display: flex;
flex-direction: column;
flex-grow: 1;
width: 100%;
}

@media (--medium-viewport) {
Expand Down
110 changes: 48 additions & 62 deletions src/components/app/index.js
Expand Up @@ -2,14 +2,15 @@ import React from 'react';
import { Route, Switch, withRouter } from 'react-router-dom';
import styles from './app.css';
import Toaster from '../toaster';
import TopBar from '../topBar';
import LoadingBar from '../loadingBar';
import OfflineWrapper from '../offlineWrapper';
import CustomRoute from '../customRoute';
import Dialog from '../dialog';
import NotFound from '../notFound';
import InitializationMessage from '../initializationMessage';
import routes from '../../constants/routes';
import Header from '../header/header';
import FlashMessageHolder from '../toolbox/flashMessage/holder';

class App extends React.Component {
constructor() {
Expand All @@ -26,72 +27,57 @@ class App extends React.Component {
}

render() {
const { history, location } = this.props;
const { location, history } = this.props;
const allRoutes = Object.values(routes);
const defaultRoutes = allRoutes.filter(routeObj => routeObj.component);
const signinFlowRoutes = allRoutes.filter(routeObj => routeObj.isSigninFlow);
const mainClassNames = [
styles.bodyWrapper,
(this.state.loaded ? `${styles.loaded} appLoaded` : ''),
].join(' ');
const routeObj = Object.values(routes).find(r => r.path === location.pathname) || {};

return (
<OfflineWrapper>
<Dialog />
{
signinFlowRoutes.filter(route => route.path === location.pathname).length > 0
? (
<main
className={this.state.loaded
? `${styles.wrapper} ${styles.loaded} appLoaded`
: `${styles.wrapper}`
}
ref={(el) => { this.main = el; }}
>
<Switch>
{this.state.loaded
&& signinFlowRoutes.map((route, key) => (
<Route
path={route.path}
key={key}
component={route.component}
exact={route.exact}
/>
))
}
</Switch>
<Toaster />
</main>
)
: (
<main
className={this.state.loaded
? `${styles.bodyWrapper} ${styles.loaded} appLoaded`
: `${styles.bodyWrapper}`}
ref={(el) => { this.main = el; }}
>
<TopBar />
<section>
<InitializationMessage history={history} />
<div className={styles.mainBox}>
<Switch>
{
this.state.loaded && defaultRoutes.map(route => (
<CustomRoute
path={route.path}
pathSuffix={route.pathSuffix}
component={route.component}
isPrivate={route.isPrivate}
exact={route.exact}
forbiddenTokens={route.forbiddenTokens}
key={route.path}
/>
))
}
<Route path="*" component={NotFound} />
</Switch>
</div>
</section>
<Toaster />
</main>
)
}
<Header
isSigninFlow={routeObj.isSigninFlow}
location={location}
/>
<main
className={mainClassNames}
ref={(el) => { this.main = el; }}
>
<section>
<FlashMessageHolder />
<InitializationMessage history={history} />
<div className={`${styles.mainContent} ${!routeObj.isSigninFlow ? styles.mainBox : ''}`}>
<Switch>
{this.state.loaded && allRoutes.map(route => (
route.isSigninFlow
? (
<Route
path={route.path}
key={route.path}
component={route.component}
exact={route.exact}
/>
) : (
<CustomRoute
path={route.path}
pathSuffix={route.pathSuffix}
component={route.component}
isPrivate={route.isPrivate}
exact={route.exact}
forbiddenTokens={route.forbiddenTokens}
key={route.path}
/>
)
))}
<Route path="*" component={NotFound} />
</Switch>
</div>
</section>
<Toaster />
</main>
<LoadingBar markAsLoaded={this.markAsLoaded.bind(this)} />
</OfflineWrapper>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/dashboard/dashboard.css
Expand Up @@ -2,6 +2,7 @@
@import '../app/mixins.css';

.wrapper {
flex-shrink: 0;
width: 100%;
margin: 0px;
overflow: hidden;
Expand Down
22 changes: 11 additions & 11 deletions src/components/dashboard/dashboard.js
Expand Up @@ -82,18 +82,18 @@ class Dashboard extends React.Component {

return (
<React.Fragment>
{
isLoggedIn
? (
<Onboarding
slides={this.getOnboardingSlides()}
actionButtonLabel={t('Got it, thanks!')}
name="dashboardOnboarding"
/>
)
: null
}
<div className={`${styles.wrapper} dashboard-container`}>
{
isLoggedIn
? (
<Onboarding
slides={this.getOnboardingSlides()}
actionButtonLabel={t('Got it, thanks!')}
name="dashboardOnboarding"
/>
)
: null
}
<PageHeader
title={t('Dashboard')}
subtitle={t('All important information at a glance')}
Expand Down
1 change: 1 addition & 0 deletions src/components/errorBoundary/errorBoundary.css
Expand Up @@ -4,6 +4,7 @@
.errorBoundaryPage {
display: flex;
flex-direction: column;
flex-grow: 1;
align-items: center;
height: 100%;
}
Expand Down