Skip to content

Commit

Permalink
Merge pull request #1729 from LiskHQ/1727-make-topBar-fixed-to-the-top
Browse files Browse the repository at this point in the history
Make top bar fixed to the top - Closes #1727
  • Loading branch information
Osvaldo Vega Agüero committed Feb 5, 2019
2 parents 0b54e01 + 7693db0 commit 0847ca2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 30 deletions.
4 changes: 3 additions & 1 deletion src/components/app/app.css
Expand Up @@ -20,10 +20,12 @@ body {
z-index: 0;

& > section {
margin-top: 25px;
margin-top: 85px;
width: 100%;
opacity: 0;
transition: all ease 250ms;
position: relative;
z-index: -1;
}

&.loaded > section {
Expand Down
2 changes: 2 additions & 0 deletions src/components/topBar/topBar.css
Expand Up @@ -12,6 +12,8 @@
background: var(--color-background-menu);
border-bottom: 1px solid var(--color-light-gray);
box-shadow: var(--box-shadow-header);
position: fixed;
z-index: 1;
}

.elements {
Expand Down
26 changes: 2 additions & 24 deletions src/components/topBar/topBar.js
Expand Up @@ -5,7 +5,6 @@ import MenuItems from './menuItems';
import SearchBar from '../searchBar';
import UserAccount from './userAccount';
import Piwik from '../../utils/piwik';
import Options from '../dialog/options';
import { menuLinks } from './constants';
import styles from './topBar.css';

Expand All @@ -19,37 +18,16 @@ class TopBar extends React.Component {
isDropdownEnable: false,
};

this.confirLogout = this.confirLogout.bind(this);
this.onLogout = this.onLogout.bind(this);
this.handleClick = this.handleClick.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
this.setDropdownRef = this.setDropdownRef.bind(this);
}

confirLogout() {
this.props.logOut();
this.props.closeDialog();
this.props.history.replace(`${routes.dashboard.path}`);
}

onLogout() {
Piwik.trackingEvent('Header', 'button', 'Open logout dialog');

this.props.setActiveDialog({
childComponent: Options,
childComponentProps: {
title: this.props.t('Logout'),
text: this.props.t('After logging out of your account you will be able to access the Dashboard, Settings and Search.'),
firstButton: {
text: this.props.t('Cancel'),
onClickHandler: this.props.closeDialog,
},
secondButton: {
text: this.props.t('Logout'),
onClickHandler: this.confirLogout,
},
},
});
this.props.logOut();
this.props.history.replace(`${routes.dashboard.path}`);
}

handleClick() {
Expand Down
8 changes: 6 additions & 2 deletions src/components/topBar/topBar.test.js
Expand Up @@ -20,6 +20,10 @@ describe('TopBar', () => {
location: { pathname: routes.dashboard.path },
showDelegate: false,
t: val => val,
logOut: sinon.spy(),
history: {
replace: () => {},
},
};

const history = {
Expand Down Expand Up @@ -82,9 +86,9 @@ describe('TopBar', () => {
it('logout user when user do a click on logout function', () => {
wrapper.find('.avatar').simulate('click');
wrapper.update();
wrapper.find('span.dropdownOption').simulate('click');
wrapper.find('.logout').simulate('click');
wrapper.update();
expect(myProps.setActiveDialog).have.been.calledWith();
expect(myProps.logOut).have.been.calledWith();
});

it('renders sign in component when user is logout', () => {
Expand Down
1 change: 0 additions & 1 deletion test/constants/selectors.js
Expand Up @@ -72,7 +72,6 @@ const ss = {
transactionId: '.transaction-id .copy-title',
logoutBtn: '.logout',
userAvatar: '.user-avatar',
dialogButtons: '.ok-button',
emptyResultsMessage: '.empty-message',
revealCheckbox: '.reveal-checkbox',
passphraseTextarea: 'textarea.passphrase',
Expand Down
1 change: 1 addition & 0 deletions test/cypress/e2e/account.spec.js
Expand Up @@ -24,6 +24,7 @@ describe('Account', () => {
cy.visit(`${urls.accounts}/${accounts.genesis.address}`);
cy.get(ss.leftBlockAccountExplorer).find(ss.delegateName).should('not.exist');
cy.visit(`${urls.accounts}/${accounts.delegate.address}`);
cy.wait(1000); // Avoid failing on jenkins
cy.get(ss.leftBlockAccountExplorer).find(ss.delegateName).contains(accounts.delegate.username);
});

Expand Down
2 changes: 0 additions & 2 deletions test/cypress/e2e/search.spec.js
Expand Up @@ -173,8 +173,6 @@ describe('Search', () => {
cy.visit('/');
cy.get(ss.userAvatar).click();
cy.get(ss.logoutBtn).click();
cy.clearLocalStorage();
cy.get(ss.dialogButtons).eq(1).click();
cy.get(ss.searchInput).click().type(`${accounts.delegate.username}`);
cy.get(ss.delegateResults).eq(0).click();
cy.get(ss.leftBlockAccountExplorer).find(ss.delegateName).should('have.text', accounts.delegate.username);
Expand Down

0 comments on commit 0847ca2

Please sign in to comment.