this.onResetTimer()}
- className={`${styles.reset} reset`}
- >
- {t('Reset')}
-
- )
- :
diff --git a/src/components/infoParagraph/index.js b/src/components/infoParagraph/index.js
deleted file mode 100644
index 72ca555f88..0000000000
--- a/src/components/infoParagraph/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import React from 'react';
-import FontIcon from 'react-toolbox/lib/font_icon';
-import layout from './infoParagraph.css';
-
-const InfoParagraph = props => (
-
-
-
-
-
-
- {props.children}
-
-
-
-
-);
-
-export default InfoParagraph;
diff --git a/src/components/infoParagraph/infoParagraph.css b/src/components/infoParagraph/infoParagraph.css
deleted file mode 100644
index 328265120a..0000000000
--- a/src/components/infoParagraph/infoParagraph.css
+++ /dev/null
@@ -1,18 +0,0 @@
-.layout-margin {
- display: inline-block;
- margin: 8px;
-}
-
-.layout-padding {
- display: inline-block;
- padding: 8px;
-}
-
-.layout-row {
- display: flex;
- flex-direction: row;
-}
-
-.layout-align-center-center {
- align-items: center;
-}
diff --git a/src/components/mainMenu/index.js b/src/components/mainMenu/index.js
deleted file mode 100644
index 9c718ca866..0000000000
--- a/src/components/mainMenu/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// istanbul ignore file
-import { connect } from 'react-redux';
-import { withRouter } from 'react-router';
-import { translate } from 'react-i18next';
-import { feedbackDialogDisplayed } from '../../actions/dialog';
-import MainMenu from './mainMenu';
-
-const mapStateToProps = state => ({
- account: state.account,
- showDelegate: state.settings.advancedMode,
-});
-
-const mapDispatchToProps = {
- feedbackDialogDisplayed,
-};
-
-export default withRouter(connect(mapStateToProps, mapDispatchToProps)(translate()(MainMenu)));
diff --git a/src/components/mainMenu/mainMenu.css b/src/components/mainMenu/mainMenu.css
deleted file mode 100644
index 34e8e3c638..0000000000
--- a/src/components/mainMenu/mainMenu.css
+++ /dev/null
@@ -1,357 +0,0 @@
-@import '../app/variables.css';
-
-:root {
- --menu-background-color: var(--color-white);
- --menu-item-active-gradient: linear-gradient(-27deg, #004aff 4%, #57afff 61%, #93f4fe 100%);
- --menu-item-active-border-width: 7px;
- --menu-item-active-color: linear-gradient(90deg, #fff 0%, #eaeff7 100%);
- --more-menu-color: var(--color-grayscale-medium);
- --offcanvas-menu-border-color: var(--color-grayscale-light);
- --more-menu-border-color: var(--color-grayscale-medium);
- --read-more-font-size: 17px;
- --read-more-icon-font-size: 65px;
- --close-icon-font-size: 35px;
-}
-
-.sideBarWrapper {
- text-align: center;
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- height: 100%;
-}
-
-.aside {
- transform: translateX(-100%);
- opacity: 0.5;
- transition: all ease 300ms;
- transition-delay: 200ms;
- box-shadow: var(--normal-shadow);
-}
-
-:global(.appLoaded) .aside {
- opacity: 1;
- transform: translateX(0);
-}
-
-.logo {
- margin: 40px 0 44px;
- height: 50px;
-}
-
-.more {
- color: var(--more-menu-color);
- border-top: 1px solid var(--more-menu-border-color);
- background: var(--menu-background-color);
- position: absolute;
- width: 100%;
- left: 0;
- bottom: 0;
- padding: 20px 0 30px;
- cursor: pointer;
-}
-
-.tab {
- background: var(--menu-background-color);
- text-align: center;
- box-shadow: none;
- width: 100% !important;
- max-width: 100% !important;
- border: none !important;
- padding: 20px 10px !important;
-}
-
-.navigationContainer {
- overflow: hidden;
- margin-left: -2px;
- flex: 0 1 auto;
- flex-flow: row wrap;
-}
-
-.drawer {
- width: 480px;
- background: #fff;
- max-width: 100%;
-
- &.left {
- border-right: none;
- left: 0;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
-}
-
-.homeLink {
- margin: 5px auto;
-}
-
-@media (max-height: 920px) {
- .drawer.left {
- display: block;
- height: 100%;
- }
-}
-
-.header {
- align-items: center;
- width: 100%;
- display: flex;
- justify-content: space-between;
- padding: 0 40px 0 60px;
- background: #fff;
-}
-
-.close {
- font-size: var(--close-icon-font-size);
- display: flex;
- width: auto;
- cursor: pointer;
- color: var(--more-menu-color);
-}
-
-@media (--medium-viewport) {
- .aside {
- display: none;
- }
-
- .header {
- padding: 0;
- }
-
- .close {
- display: none;
- }
-
- .logo {
- margin: 20px auto;
- height: 42px;
- }
-}
-
-.label {
- padding: 4.5vh 10px; /* stylelint-disable-line */
- font-size: var(--main-menu-font-size);
- color: var(--color-black);
- font-weight: bold;
- font-family: var(--heading-font);
- display: flex;
- flex: 0 0 auto;
- width: 50%;
- text-align: center;
- flex-grow: 1;
- text-transform: capitalize;
- border-right: 1px solid var(--offcanvas-menu-border-color);
- border-bottom: 1px solid var(--offcanvas-menu-border-color);
- background: #fff;
- max-width: 50%;
-
- &:nth-child(2n) {
- border-right: none !important;
- }
-
- &:nth-child(1) {
- border-top: 1px solid var(--offcanvas-menu-border-color);
- }
-
- &:nth-child(2) {
- border-top: 1px solid var(--offcanvas-menu-border-color);
- }
-
- & > div {
- width: 100%;
-
- &:hover {
- filter: brightness(1.1);
- }
- }
-
- & span {
- display: block;
- margin: 10px 0 0;
- }
-
- & img {
- width: 55px;
- }
-
- & > .rippleWrapper {
- display: none;
- }
-}
-
-.navigationContainer .navigation {
- padding-left: 0;
- box-shadow: none;
- margin-left: 2px;
- display: flex;
- flex-flow: row wrap;
-}
-
-.tabs nav {
- overflow: hidden;
-}
-
-.bottomIcon {
- width: 22px;
- height: 22px;
- font-size: 22px;
-}
-
-.topTabs {
- overflow-y: auto;
- height: auto;
- display: block;
- margin-bottom: 150px;
-}
-
-.bottomTabs {
- position: absolute;
- bottom: 32px;
- right: 0;
- left: 0;
- overflow-x: hidden;
-
- & .label {
- color: var(--color-grayscale-medium);
- font-family: var(--content-font);
- font-size: 12px;
- font-weight: var(--font-weight-bold);
- line-height: 18px;
-
- &.active {
- background: linear-gradient(90deg, var(--color-white) 0%, #eaeff7 100%);
- color: var(--color-grayscale-medium);
-
- &::before {
- display: none;
- }
- }
-
- & span:first-child {
- margin-right: 3px;
- margin-top: 3px;
- }
-
- & span:last-child {
- margin: 5px 0 0;
- }
-
- & > div {
- display: flex;
- flex-direction: row;
- align-items: flex-start;
- transition: all ease 300ms;
- margin-left: 5px;
- }
-
- & img {
- width: 25px;
- height: 25px;
- margin-right: 10px;
- }
- }
-
- & .bottomTab {
- text-decoration: none;
- font-weight: var(--font-weight-bold);
- background: var(--menu-background-color);
- box-shadow: none;
- width: 100%;
- max-width: 100%;
- border: none;
- padding: 5px 10px;
- }
-}
-
-.pointer {
- display: none;
-}
-
-.arrowContainer {
- display: none;
-}
-
-.label.active {
- position: relative;
- background: var(--menu-item-active-color);
- color: var(--color-black);
- opacity: 1;
-
- &::before {
- position: absolute;
- width: var(--menu-item-active-border-width);
- height: 100%;
- top: 0;
- right: 0;
- content: '';
- display: block;
- opacity: 0.8;
- background-image: var(--menu-item-active-gradient);
- }
-}
-
-.readMoreText {
- font-size: var(--read-more-font-size);
- font-weight: bold;
- text-transform: capitalize;
- font-family: 'gilroy', 'Open Sans', sans-serif;
-}
-
-.readMoreIcon {
- font-size: var(--read-more-icon-font-size);
- width: 100%;
-}
-
-@media (--medium-viewport) {
- .sideBarWrapper {
- display: none;
- }
-
- .navigationContainer .navigation {
- justify-content: center;
- }
-
- .bottomTabs {
- & .label {
- & > div {
- margin-left: 0;
- }
-
- &.active {
- background: none;
- }
- }
-
- & .bottomTab {
- max-width: 100px;
- }
- }
-}
-
-@media (--xSmall-viewport) {
- .sideBarWrapper {
- display: none;
- }
-
- .label {
- padding: 25px 10px;
- }
-
- .label.active::before {
- top: auto;
- width: 100%;
- bottom: 0;
- height: 5px;
- }
-}
-
-@media (--xLarge-viewport) {
- .bottomTabs {
- & .label {
- & > div {
- margin-left: 20px;
- }
- }
- }
-}
diff --git a/src/components/mainMenu/mainMenu.js b/src/components/mainMenu/mainMenu.js
deleted file mode 100644
index a51d31d23a..0000000000
--- a/src/components/mainMenu/mainMenu.js
+++ /dev/null
@@ -1,232 +0,0 @@
-import React, { Fragment } from 'react';
-import { Link } from 'react-router-dom';
-import { Tab, Tabs as ToolboxTabs } from 'react-toolbox/lib/tabs';
-import Drawer from 'react-toolbox/lib/drawer';
-
-import MenuBar from '../menuBar';
-import styles from './mainMenu.css';
-import logo from '../../assets/images/Lisk-Logo.svg';
-import * as menuLogos from '../../assets/images/main-menu-icons/*.svg'; //eslint-disable-line
-import { FontIcon } from '../fontIcon';
-import routes from '../../constants/routes';
-import feedbackLinks from '../../constants/feedbackLinks';
-import Piwik from '../../utils/piwik';
-
-const getIndex = (history, tabs) => {
- let index = -1;
- tabs.map(t => new RegExp(`${t.route}(\\/?)`)).forEach((item, i) => {
- if (history.location.pathname.match(item)) {
- index = i;
- }
- });
- return index;
-};
-
-const TabTemplate = ({ img, label, isFontIcon }) => (
-
- {
- !isFontIcon
- ?
- :
- }
-
{label}
-
-);
-
-
-class MainMenu extends React.Component {
- constructor() {
- super();
- this.state = {
- active: false,
- setting: false,
- index: 0,
- };
- }
-
- menuToggle() {
- Piwik.trackingEvent('MainMenu', 'link', 'Menu toggle');
- const setting = !this.state.active ? false : this.state.setting;
- this.setState({ active: !this.state.active, setting });
- }
-
- navigate(history, tabs, index) {
- this.setState({ active: false, index });
- if (tabs[index].id === 'feedback') {
- this.props.feedbackDialogDisplayed({
- childComponentProps: {
- title: this.props.t('Tell us what you think'),
- },
- });
- return;
- }
- history.push(tabs[index].route);
- }
-
- settingToggle() {
- this.setState({
- setting: !this.state.setting,
- });
- }
-
- render() {
- const {
- history, t, showDelegate, account,
- } = this.props;
- let tabs = [
- {
- label: t('Dashboard'),
- route: `${routes.dashboard.path}`,
- id: 'dashboard',
- image: menuLogos.dashboard,
- enabledWhenNotLoggedIn: true,
- }, {
- label: t('Wallet'),
- route: `${routes.wallet.path}`,
- id: 'transactions',
- image: menuLogos.wallet,
- }, {
- label: t('Delegates'),
- id: 'delegates',
- route: `${routes.delegates.path}`,
- image: menuLogos.delegates,
- }, {
- label: t('Sidechains'),
- route: `${routes.sidechains.path}`,
- id: 'sidechains',
- image: menuLogos.sidechains,
- },
- ];
-
- const bottomMenuTabs = [
- {
- label: t('Settings'),
- route: `${routes.setting.path}`,
- id: 'settings',
- image: 'settings',
- enabledWhenNotLoggedIn: true,
- },
- {
- label: t('Help'),
- route: `${routes.help.path}`,
- id: 'help',
- image: 'logo-icon',
- enabledWhenNotLoggedIn: true,
- },
- ];
-
- if (!showDelegate) {
- tabs = tabs.filter(tab => tab.id !== 'delegates');
- }
-
- return (
-
-
-
-
-
- {tabs.map(({
- label, image, id, enabledWhenNotLoggedIn,
- }, index) => (
- }
- className={styles.tab}
- id={id}
- disabled={!account.address && !enabledWhenNotLoggedIn}
- />
- ))}
-
-
- {bottomMenuTabs.map(({
- label, image, id, route,
- }, index) => (
-
-
-
- ))}
-
-
-
-
-
-
-
-
-
-
-
- {tabs.map(({
- label, image, id, enabledWhenNotLoggedIn,
- }, index) => (
- }
- id={id}
- disabled={!account.address && !enabledWhenNotLoggedIn}
- />
- ))}
-
-
-
- {bottomMenuTabs.map(({
- label, image, id, enabledWhenNotLoggedIn,
- }, index) => (
- }
- className={styles.bottomTab}
- id={id}
- disabled={!account.address && !enabledWhenNotLoggedIn}
- />
- ))}
-
-
-
-
-
-
-
- );
- }
-}
-
-export default MainMenu;
diff --git a/src/components/mainMenu/mainMenu.test.js b/src/components/mainMenu/mainMenu.test.js
deleted file mode 100644
index 2a679c8aae..0000000000
--- a/src/components/mainMenu/mainMenu.test.js
+++ /dev/null
@@ -1,131 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { Tab, Tabs as ToolboxTabs } from 'react-toolbox';
-import { MemoryRouter } from 'react-router-dom';
-import configureMockStore from 'redux-mock-store';
-import sinon from 'sinon';
-import PropTypes from 'prop-types';
-import i18n from '../../i18n';
-import MainMenu from './mainMenu';
-import routes from '../../constants/routes';
-
-describe('MainMenu', () => {
- // Mocking store
- const peers = {
- status: {
- online: false,
- },
- data: {
- currentPeer: 'localhost',
- port: 4000,
- options: {
- name: 'Custom Node',
- },
- },
- };
- const account = {
- isDelegate: false,
- address: '16313739661670634666L',
- username: 'lisk-hub',
- };
- const store = configureMockStore([])({
- peers,
- account,
- liskAPIClientSet: () => {},
- settings: {
- autoLog: true,
- advancedMode: true,
- },
- });
-
- const history = {
- location: {
- pathname: `${routes.delegates.path}`,
- },
- push: sinon.spy(),
- };
-
-
- const options = {
- context: { store, history, i18n },
- childContextTypes: {
- store: PropTypes.object.isRequired,
- history: PropTypes.object.isRequired,
- i18n: PropTypes.object.isRequired,
- },
- lifecycleExperimental: true,
- };
- let clock;
-
- const t = key => key;
-
- const props = {
- showDelegate: false,
- t,
- account,
- store,
- history,
- feedbackDialogDisplayed: sinon.spy(),
- };
-
- beforeEach(() => {
- clock = sinon.useFakeTimers({
- toFake: ['setTimeout', 'clearTimeout', 'Date', 'setInterval'],
- });
- });
-
- afterEach(() => {
- clock.restore();
- });
-
- it('should render react toolbox Tabs component', () => {
- const wrapper = mount(
-
- , options);
- expect(wrapper.find(ToolboxTabs).exists()).to.equal(true);
- });
-
- it('should render 4 Button components if props.showDelegate', () => {
- const wrapper = mount(
-
- , options);
- expect(wrapper.find(Tab)).to.have.lengthOf(4);
- });
-
- it('should render 3 menu item components if !props.isDelegate', () => {
- const wrapper = mount(
-
- , options);
- expect(wrapper.find(Tab)).to.have.lengthOf(3);
- });
-
- it('should all Tab be disabled except Dashboard and if !props.account.address', () => {
- const wrapper = mount(
-
- , options);
- expect(wrapper.find(Tab).at(0).props().disabled).not.to.be.equal(true);
- expect(wrapper.find(Tab).at(1).props().disabled).to.be.equal(true);
- expect(wrapper.find(Tab).at(2).props().disabled).to.be.equal(true);
- });
-
- it('should allow to change active menu item', () => {
- const wrapper = mount(
-
- , options);
-
- expect(wrapper).to.not.have.descendants('#feedback');
- wrapper.find(Tab).at(1).simulate('click');
- expect(history.push).to.have.been.calledWith(`${routes.wallet.path}`);
- });
-
- it('should click on more activate the drawer', () => {
- const wrapper = mount(
-
- , options);
- wrapper.find('.menu-button').simulate('click');
- clock.tick(100);
- wrapper.update();
- expect(wrapper.find('Drawer').props().active).to.be.equal(true);
- });
-});
diff --git a/src/components/menuBar/index.js b/src/components/menuBar/index.js
deleted file mode 100644
index f4768b2928..0000000000
--- a/src/components/menuBar/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import { connect } from 'react-redux';
-import { withRouter } from 'react-router';
-import { translate } from 'react-i18next';
-import MenuBar from './menuBar';
-
-const mapStateToProps = state => ({
- isDelegate: state.account.isDelegate,
-});
-
-export default withRouter(connect(mapStateToProps)(translate()(MenuBar)));
diff --git a/src/components/menuBar/menuBar.css b/src/components/menuBar/menuBar.css
deleted file mode 100644
index 360eba9e9c..0000000000
--- a/src/components/menuBar/menuBar.css
+++ /dev/null
@@ -1,78 +0,0 @@
-@import '../app/variables.css';
-
-:root {
- --menu-bar-padding: 20px;
- --menu-bar-font-size-m: 24px;
- --menu-bar-font-size-s: 18px;
-}
-
-.menuBar {
- display: none;
- z-index: 100 !important;
-}
-
-.openMenu {
- z-index: 1000 !important;
- box-shadow: none !important;
-}
-
-.icon {
- font-size: 25px !important;
- margin-top: 2px;
- margin-left: 5px;
-
- &.goBack {
- margin-left: -5px;
- }
-}
-
-@media (--medium-viewport) {
- .menuBar {
- position: fixed;
- display: flex;
- height: var(--m-menu-bar-height);
- width: 100%;
- bottom: 0;
- left: 0;
- box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.12), 0 -2px 24px 0 rgba(0, 0, 0, 0.24);
- font-weight: bold;
- font-size: var(--menu-bar-font-size-m);
- font-family: var(--heading-font);
- background-color: var(--color-white);
- flex-direction: row-reverse;
- justify-content: space-between;
- }
-
- .menuButton {
- display: flex;
- padding: var(--menu-bar-padding);
- cursor: pointer;
- user-select: none;
-
- & > * {
- font-size: inherit;
- vertical-align: middle;
- }
- }
-}
-
-@media (--small-viewport) {
- .menuBar {
- height: var(--s-menu-bar-height);
- font-size: var(--menu-bar-font-size-s);
- }
-
- .setting {
- display: none;
- }
-
- .icon {
- margin-top: -2px;
- }
-}
-
-@media (--xSmall-viewport) {
- .setting {
- display: flex;
- }
-}
diff --git a/src/components/menuBar/menuBar.js b/src/components/menuBar/menuBar.js
deleted file mode 100644
index 297265a0c9..0000000000
--- a/src/components/menuBar/menuBar.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from 'react';
-import { FontIcon } from '../fontIcon';
-import styles from './menuBar.css';
-
-const MenuBar = (props) => {
- const { t, menuStatus, menuToggle } = props;
- const menuClass = menuStatus ? styles.openMenu : '';
- return (
-
- {!menuStatus
- ? (
- menuToggle()}
- >
- {t('Menu')}
-
-
- )
- : (
- menuToggle()}
- >
- {t('Close')}
- {' '}
-
-
- )
- }
-
- );
-};
-
-export default MenuBar;
diff --git a/src/components/menuBar/menuBar.test.js b/src/components/menuBar/menuBar.test.js
deleted file mode 100644
index e3edde0492..0000000000
--- a/src/components/menuBar/menuBar.test.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import MenuBar from './menuBar';
-
-describe('MenuBar', () => {
- let wrapper;
- const props = {
- t: key => key,
- menuStatus: false,
- settingStatus: false,
- };
-
- props.menuToggle = () => { props.menuStatus = !props.menuStatus; };
-
- /**
- * Clicks on the given element in Component
- * then updates the component
- *
- * @param {String} selector - Valid css selector
- */
- const clickAndUpdate = (selector) => {
- wrapper.find(selector).simulate('click');
- wrapper = mount(
);
- };
-
- const getClassList = selector => wrapper.find(selector).props().className;
-
- it('should call menuToggle when menuButton called', () => {
- wrapper = mount(
);
- const buttonSelector = '.menu-button';
- expect(getClassList(buttonSelector)).to.include('expand');
- // clicking on menu shows the close button
- clickAndUpdate(buttonSelector);
- expect(getClassList(buttonSelector)).to.include('close');
-
- // the second click reverts to initial state
- clickAndUpdate(buttonSelector);
- expect(getClassList(buttonSelector)).to.include('expand');
- });
-});
diff --git a/src/components/parallax/index.js b/src/components/parallax/index.js
deleted file mode 100644
index 7cbc3d6ad8..0000000000
--- a/src/components/parallax/index.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from 'react';
-import ParallaxJs from 'parallax-js';
-import options from './options';
-
-class Parallax extends React.Component {
- constructor() {
- super();
-
- this.state = {};
- }
-
- componentDidMount() {
- const settings = {};
- Object.keys(this.props).forEach((prop) => {
- if (options.includes(prop)) {
- settings[prop] = this.props[prop];
- }
- });
-
- this.parallaxInstance = new ParallaxJs(this.wrapper, settings);
- }
-
- render() {
- return (
-
{ this.wrapper = el; }}
- >
- {this.props.children}
-
- );
- }
-}
-
-export default Parallax;
diff --git a/src/components/parallax/index.test.js b/src/components/parallax/index.test.js
deleted file mode 100644
index d74c325749..0000000000
--- a/src/components/parallax/index.test.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import Parallax from './index';
-
-describe('Parallax', () => {
- let wrapper;
-
- beforeEach(() => {
- wrapper = mount(
- Child 1
- Child 2
- );
- });
-
- it('should mount its children', () => {
- expect(wrapper.find('.child')).to.have.lengthOf(2);
- });
-
- it('should run Parallax on its children', () => {
- const child0Html = wrapper.find('.child').at(0).html();
- const child1Html = wrapper.find('.child').at(1).html();
- expect(child0Html).to.include('transform: translate3d');
- expect(child1Html).to.include('transform: translate3d');
- });
-});
diff --git a/src/components/parallax/options.js b/src/components/parallax/options.js
deleted file mode 100644
index 6cca7f176c..0000000000
--- a/src/components/parallax/options.js
+++ /dev/null
@@ -1,22 +0,0 @@
-export default [
- 'relativeInput',
- 'clipRelativeInput',
- 'hoverOnly',
- 'inputElement',
- 'calibrateX',
- 'calibrateY',
- 'invertX',
- 'invertY',
- 'limitX',
- 'limitY',
- 'scalarX',
- 'scalarY',
- 'frictionX',
- 'frictionY',
- 'originX',
- 'originY',
- 'precision',
- 'selector',
- 'pointerEvents',
- 'onReady',
-];
diff --git a/src/components/passphraseInput/index.js b/src/components/passphraseInput/index.js
deleted file mode 100644
index a0130c1987..0000000000
--- a/src/components/passphraseInput/index.js
+++ /dev/null
@@ -1,162 +0,0 @@
-import { translate } from 'react-i18next';
-import React from 'react';
-import grid from 'flexboxgrid/dist/flexboxgrid.css';
-import { FontIcon } from '../fontIcon';
-import ToolBoxInput from '../toolbox/inputs/toolBoxInput';
-import { isValidPassphrase, getPassphraseValidationErrors } from '../../utils/passphrase';
-import styles from './passphraseInput.css';
-import keyCodes from '../../constants/keyCodes';
-import Piwik from '../../utils/piwik';
-
-class PassphraseInput extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- inputType: 'password',
- isFocused: this.props.isFocused || false,
- partialPassphraseError: [],
- focus: 0,
- };
- }
-
- setFocusedField(field) {
- this.setState({ focus: field });
- }
-
- handleValueChange(index, value) { // eslint-disable-line max-statements
- let insertedValue = value.trim().replace(/\W+/g, ' ');
- const insertedValueAsArray = insertedValue.split(' ');
- let passphrase = this.props.value.split(' ');
-
- if (insertedValueAsArray.length > 1) {
- for (let i = 0; i < 12; i++) {
- if (insertedValueAsArray[i]) {
- passphrase[i] = insertedValueAsArray[i];
- this.setState({ focus: i });
- }
- }
- insertedValue = insertedValueAsArray[index];
- }
-
- passphrase[index] = insertedValue;
- passphrase = passphrase.join(' ');
-
- let error;
-
- this.setState({ partialPassphraseError: [] });
- if (!passphrase) {
- error = this.props.t('Required');
- } else if (!isValidPassphrase(passphrase)) {
- error = this.getPassphraseValidationError(passphrase);
- }
- this.props.onChange(passphrase, error);
- }
-
- // eslint-disable-next-line class-methods-use-this
- getPassphraseValidationError(passphrase) {
- const { partialPassphraseError, validationError } = getPassphraseValidationErrors(passphrase);
- this.setState({ partialPassphraseError });
-
- return validationError;
- }
-
- toggleInputType() {
- Piwik.trackingEvent('PassphraseInput', 'button', 'Toggle input type');
- this.setState({ inputType: this.state.inputType === 'password' ? 'text' : 'password' });
- }
-
- keyAction({ event, value, index }) {
- if (event.which === keyCodes.space || event.which === keyCodes.arrowRight) {
- event.preventDefault();
- this.setState({ focus: index + 1 });
- }
-
- if ((event.which === keyCodes.delete && !value) || event.which === keyCodes.arrowLeft) {
- this.setState({ focus: index - 1 });
- }
- }
-
- setFocused() {
- Piwik.trackingEvent('PassphraseInput', 'button', 'Set focused');
- if (this.props.onFocus) this.props.onFocus();
- this.setState({ isFocused: true });
- }
-
- focusAndPaste(value) {
- this.setFocused();
- this.handleValueChange(0, value);
- }
-
- render() {
- const propsColumns = this.props.columns;
- const xs = `col-xs-${propsColumns && propsColumns.xs ? propsColumns.xs : '6'}`;
- const sm = `col-sm-${propsColumns && propsColumns.sm ? propsColumns.sm : '2'}`;
- const md = `col-md-${propsColumns && propsColumns.md ? propsColumns.md : '2'}`;
-
- const value = this.props.value.split(' ');
- return (
-
- {this.state.isFocused
- ? (
-
-
-
- {' '}
- {this.state.inputType === 'password' ? this.props.t('Show passphrase') : this.props.t('Hide passphrase') }
-
-
- {[...Array(12)].map((x, i) => (
-
- {
- const val = e.target.value;
- e.target.value = '';
- e.target.value = val;
-
- this.setFocusedField(i);
- }}
- onBlur={this.setFocusedField.bind(this, null)}
- onChange={(val) => {
- this.handleValueChange(i, val);
- }}
- onKeyDown={(event) => {
- this.keyAction({ event, value: value[i], index: i });
- }}
- index={i}
- />
-
- ))}
-
-
{this.props.error}
-
- )
- : (
-
- )
- }
-
- );
- }
-}
-
-export { PassphraseInput };
-// eslint-disable-next-line import/no-named-as-default
-export default translate()(PassphraseInput);
diff --git a/src/components/passphraseInput/index.test.js b/src/components/passphraseInput/index.test.js
deleted file mode 100644
index 5eba6634c6..0000000000
--- a/src/components/passphraseInput/index.test.js
+++ /dev/null
@@ -1,188 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { spy } from 'sinon';
-import { mount } from 'enzyme';
-import PropTypes from 'prop-types';
-
-import accounts from '../../../test/constants/accounts';
-import i18n from '../../i18n';
-import PassphraseInputHOC, { PassphraseInput } from './index';
-import keyCodes from '../../constants/keyCodes';
-
-describe('PassphraseInput', () => {
- let wrapper;
- let props;
- let onChangeSpy;
-
- describe('with HOC', () => {
- beforeEach(() => {
- props = {
- error: '',
- value: '',
- onChange: key => key,
- i18n,
- };
- onChangeSpy = spy(props, 'onChange');
- wrapper = mount(
);
- });
-
- afterEach(() => {
- onChangeSpy.restore();
- });
-
- it('should call props.onChange with error=undefined if a valid passphrase is entered', () => {
- const { passphrase } = accounts.genesis;
- wrapper.find('input').first().simulate('change', { target: { value: passphrase } });
- expect(wrapper.props().onChange).to.have.been.calledWith(passphrase, undefined);
- });
-
- it('should call props.onChange with error="Required" if an empty passphrase is entered', () => {
- const passphrase = '';
- wrapper.find('input').first().simulate('change', { target: { value: passphrase } });
- expect(wrapper.props().onChange).to.have.been.calledWith(passphrase, 'Required');
- });
-
- const ONLY_ONE_WORD_ERROR = 'Passphrase should have 12 words, entered passphrase has 1';
- it(`should call props.onChange with error="${ONLY_ONE_WORD_ERROR}" if an "test" passphrase is entered`, () => {
- const passphrase = 'test';
- wrapper.find('input').first().simulate('change', { target: { value: passphrase } });
- wrapper.setProps({ value: passphrase });
- expect(wrapper.props().onChange).to.have.been.calledWith(passphrase, ONLY_ONE_WORD_ERROR);
- });
-
- const NOT_VALID_ERROR = 'Passphrase is not valid';
- it(`should call props.onChange with error="${NOT_VALID_ERROR}" if an otherwise invalid passphrase is entered`, () => {
- const passphrase = 'stock wagon borrow episode laundry kitten salute link globe zero feed marble';
- wrapper.find('input').first().simulate('change', { target: { value: passphrase } });
- expect(wrapper.props().onChange).to.have.been.calledWith(passphrase, NOT_VALID_ERROR);
- });
-
- it('should allow to change the input field to type="text" and back', () => {
- expect(wrapper.find('input').first().props().type).to.equal('password');
- wrapper.find('input').first().simulate('click');
- wrapper.find('.show-passphrase-toggle').simulate('click');
- expect(wrapper.find('input').first().props().type).to.equal('text');
- wrapper.find('.show-passphrase-toggle').simulate('click');
- expect(wrapper.find('input').first().props().type).to.equal('password');
- });
- });
-
-
- describe('without HOC', () => {
- beforeEach(() => {
- props = {
- error: '',
- value: '',
- onChange: () => {},
- i18n,
- t: key => key,
- };
-
- onChangeSpy = spy(props, 'onChange');
-
- const options = {
- context: { i18n },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- },
- };
-
- wrapper = mount(
, options);
- });
-
- afterEach(() => {
- onChangeSpy.restore();
- });
-
- it('should highlight invalid words if a passphrase with an invalid word is entered', () => {
- const errorMessage = 'Please check the highlighted words';
- let passphrase = 'wagon stock borrow episode laundry kitten salute link globe zero feed marble';
- wrapper.find('input').first().simulate('change', { target: { value: passphrase } });
- expect(wrapper.props().onChange).to.not.have.been.calledWith(passphrase, errorMessage);
- passphrase = 'wagonn stock borrow episode laundry kitten salute link globe zero feed marble';
- wrapper.find('input').first().simulate('change', { target: { value: passphrase } });
- expect(wrapper.state('partialPassphraseError')[0]).to.equal(true);
- expect(wrapper.props().onChange).to.have.been.calledWith(passphrase, errorMessage);
- });
-
- it('should focus input on click', () => {
- expect(wrapper.find('input')).to.have.length(1);
- expect(wrapper.state('isFocused')).to.equal(false);
- wrapper.find('input').first().simulate('click');
- expect(wrapper.state('isFocused')).to.equal(true);
- expect(wrapper.find('input')).to.have.length(12);
- });
-
- it('should handle paste a passphrase', () => {
- expect(wrapper.state('isFocused')).to.equal(false);
- expect(wrapper.find('input')).to.have.length(1);
- const passphrase = 'stock wagon borrow episode laundry kitten salute link globe zero feed marble';
- wrapper.find('input').first().simulate('change', { target: { value: passphrase } });
- expect(wrapper.state('isFocused')).to.equal(true);
- expect(wrapper.find('input')).to.have.length(12);
- expect(wrapper.props().onChange).to.have.been.calledWith(passphrase);
- });
-
- it('should focus next element on space press', () => {
- expect(wrapper.state('focus')).to.equal(0);
- wrapper.find('input').first().simulate('click');
- wrapper.find('input').first().simulate('keyDown', {
- keyCode: keyCodes.space,
- which: keyCodes.space,
- });
- expect(wrapper.state('focus')).to.equal(1);
- });
-
- it('should focus next element on arrow right and previous element on left press', () => {
- expect(wrapper.state('focus')).to.equal(0);
- wrapper.find('input').first().simulate('click');
- wrapper.find('input').first().simulate('keyDown', {
- keyCode: keyCodes.arrowRight,
- which: keyCodes.arrowRight,
- });
- expect(wrapper.state('focus')).to.equal(1);
- wrapper.find('input').at(1).simulate('keyDown', {
- keyCode: keyCodes.arrowLeft,
- which: keyCodes.arrowLeft,
- });
- expect(wrapper.state('focus')).to.equal(0);
- });
-
- it('should focus previous element on backspace press', () => {
- expect(wrapper.state('focus')).to.equal(0);
- wrapper.find('input').first().simulate('click');
- wrapper.find('input').first().simulate('keyDown', {
- keyCode: keyCodes.arrowRight,
- which: keyCodes.arrowRight,
- });
- expect(wrapper.state('focus')).to.equal(1);
- wrapper.find('input').at(1).simulate('keyDown', {
- keyCode: keyCodes.delete,
- which: keyCodes.delete,
- });
- expect(wrapper.state('focus')).to.equal(0);
- });
-
- it('should render partial input correctly on load', () => {
- wrapper.find('input').first().simulate('click');
-
- expect(wrapper.find('input').at(0).props().shouldfocus).to.equal(1);
- expect(wrapper.find('input').at(0).props().type).to.equal('password');
- expect(wrapper.find('input').at(0).props().placeholder.toLowerCase()).to.equal('start here');
- expect(wrapper.find('input').at(0).props().value).to.equal('');
-
- expect(wrapper.find('input').at(1).props().shouldfocus).to.equal(0);
- expect(wrapper.find('input').at(1).props().type).to.equal('password');
- expect(wrapper.find('input').at(1).props().placeholder).to.equal('');
- expect(wrapper.find('input').at(0).props().value).to.equal('');
- });
-
- it('should change focused element on focus and blur', () => {
- wrapper.find('input').first().simulate('click');
- wrapper.find('input').at(1).simulate('focus');
- expect(wrapper.find('input').at(1).props().shouldfocus).to.equal(1);
- wrapper.find('input').at(1).simulate('blur');
- expect(wrapper.find('input').at(1).props().shouldfocus).to.equal(0);
- });
- });
-});
diff --git a/src/components/passphraseInput/passphraseInput.css b/src/components/passphraseInput/passphraseInput.css
deleted file mode 100644
index 6e1c62ca37..0000000000
--- a/src/components/passphraseInput/passphraseInput.css
+++ /dev/null
@@ -1,85 +0,0 @@
-@import '../app/variables.css';
-
-:root {
- --icon-font-size: 22px;
- --tab-inactive-color: --color-grayscale-dark;
- --error-font-size-XL: 16px;
- --error-font-size-L: 14px;
-}
-
-.wrapper {
- position: relative;
-}
-
-.checkbox {
- visibility: hidden;
- position: hidden;
-}
-
-.inputTypeToggle {
- position: absolute;
- right: 0;
- font-size: 16px;
- font-weight: var(--font-weight-semi-bold);
- color: #2475b9 !important;
- top: -25px;
- cursor: pointer;
-
- & label {
- text-transform: capitalize;
- }
-
- & .eyeIcon {
- font-size: var(--icon-font-size);
- }
-}
-
-.inputWrapper input {
- padding-right: 35px;
- border-radius: 0;
-}
-
-.errorMessage {
- color: var(--color-error);
- height: 20px;
- font-weight: var(--font-weight-semi-bold);
- padding-top: 10px;
-}
-
-.error input {
- color: var(--color-error) !important;
-}
-
-.partial input {
- text-align: center;
- border-radius: 0;
-}
-
-@media (--small-viewport) {
- .inputTypeToggle {
- top: 10px;
- width: 100%;
- text-align: center;
- }
-
- .errorMessage {
- padding-bottom: 10px;
- }
-
- .wrapper {
- margin-top: 0;
- padding-top: 40px;
- }
-}
-
-@media (--large-viewport) {
- .errorMessage {
- font-size: var(--error-font-size-L);
- }
-}
-
-@media (--xLarge-viewport) {
- .errorMessage {
- font-size: var(--error-font-size-XL);
- }
-}
diff --git a/src/components/passphraseSteps/index.js b/src/components/passphraseSteps/index.js
deleted file mode 100644
index 79623bcf22..0000000000
--- a/src/components/passphraseSteps/index.js
+++ /dev/null
@@ -1,206 +0,0 @@
-import React from 'react';
-import { connect } from 'react-redux';
-import { translate } from 'react-i18next';
-import grid from 'flexboxgrid/dist/flexboxgrid.css';
-import { extractPublicKey, getActiveTokenAccount } from '../../utils/account';
-import { Button } from '../toolbox/buttons/button';
-// eslint-disable-next-line import/no-named-as-default
-import PassphraseInput from '../passphraseInput';
-import { passphraseIsValid, authStatePrefill } from '../../utils/form';
-import Piwik from '../../utils/piwik';
-import styles from './passphraseSteps.css';
-
-class PassphraseSteps extends React.Component {
- constructor(props) {
- super(props);
-
- this.state = {
- done: {
- passphrase: false,
- secondPassphrase: false,
- },
- ...authStatePrefill(this.props.account),
- };
- }
-
- componentDidMount() {
- if (this.props.account.secondPublicKey) {
- this.setState({
- secondPassphrase: {
- value: '',
- error: '',
- },
- });
- }
-
- if ((this.props.account.hwInfo && this.props.account.hwInfo.deviceId)
- || (this.props.account.passphrase
- && !this.props.account.secondPublicKey)) {
- this.props.nextStep({
- ...this.props,
- ...authStatePrefill(this.props.account),
- skipped: true,
- });
- }
-
- if (typeof this.props.onMount === 'function') {
- this.props.onMount(true, 'PassphraseSteps');
- }
- }
-
- hasCorrectPassphrases() {
- const firstPPAndDone = !this.props.account.passphrase && this.state.done.passphrase;
- const secondPPAndDone = this.props.account.secondPublicKey && this.state.done.secondPassphrase;
- const onlyFirstPPAndDone = firstPPAndDone && !this.props.account.secondPublicKey;
- const onlySecondPPAndDone = secondPPAndDone && !!this.props.account.passphrase;
-
- return onlyFirstPPAndDone || onlySecondPPAndDone || (firstPPAndDone && secondPPAndDone);
- }
-
- componentDidUpdate() {
- if (this.hasCorrectPassphrases()) {
- this.props.nextStep({
- ...this.props,
- skipped: false,
- passphrase: this.state.passphrase,
- secondPassphrase: this.state.secondPassphrase,
- });
- }
- }
-
- onChange(name, value, error) {
- if (!error) {
- const publicKeyMap = {
- passphrase: 'publicKey',
- secondPassphrase: 'secondPublicKey',
- };
-
- const expectedPublicKey = this.props.account[publicKeyMap[name]];
-
- if (expectedPublicKey && expectedPublicKey !== extractPublicKey(value)) {
- error = this.props.t('Entered passphrase does not belong to the active account');
- }
- }
-
- this.setState({
- [name]: {
- value,
- error: typeof error === 'string' ? error : undefined,
- },
- });
- }
-
- setDone(step) {
- Piwik.trackingEvent('PassphraseSteps', 'button', 'Next step');
- const done = Object.assign(this.state.done, { [step]: true });
- this.setState({ done });
- }
-
- onPrevStep() {
- Piwik.trackingEvent('PassphraseSteps', 'button', 'Previous step');
- this.props.prevStep({
- recipient: this.props.recipient,
- amount: this.props.amount,
- reset: this.props.accountInit,
- });
- }
-
- getCurrentStep() {
- if (this.props.account.secondPublicKey
- && (this.state.done.passphrase || this.props.account.passphrase)) {
- return 'secondPassphrase';
- }
-
- return 'passphrase';
- }
-
- render() { // eslint-disable-line max-statements
- const values = {
- columns: { xs: 6, sm: 4, md: 6 },
- passphrase: {
- key: 'passphrase',
- header: this.props.t('Enter your passphrase'),
- state: this.state.passphrase,
- className: 'passphrase',
- buttonClassName: 'first-passphrase-next',
- },
- secondPassphrase: {
- key: 'secondPassphrase',
- header: this.props.t('Enter your second passphrase'),
- state: this.state.secondPassphrase,
- className: 'second-passphrase',
- buttonClassName: 'second-passphrase-next',
- },
- footer: {
- firstGrid: grid['col-xs-4'],
- secondGrid: grid['col-xs-8'],
- },
- };
-
- let updatedValues = { ...values };
- let updatedStyles = { ...styles };
-
- if (this.props.values) {
- const columns = { ...updatedValues.columns, ...this.props.values.columns };
- const footer = { ...updatedValues.footer, ...this.props.values.footer };
- const passphrase = { ...updatedValues.passphrase, ...this.props.values.passphrase };
- const secondPassphrase = {
- ...updatedValues.secondPassphrase,
- ...this.props.values.secondPassphrase,
- };
- updatedValues = {
- columns, passphrase, secondPassphrase, footer,
- };
- }
-
- if (this.props.styles) {
- updatedStyles = { ...updatedStyles, ...this.props.styles };
- }
-
- return (
-
-
- {updatedValues[this.getCurrentStep()].header}
-
-
-
-
- );
- }
-}
-
-
-const mapStateToProps = state => ({
- account: getActiveTokenAccount(state),
-});
-
-export default connect(mapStateToProps)(translate()(PassphraseSteps));
diff --git a/src/components/passphraseSteps/passphraseSteps.css b/src/components/passphraseSteps/passphraseSteps.css
deleted file mode 100644
index fb5d1f3389..0000000000
--- a/src/components/passphraseSteps/passphraseSteps.css
+++ /dev/null
@@ -1,38 +0,0 @@
-@import '../app/variables.css';
-
-.wrapper {
- display: flex;
- flex-flow: column;
- justify-content: space-between;
- width: 100%;
- box-sizing: border-box;
- height: 100%;
-
- & footer {
- width: 100%;
- }
-}
-
-.button {
- min-width: 0;
- width: 100%;
-}
-
-.headerWrapper {
- padding: 20px 0px 0;
-
- & h2 {
- font-weight: var(--font-weight-semi-bold);
- margin-bottom: 0;
- }
-}
-
-.input {
- padding: 5px !important;
-}
-
-@media (--small-viewport) {
- .wrapper {
- max-height: 100%;
- }
-}
diff --git a/src/components/pricedButton/index.js b/src/components/pricedButton/index.js
deleted file mode 100644
index f9a53c10c6..0000000000
--- a/src/components/pricedButton/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import { connect } from 'react-redux';
-import PricedButton from './pricedButton';
-
-const mapStateToProps = state => ({
- balance: state.account.balance,
-});
-
-export default connect(mapStateToProps)(PricedButton);
diff --git a/src/components/pricedButton/index.test.js b/src/components/pricedButton/index.test.js
deleted file mode 100644
index 8fc38a3e62..0000000000
--- a/src/components/pricedButton/index.test.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import sinon from 'sinon';
-import { shallow } from 'enzyme';
-import { PrimaryButton } from '../toolbox/buttons/button';
-import PricedButton from './pricedButton';
-import i18n from '../../i18n';
-import styles from './pricedButton.css';
-
-
-describe('PricedButton', () => {
- let wrapper;
- const props = {
- fee: 5e8,
- onClick: sinon.spy(),
- t: (key, options) => i18n.t(key, options),
- };
- const insufficientBalance = 4.9999e8;
- const sufficientBalance = 6e8;
-
- it('renders
component from react-toolbox', () => {
- wrapper = shallow(
);
- expect(wrapper.find(PrimaryButton)).to.have.length(1);
- });
-
- describe('Sufficient funds', () => {
- beforeEach(() => {
- wrapper = shallow(
);
- });
-
- it('renders a span saying "Fee: 5 LSK"', () => {
- expect(wrapper.find(`.${styles.fee}`).text()).to.be.equal(i18n.t('Fee: {{amount}} LSK', { amount: 5 }));
- });
-
- it('allows to click on Button', () => {
- wrapper.find(PrimaryButton).simulate('click');
- expect(props.onClick).to.have.been.calledWithExactly();
- });
- });
-
- describe('Insufficient funds', () => {
- beforeEach(() => {
- wrapper = shallow(
);
- });
-
- it('renders a span saying "Insufficient funds for 5 LSK fee"', () => {
- expect(wrapper.find(`.${styles.fee}`).text()).to.be.equal(i18n.t('Insufficient funds for {{amount}} LSK fee', { amount: 5 }));
- });
-
- it('sets the disabled attribute of the button', () => {
- const buttonProps = wrapper.find(PrimaryButton).props();
- expect(buttonProps.disabled).to.be.equal(true);
- });
- });
-});
diff --git a/src/components/pricedButton/pricedButton.css b/src/components/pricedButton/pricedButton.css
deleted file mode 100644
index 4842ac7afd..0000000000
--- a/src/components/pricedButton/pricedButton.css
+++ /dev/null
@@ -1,12 +0,0 @@
-.fee {
- font-size: 12px;
- line-height: 14px;
- color: grey;
- text-align: right;
- margin: 0 16px;
- transition: all 300ms cubic-bezier(0.55, 0, 0.55, 0.2);
-}
-
-.error {
- color: #dd2c00 !important;
-}
diff --git a/src/components/pricedButton/pricedButton.js b/src/components/pricedButton/pricedButton.js
deleted file mode 100644
index 351a6bc042..0000000000
--- a/src/components/pricedButton/pricedButton.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import React from 'react';
-import { PrimaryButton } from '../toolbox/buttons/button';
-import { fromRawLsk } from '../../utils/lsk';
-import Piwik from '../../utils/piwik';
-import styles from './pricedButton.css';
-
-const PricedButton = ({
- balance, fee, label, customClassName, onClick, disabled, type, t,
-}) => {
- const hasFunds = balance >= fee;
-
- function onHandleClick() {
- Piwik.trackingEvent('PricedButton', 'button', 'Handle click');
- onClick();
- }
-
- return (
-
- {
- fee
- && (
-
- {
- hasFunds ? t('Fee: {{amount}} LSK', { amount: fromRawLsk(fee) })
- : t('Insufficient funds for {{amount}} LSK fee', { amount: fromRawLsk(fee) })
- }
-
- )
- }
-
-
- );
-};
-
-export default PricedButton;
diff --git a/src/components/privateWrapper/index.js b/src/components/privateWrapper/index.js
deleted file mode 100644
index f2c5ed9318..0000000000
--- a/src/components/privateWrapper/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import { connect } from 'react-redux';
-import PrivateWrapper from './privateWrapper';
-
-const mapStateToProps = state => ({
- isAuthenticated: !!state.account.info,
-});
-
-export default connect(mapStateToProps)(PrivateWrapper);
diff --git a/src/components/privateWrapper/index.test.js b/src/components/privateWrapper/index.test.js
deleted file mode 100644
index 12790106fb..0000000000
--- a/src/components/privateWrapper/index.test.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { shallow } from 'enzyme';
-import PrivateWrapper from './privateWrapper';
-
-const Private = () =>
Private ;
-
-describe('PrivateWrapper', () => {
- const isAuth = isAuthenticated => (
- shallow(
-
- )
- );
- it('should render children components if user is authenticated', () => {
- const wrapper = isAuth(true);
- expect(wrapper.find(Private)).to.have.length(1);
- });
-
- it('should do not render children components if user is not authenticated', () => {
- const wrapper = isAuth(false);
- expect(wrapper.find(Private)).to.have.length(0);
- });
-});
diff --git a/src/components/privateWrapper/privateWrapper.js b/src/components/privateWrapper/privateWrapper.js
deleted file mode 100644
index 2904f87074..0000000000
--- a/src/components/privateWrapper/privateWrapper.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import React from 'react';
-
-const PrivateWrapper = ({ isAuthenticated, children }) => (
- isAuthenticated &&
{ children }
-);
-
-export default PrivateWrapper;
diff --git a/src/components/quickTips/index.css b/src/components/quickTips/index.css
deleted file mode 100644
index 1afce9d4bf..0000000000
--- a/src/components/quickTips/index.css
+++ /dev/null
@@ -1,119 +0,0 @@
-@import '../app/variables.css';
-@import '../app/variablesV2.css';
-
-.quickTips {
- height: 318px;
- margin: 0px 0px 20px;
- overflow: hidden;
- padding: 16px;
-}
-
-.footer {
- display: flex;
- justify-content: space-between;
- align-items: flex-end;
- padding: 0;
-
- & .goTo {
- color: var(--color-primary-standard);
- text-decoration: none;
- font-family: var(--content-font);
- font-weight: var(--font-weight-bold);
- font-size: var(--button-font-size-s);
- }
-}
-
-.header {
- margin-bottom: 25px;
-
- & > h2 {
- margin: 0;
- font-family: var(--content-font);
- font-weight: 600;
- font-size: 18px;
- }
-}
-
-.picture {
- position: absolute;
- right: 0;
- top: 0;
-}
-
-.descriptionRow {
- display: flex;
- justify-content: space-between;
- font-family: var(--content-font);
- height: 200px;
- font-size: 12px;
- font-weight: 500;
- color: var(--color-content-light);
-
- & .description {
- width: 279px;
- line-height: 1.5;
- overflow-y: auto;
- }
-}
-
-.steps {
- display: flex;
- color: var(--color-primary-standard);
- font-size: 12px;
- font-weight: 600;
- font-family: var(--content-font);
-
- & span {
- font-size: 12px;
- }
-
- & .previousStep {
- cursor: pointer;
- margin-right: 20px;
- }
-
- & .nextStep {
- cursor: pointer;
- margin-left: 20px;
- }
-
- & > div:nth-child(2) {
- color: var(--color-content-light);
- }
-}
-
-.disabled {
- pointer-events: none;
- color: var(--color-primary-light);
-}
-
-.quickTipBody {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- height: 100%;
-}
-
-@media (--large-viewport) {
- .picture {
- position: absolute;
- right: -80px;
- width: 50%;
-
- & img {
- width: 80%;
- }
- }
-}
-
-@media (--medium-viewport) {
- .quickTipBody {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
-
- .quickTips {
- min-height: 200px;
- }
-}
diff --git a/src/components/quickTips/index.js b/src/components/quickTips/index.js
deleted file mode 100644
index 49bed9a4cc..0000000000
--- a/src/components/quickTips/index.js
+++ /dev/null
@@ -1,109 +0,0 @@
-import React from 'react';
-import { translate } from 'react-i18next';
-import Box from '../box';
-import quickTips from '../../constants/quickTips';
-import { FontIcon } from '../fontIcon';
-import TransitionWrapper from '../toolbox/transitionWrapper';
-import Piwik from '../../utils/piwik';
-import styles from './index.css';
-
-class QuickTips extends React.Component {
- constructor() {
- super();
- this.state = {
- currentIndex: 0,
- };
- }
-
- nextStep() {
- Piwik.trackingEvent('QuickTips', 'button', 'Next step');
- const { currentIndex } = this.state;
- const nextIndex = currentIndex + 1;
-
- this.setState({ currentIndex: nextIndex });
- }
-
- previousStep() {
- Piwik.trackingEvent('QuickTips', 'button', 'Previous step');
- const { currentIndex } = this.state;
- const nextIndex = currentIndex - 1;
-
- this.setState({ currentIndex: nextIndex });
- }
-
- render() {
- const { currentIndex } = this.state;
- const slides = quickTips(this.props.t);
- const currentSlide = slides[currentIndex];
-
- return (
-
- {slides.map(slide => (
-
-
-
-
-
- ))
- }
- {slides.map(slide => (
-
-
-
{slide.title}
-
-
- ))
- }
-
- {slides.map(slide => (
-
-
-
- {slide.description.map((desc, key) => (
-
- {desc}
-
-
-
- ))}
-
-
-
- ))
- }
- {slides.map(slide => (
-
-
-
- {slide.goTo.title}
-
-
-
-
this.previousStep()}
- className={`previousStep ${styles.previousStep} ${currentIndex === 0 ? `${styles.disabled} disabled` : ''}`}
- >
-
- {this.props.t('Previous')}
-
-
- {`${currentIndex + 1} / ${quickTips(this.props.t).length}`}
-
-
this.nextStep()}
- className={`nextStep ${styles.nextStep} ${currentIndex + 1 === quickTips(this.props.t).length ? `${styles.disabled} disabled` : ''}`}
- >
- {this.props.t('Next')}
-
-
-
-
-
- ))
- }
-
-
- );
- }
-}
-export default translate()(QuickTips);
diff --git a/src/components/quickTips/index.test.js b/src/components/quickTips/index.test.js
deleted file mode 100644
index 4664855c54..0000000000
--- a/src/components/quickTips/index.test.js
+++ /dev/null
@@ -1,47 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import i18n from '../../i18n';
-import QuickTip from '.';
-
-describe('QuickTip', () => {
- let wrapper;
- let props;
-
- beforeEach(() => {
- props = {
- t: key => key,
- i18n,
- };
- wrapper = mount(
);
- });
-
- it('should render QuickTip', () => {
- expect(wrapper).to.have.descendants('.quickTips');
- });
-
- it('should change pagination number after clicking nextStep', () => {
- wrapper.find('.nextStep').at(0).simulate('click');
- expect(wrapper.find('.pagination').at(0).text()).to.have.been.equal('2 / 4');
- });
-
- it('should change pagination number after clicking previousStep', () => {
- wrapper.find('.nextStep').at(0).simulate('click');
- expect(wrapper.find('.pagination').at(0).text()).to.have.been.equal('2 / 4');
- wrapper.find('.previousStep').at(0).simulate('click');
- expect(wrapper.find('.pagination').at(0).text()).to.have.been.equal('1 / 4');
- });
-
- it('should disable previousStep when last slide', () => {
- expect(wrapper.find('.pagination').at(0).text()).to.have.been.equal('1 / 4');
- expect(wrapper.find('.previousStep').at(0).hasClass('disabled')).to.equal(true);
- });
-
- it('should disable nextStep when last slide', () => {
- wrapper.find('.nextStep').at(0).simulate('click');
- wrapper.find('.nextStep').at(0).simulate('click');
- wrapper.find('.nextStep').at(0).simulate('click');
- expect(wrapper.find('.pagination').at(0).text()).to.have.been.equal('4 / 4');
- expect(wrapper.find('.nextStep').at(0).hasClass('disabled')).to.equal(true);
- });
-});
diff --git a/src/components/referenceInput/index.css b/src/components/referenceInput/index.css
deleted file mode 100644
index ebdb77a615..0000000000
--- a/src/components/referenceInput/index.css
+++ /dev/null
@@ -1,14 +0,0 @@
-@import './../app/variables.css';
-
-.input {
- & input {
- border-bottom: 1px solid var(--color-grayscale-dark);
- color: var(--color-grayscale-dark);
- }
-}
-
-.label {
- color: var(--color-grayscale-dark);
- font-weight: 400;
- letter-spacing: 0;
-}
diff --git a/src/components/referenceInput/index.js b/src/components/referenceInput/index.js
deleted file mode 100644
index 1403a74c36..0000000000
--- a/src/components/referenceInput/index.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import React from 'react';
-import Input from 'react-toolbox/lib/input';
-import styles from './index.css';
-
-class ReferenceInput extends React.Component {
- render() {
- const { handleChange, reference, label, context } = this.props; // eslint-disable-line
- return (
-
{
- // istanbul ignore next
- if (context) {
- context.referenceInput = ref;
- }
- }}
- theme={styles}
- label={label}
- error={reference.error}
- value={reference.value}
- onChange={val => handleChange(val)}
- />
- );
- }
-}
-
-export default ReferenceInput;
diff --git a/src/components/referenceInput/index.test.js b/src/components/referenceInput/index.test.js
deleted file mode 100644
index 1acc1e981d..0000000000
--- a/src/components/referenceInput/index.test.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { spy } from 'sinon';
-import ReferenceInput from '.';
-
-describe('ReferenceInput', () => {
- let wrapper;
- let props;
-
- beforeEach(() => {
- props = {
- handleChange: spy(),
- className: 'test',
- reference: { value: '123L', error: '' },
- label: 'test',
- context: { referenceInput: {} },
- };
- wrapper = mount(
);
- });
-
- it('should render Input', () => {
- expect(wrapper.find('Input')).to.have.lengthOf(1);
- });
-
- it('should call onChange', () => {
- wrapper.find('Input').first().props().onChange('test');
- expect(props.handleChange).to.have.been.calledWith('test');
- });
-});
diff --git a/src/components/resultBox/index.js b/src/components/resultBox/index.js
deleted file mode 100644
index aca664eaea..0000000000
--- a/src/components/resultBox/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import { translate } from 'react-i18next';
-import { connect } from 'react-redux';
-import { withRouter } from 'react-router-dom';
-
-import actionTypes from '../../constants/actions';
-import ResultBox from './resultBox';
-
-const mapStateToProps = state => ({
- bookmarks: state.bookmarks ? state.bookmarks : [],
-});
-
-const mapDispatchToProps = {
- transactionFailedClear: () => ({
- type: actionTypes.transactionFailedClear,
- }),
-};
-
-export default withRouter(connect(
- mapStateToProps,
- mapDispatchToProps,
-)(translate()(ResultBox)));
diff --git a/src/components/resultBox/resultBox.css b/src/components/resultBox/resultBox.css
deleted file mode 100644
index 1fa6247dcc..0000000000
--- a/src/components/resultBox/resultBox.css
+++ /dev/null
@@ -1,66 +0,0 @@
-@import '../app/variables.css';
-
-:root {
- --copy-color: var(--color-primary-standard);
- --paragraph-color: var(--color-grayscale-dark);
- --paragraph-line-height: 36px;
- --title-font-size: 32px;
- --icon-font-size: 48px;
-}
-
-.icon {
- height: 30px;
- width: 38.5px;
- color: #ff6236;
-}
-
-.resultBox {
- text-align: center;
- justify-content: space-evenly;
- align-items: center;
- flex-flow: column;
- display: flex;
- width: 100%;
- height: 100%;
-
- & .header {
- position: relative;
- }
-
- & header > h2 {
- font-size: 28px;
- }
-
- & p {
- color: var(--paragraph-color);
- line-height: var(--paragraph-line-height);
- font-size: 16px;
- }
-
- & .copy {
- color: var(--copy-color);
- cursor: pointer;
- font-size: 16px;
- font-weight: 600;
- }
-
- & footer {
- padding: 0px;
- display: flex;
- bottom: 58px;
-
- & > div > button {
- margin: 0;
- }
-
- & .okButton {
- width: 160px;
- min-width: 160px;
- }
-
- & .addBookmarkButton {
- width: 160px;
- min-width: 160px;
- }
- }
-}
diff --git a/src/components/resultBox/resultBox.js b/src/components/resultBox/resultBox.js
deleted file mode 100644
index e7d7f3b2fa..0000000000
--- a/src/components/resultBox/resultBox.js
+++ /dev/null
@@ -1,133 +0,0 @@
-import React from 'react';
-import grid from 'flexboxgrid/dist/flexboxgrid.css';
-import { Button, ActionButton } from '../toolbox/buttons/button';
-import { FontIcon } from '../fontIcon';
-import CopyToClipboard from '../copyToClipboard';
-import Piwik from '../../utils/piwik';
-import styles from './resultBox.css';
-import check from '../../assets/images/icons/check.svg';
-import { getIndexOfBookmark } from '../../utils/bookmarks';
-import { getTokenFromAddress } from '../../utils/api/transactions';
-
-class ResultBox extends React.Component {
- componentDidMount() {
- if (typeof this.props.onMount === 'function') {
- this.props.onMount(true, 'ResultBox');
- }
- }
-
- isNotYetBookmarked(address) {
- const { bookmarks } = this.props;
- const token = getTokenFromAddress(address);
- return getIndexOfBookmark(bookmarks, { address, token }) === -1;
- }
-
- handleRetryButton() {
- this.props.transactionFailedClear();
- this.props.prevStep({
- success: null,
- account: this.props.account,
- recipient: this.props.recipient,
- amount: this.props.amount,
- password: { value: '' },
- });
- }
-
- onAddToBookmarks() {
- Piwik.trackingEvent('ResultBox', 'button', 'Add to bookmarks');
- this.props.nextStep({ address: this.props.recipientId });
- }
-
- onAddToBookmarksList() {
- Piwik.trackingEvent('ResultBox', 'button', 'Add to bookmarks accounts');
- this.props.transactionFailedClear();
- this.props.prevStep({
- success: null,
- account: this.props.account,
- recipient: this.props.recipient,
- amount: this.props.amount,
- password: { value: '' },
- });
- }
-
- onOk() {
- Piwik.trackingEvent('ResultBox', 'button', 'ok');
- this.props.transactionFailedClear();
- // istanbul ignore else
- if (typeof this.props.finalCallback === 'function') this.props.finalCallback();
- this.props.reset();
- this.props.history.replace(this.props.history.location.pathname);
- }
-
- render() {
- return (
-
-
-
-
-
- {this.props.body}
-
- {this.props.copy
- ? (
-
- )
- : null
- }
-
-
-
-
-
- );
- }
-}
-
-export default ResultBox;
diff --git a/src/components/resultBox/resultBox.test.js b/src/components/resultBox/resultBox.test.js
deleted file mode 100644
index 08e7a5da52..0000000000
--- a/src/components/resultBox/resultBox.test.js
+++ /dev/null
@@ -1,176 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { spy } from 'sinon';
-import PropTypes from 'prop-types';
-import { FontIcon } from '../fontIcon';
-import ResultBox from './resultBox';
-import styles from './resultBox.css';
-import i18n from '../../i18n';
-
-describe('Result Box', () => {
- let wrapper;
- let props;
-
- const options = {
- context: { i18n },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- },
- };
-
- it('renders result box with success template', () => {
- const title = 'Thank you';
- const body = 'Transaction is being processed and will be confirmed. It may take up to 15 minutes to be secured in the blockchain.';
- const copy = {
- title: 'Copy Transaction-ID to clipboard',
- value: '1234',
- };
- props = {
- copy,
- account: {},
- title,
- body,
- success: true,
- reset: spy(),
- copyToClipboard: () => {},
- finalCallback: () => {},
- transactionFailedClear: () => {},
- t: () => {},
- history: { location: {}, push: () => {}, replace: () => {} },
- bookmarks: {
- LSK: [],
- },
- };
-
- wrapper = mount(
, options);
-
- expect(wrapper.find('h2').text()).to.contain(title);
- expect(wrapper.find('.result-box-message').text()).to.contain(body);
- expect(wrapper.find(`.${styles.header}`).find(FontIcon)).to.be.not.present();
- expect(wrapper.find('img')).to.have.length(1);
- expect(wrapper.find('.copy-title').text()).to.contain(copy.title);
-
- wrapper.find('.okay-button').first().simulate('click');
- expect(props.reset).to.have.been.calledWith();
- });
-
- it('renders result box with failure template', () => {
- const title = 'Sorry';
- const body = 'An error occurred while creating the transaction.';
- props = {
- copy: null,
- title,
- account: {},
- body,
- success: false,
- reset: () => {},
- copyToClipboard: () => {},
- t: () => {},
- bookmarks: {
- LSK: [],
- },
- };
-
- wrapper = mount(
, options);
-
- expect(wrapper.find('h2').text()).to.contain(title);
- expect(wrapper.find('.result-box-message').text()).to.contain(body);
- expect(wrapper.find(`.${styles.header}`).find(FontIcon)).to.be.present();
- expect(wrapper.find('img')).to.have.length(0);
- expect(wrapper.find('.copy-title')).to.have.length(0);
- });
-
- it('calls props.onMount if it is a function', () => {
- props = {
- copy: null,
- title: 'Sorry',
- body: 'An error occurred while creating the transaction.',
- success: false,
- reset: () => {},
- copyToClipboard: () => {},
- t: () => {},
- onMount: spy(),
- bookmarks: {
- LSK: [],
- },
- account: {},
- };
-
- wrapper = mount(
, options);
-
- expect(props.onMount).to.have.been.calledWith(true, 'ResultBox');
- });
-
- it('display add follwed account button', () => {
- props = {
- copy: null,
- title: 'test',
- body: 'test',
- success: true,
- reset: () => {},
- copyToClipboard: () => {},
- t: () => {},
- onMount: spy(),
- recipientId: '123L',
- bookmarks: {
- LSK: [{
- address: '1L',
- }],
- },
- account: {
- hwInfo: {},
- },
- };
-
- wrapper = mount(
, options);
-
- expect(wrapper).to.have.descendants('.add-to-bookmarks');
- });
-
- it('should go to next step after clicking "Retry"', () => {
- props = {
- copy: null,
- title: 'test',
- account: { hwInfo: {} },
- body: 'test',
- success: false,
- recipientId: '123',
- reset: () => {},
- copyToClipboard: () => {},
- t: () => {},
- bookmarks: {
- LSK: [],
- },
- prevStep: spy(),
- transactionFailedClear: spy(),
- };
- wrapper = mount(
, options);
- wrapper.debug();
- wrapper.find('.add-follwed-account-button').at(0).simulate('click');
- expect(props.prevStep).to.have.been.calledWith();
- expect(props.transactionFailedClear).to.have.been.calledWith();
- });
-
- it('should go to next step after clicking "Add Bookmark"', () => {
- props = {
- copy: null,
- title: 'test',
- account: { hwInfo: {} },
- body: 'test',
- success: true,
- recipientId: 455,
- reset: () => {},
- copyToClipboard: () => {},
- t: () => {},
- bookmarks: {
- LSK: [],
- },
- nextStep: spy(),
- };
- wrapper = mount(
, options);
-
- wrapper.find('.add-to-bookmarks').at(0).simulate('click');
- expect(props.nextStep).to.have.been.calledWith({ address: 455 });
- });
-});
diff --git a/src/components/searchBar/index.js b/src/components/searchBar/index.js
deleted file mode 100644
index 9b4638e03f..0000000000
--- a/src/components/searchBar/index.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import React from 'react';
-import { connect } from 'react-redux';
-import { withRouter } from 'react-router';
-import { translate } from 'react-i18next';
-import { searchSuggestions } from '../../actions/search';
-import actionTypes from '../../constants/actions';
-import AutoSuggest from '../autoSuggestV2';
-import styles from './searchBar.css';
-
-class SearchBar extends React.Component {
- shouldShowSearchBarOnMobile() {
- const { pathname } = this.props.location;
- return pathname.includes('explorer');
- }
-
- render() {
- return (
-
- );
- }
-}
-
-const mapStateToProps = state => ({
- account: state.account,
- suggestions: state.search.suggestions,
-});
-/* istanbul ignore next */
-const mapDispatchToProps = {
- searchSuggestions,
- searchClearSuggestions: data => ({
- data,
- type: actionTypes.searchClearSuggestions,
- }),
-};
-
-export default withRouter(connect(
- mapStateToProps,
- mapDispatchToProps,
-)(translate()(SearchBar)));
diff --git a/src/components/searchBar/index.test.js b/src/components/searchBar/index.test.js
deleted file mode 100644
index c4173e2cd2..0000000000
--- a/src/components/searchBar/index.test.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* eslint-disable */
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { stub, spy } from 'sinon';
-import { Provider } from 'react-redux';
-import { HashRouter as Router } from 'react-router-dom';
-import PropTypes from 'prop-types';
-
-import i18n from '../../i18n';
-import SearchBar from './index';
-
-describe('SearchBar', () => {
- let wrapper;
- let history;
- let props;
- let options;
- const store = {};
- const peers = {
- data: {},
- status: true,
- };
-
- // Mocking store
- beforeEach(() => {
-
- history = {
- location: {
- pathname: 'explorer',
- search: '',
- },
- push: spy(),
- };
- props = {
- account: {
- afterLogout: false,
- },
- history,
- t: () => {},
- searchSuggestions: () => {},
- searchClearSuggestions: () => {},
- location: {
- pathname: 'explorer',
- search: '',
- },
- };
- options = {
- context: {
- store: {}, history, i18n, router: { route: history, history },
- },
- childContextTypes: {
- store: PropTypes.object.isRequired,
- history: PropTypes.object.isRequired,
- i18n: PropTypes.object.isRequired,
- router: PropTypes.object.isRequired,
- },
- lifecycleExperimental: true,
- };
- store.getState = () => ({
- peers,
- search: {
- suggestions: {
- delegates: [],
- addresses: [],
- transactions: [],
- }
- }
- });
- store.subscribe = () => {};
- store.dispatch = () => {};
- wrapper = mount(
-
-
-
-
- , options,
- );
- });
-
- it('should render Autosuggest', () => {
- expect(wrapper).to.have.descendants('.search-bar-input');
- expect(wrapper).to.have.descendants('.autosuggest-input');
- expect(wrapper).to.have.descendants('.autosuggest-dropdown');
- });
-});
-
diff --git a/src/components/searchBar/searchBar.css b/src/components/searchBar/searchBar.css
deleted file mode 100644
index fb19e7a6ff..0000000000
--- a/src/components/searchBar/searchBar.css
+++ /dev/null
@@ -1,44 +0,0 @@
-@import './../app/variables.css';
-@import './../app/variablesV2.css';
-
-:root {
- --search-box-width-l: 589px; /* stylelint-disable-line */
- --search-box-width-xl: 558px;
- --search-box-font-size: 16px;
- --search-box-line-height: 56px;
- --sub-title-line-height: 26px;
- --search-box-selection-background: var(--color-primary-light);
-}
-
-.searchBar {
- width: 100%;
- max-width: var(--search-box-width-l);
- height: 36px;
- box-sizing: border-box;
- border-radius: var(--border-radius-standard);
- position: relative;
- background-color: var(--color-white);
- margin-left: 9px;
-
- &:focus {
- border: 1.5px inset #4e80f7;
- }
-}
-
-@media (--large-viewport) {
- .searchBar {
- margin: 0 64px;
- }
-}
-
-@media (--medium-viewport) {
- .searchBar {
- margin: 0 35px;
- }
-}
-
-@media (--small-viewport) {
- .searchBar {
- margin: 0 25px;
- }
-}
diff --git a/src/components/searchResult/keyAction.js b/src/components/searchResult/keyAction.js
deleted file mode 100644
index 41ec8fb9a7..0000000000
--- a/src/components/searchResult/keyAction.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import localJSONStorage from '../../utils/localJSONStorage';
-/* eslint-disable import/prefer-default-export */
-export const saveSearch = (searchTerm, id) => {
- if (searchTerm.length === 0) return;
- const validSearch = searchTerm.trim();
-
- const recent = localJSONStorage.get('searches', []);
-
- const searchObj = {
- searchTerm: validSearch,
- id,
- };
- const updated = [searchObj].concat(recent.filter(term => typeof term === 'object' && term.searchTerm !== validSearch)).slice(0, 3);
- localJSONStorage.set('searches', updated);
-};
diff --git a/src/components/searchResult/keyAction.test.js b/src/components/searchResult/keyAction.test.js
deleted file mode 100644
index 5c8b3108dd..0000000000
--- a/src/components/searchResult/keyAction.test.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { expect } from 'chai';
-import { saveSearch } from './keyAction';
-import localJSONStorage from '../../utils/localJSONStorage';
-
-describe('Search KeyAction', () => {
- const storage = {};
-
- beforeEach(() => {
- window.localStorage.getItem = key => (storage[key]);
- window.localStorage.setItem = (key, item) => { storage[key] = item; };
- });
-
- it('saves the last 3 searches without duplicates', () => {
- const testValues = [
- { id: '811299173602533L', searchTerm: '811299173602533L' },
- { id: '947273526752682L', searchTerm: '947273526752682L' },
- { id: '', searchTerm: '' },
- { id: '382923358293526L ', searchTerm: '382923358293526L ' },
- { id: '947273526752682L ', searchTerm: '947273526752682L' },
- ];
-
- const expectedOutcome = [
- { id: '947273526752682L ', searchTerm: '947273526752682L' },
- { id: '382923358293526L ', searchTerm: '382923358293526L' },
- { id: '811299173602533L', searchTerm: '811299173602533L' },
- ];
-
- testValues.forEach((searchObj) => {
- saveSearch(searchObj.searchTerm, searchObj.id);
- });
- expect(localJSONStorage.get('searches')).to.eql(expectedOutcome);
- });
-});
diff --git a/src/components/showMore/index.js b/src/components/showMore/index.js
deleted file mode 100644
index ca77232062..0000000000
--- a/src/components/showMore/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import React from 'react';
-import styles from './showMore.css';
-
-const ShowMore = props => (
-
- {props.text}
-
-);
-
-export default ShowMore;
diff --git a/src/components/showMore/showMore.css b/src/components/showMore/showMore.css
deleted file mode 100644
index 0da51f9710..0000000000
--- a/src/components/showMore/showMore.css
+++ /dev/null
@@ -1,20 +0,0 @@
-@import '../app/variablesV2.css';
-@import '../app/mixins.css';
-
-.wrapper {
- width: 100%;
- min-height: 36px;
- height: 36px;
- display: flex;
- justify-content: center;
- align-items: center;
- cursor: pointer;
- background-color: var(--color-white-smoke);
- border-top: 1px solid var(--color-platinum);
-
- & > span {
- @mixin contentSmall bold;
-
- color: var(--color-maastricht-blue);
- }
-}
diff --git a/src/components/showMore/showMore.test.js b/src/components/showMore/showMore.test.js
deleted file mode 100644
index 9af419d531..0000000000
--- a/src/components/showMore/showMore.test.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { spy } from 'sinon';
-import { mount } from 'enzyme';
-import ShowMore from './index';
-
-describe('notFound', () => {
- const props = {
- text: 'Show More',
- onClick: spy(),
- className: null,
- };
-
- it('should render a ShowMore', () => {
- const wrapper = mount(
);
- expect(wrapper.find('.wrapper')).to.have.lengthOf(1);
- });
-
- it('should render a text Show More', () => {
- const wrapper = mount(
);
- expect(wrapper.find('span').text()).to.equal('Show More');
- });
-
- it('should call onClick function', () => {
- const wrapper = mount(
);
- wrapper.find('.wrapper').simulate('click');
- wrapper.update();
- expect(props.onClick).to.have.been.calledWith();
- });
-});
diff --git a/src/components/spinner/index.js b/src/components/spinner/index.js
deleted file mode 100644
index 312e515bf0..0000000000
--- a/src/components/spinner/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-import styles from './spinner.css';
-
-const Spinner = () => (
-
-
-
-
-
-);
-
-export default Spinner;
diff --git a/src/components/spinner/index.test.js b/src/components/spinner/index.test.js
deleted file mode 100644
index 2d49db8952..0000000000
--- a/src/components/spinner/index.test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import Spinner from './index';
-
-describe('Spinner', () => {
- it('should render 1 span and 3 div tags', () => {
- const wrapper = mount(
);
- expect(wrapper.find('span')).to.have.lengthOf(1);
- expect(wrapper.find('div')).to.have.lengthOf(3);
- });
-});
diff --git a/src/components/spinner/spinner.css b/src/components/spinner/spinner.css
deleted file mode 100644
index 1017fce58b..0000000000
--- a/src/components/spinner/spinner.css
+++ /dev/null
@@ -1,36 +0,0 @@
-.spinner {
- width: 24px;
- text-align: center;
- display: inline-block;
-}
-
-.bounce1,
-.bounce2,
-.bounce3 {
- width: 3px;
- height: 3px;
- margin: 1px;
- border-radius: 100%;
- display: inline-block;
- animation: changeColor 1400ms infinite ease-in-out both;
-}
-
-.bounce1 {
- animation-delay: -6400ms;
-}
-
-.bounce2 {
- animation-delay: -320ms;
-}
-
-@keyframes changeColor {
- 0%,
- 80%,
- 100% {
- background-color: #37516a;
- }
-
- 40% {
- background-color: #c9dae5;
- }
-}
diff --git a/src/components/spinner/stories.js b/src/components/spinner/stories.js
deleted file mode 100644
index 86d8786ed8..0000000000
--- a/src/components/spinner/stories.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import React from 'react';
-import { storiesOf } from '@storybook/react';
-
-import Spinner from '.';
-
-storiesOf('Spinner', module)
- .add('default', () => (
-
- ));
diff --git a/src/components/toaster/stories.js b/src/components/toaster/stories.js
deleted file mode 100644
index e8b47f6ce8..0000000000
--- a/src/components/toaster/stories.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import React from 'react';
-
-import { storiesOf } from '@storybook/react';
-import { action } from '@storybook/addon-actions';
-import Toaster from './toaster';
-
-
-storiesOf('Toaster', module)
- .add('default', () => (
-
- ))
- .add('success', () => (
-
- ))
- .add('error', () => (
-
- ));
diff --git a/src/components/toolbox/buttons/button.js b/src/components/toolbox/buttons/button.js
index 0f07cef945..2c05c6f06f 100644
--- a/src/components/toolbox/buttons/button.js
+++ b/src/components/toolbox/buttons/button.js
@@ -2,57 +2,25 @@ import React from 'react';
import { themr } from 'react-css-themr';
import { Button as ToolBoxButton } from 'react-toolbox/lib/button';
import secondaryBlueButtonTheme from './css/secondaryBlueButton.css';
-import secondaryLightButtonTheme from './css/secondaryLightButton.css';
-import primaryButtonTheme from './css/primaryButton.css';
import primaryButtonV2Theme from './css/primaryButtonV2.css';
import secondaryButtonV2Theme from './css/secondaryButtonV2.css';
-import tertiaryButtonTheme from './css/tertiaryButton.css';
import tertiaryButtonV2Theme from './css/tertiaryButtonV2.css';
-import actionButtonTheme from './css/actionButton.css';
-class TBSecondaryBlueButton extends React.Component {
+class TBButton extends React.Component {
render() {
return
;
}
}
-class TBPrimaryButton extends React.Component {
- render() {
- return
;
- }
-}
-
-class TBSecondaryLightButton extends React.Component {
- render() {
- return
;
- }
-}
-
-class TBTertiaryButton extends React.Component {
- render() {
- return
;
- }
-}
-
-class TBActionButton extends React.Component {
- render() {
- return
;
- }
-}
-
-const PrimaryButton = themr('importantButton', primaryButtonTheme)(TBPrimaryButton);
-const PrimaryButtonV2 = themr('dangerButton', primaryButtonV2Theme)(TBPrimaryButton);
-const SecondaryLightButton = themr('lightButton', secondaryLightButtonTheme)(TBSecondaryLightButton);
-const SecondaryButtonV2 = themr('lightButton', secondaryButtonV2Theme)(TBSecondaryLightButton);
-const TertiaryButton = themr('tertiaryButton', tertiaryButtonTheme)(TBTertiaryButton);
-const TertiaryButtonV2 = themr('tertiaryButton', tertiaryButtonV2Theme)(TBTertiaryButton);
-const ActionButton = themr('actionButton', actionButtonTheme)(TBActionButton);
-const Button = themr('button', secondaryBlueButtonTheme)(TBSecondaryBlueButton);
+const PrimaryButtonV2 = themr('primaryButton', primaryButtonV2Theme)(TBButton);
+const SecondaryButtonV2 = themr('secondarytButton', secondaryButtonV2Theme)(TBButton);
+const TertiaryButtonV2 = themr('tertiaryButton', tertiaryButtonV2Theme)(TBButton);
+const Button = themr('button', secondaryBlueButtonTheme)(TBButton);
export {
- Button, PrimaryButton, SecondaryLightButton,
- TertiaryButton, ActionButton,
- PrimaryButtonV2, SecondaryButtonV2,
+ Button,
+ PrimaryButtonV2,
+ SecondaryButtonV2,
TertiaryButtonV2,
};
export default Button;
diff --git a/src/components/toolbox/buttons/button.test.js b/src/components/toolbox/buttons/button.test.js
index 17ab1735a3..d7cbc5e83b 100644
--- a/src/components/toolbox/buttons/button.test.js
+++ b/src/components/toolbox/buttons/button.test.js
@@ -1,21 +1,11 @@
import React from 'react';
import { expect } from 'chai';
import { mount } from 'enzyme';
-import { Button, SecondaryLightButton, ActionButton } from './button';
+import { Button } from './button';
describe('Button wrapper', () => {
it('Creates only one instance of the button', () => {
const wrappedButton = mount(
, {});
expect(wrappedButton.find('Button').length).to.equal(1);
});
-
- it('Creates only one instance of the SecondaryLightButton', () => {
- const wrappedButton = mount(
, {});
- expect(wrappedButton.find('Button').length).to.equal(1);
- });
-
- it('Creates only one instance of the ActionButton', () => {
- const wrappedButton = mount(
, {});
- expect(wrappedButton.find('Button').length).to.equal(1);
- });
});
diff --git a/src/components/toolbox/buttons/css/actionButton.css b/src/components/toolbox/buttons/css/actionButton.css
deleted file mode 100644
index b2867fdca9..0000000000
--- a/src/components/toolbox/buttons/css/actionButton.css
+++ /dev/null
@@ -1,8 +0,0 @@
-@import './base.css';
-
-.button {
- min-height: 56px;
-
- @mixin buttonBasics;
- @mixin buttonAction;
-}
diff --git a/src/components/toolbox/buttons/css/importantButton.css b/src/components/toolbox/buttons/css/importantButton.css
deleted file mode 100644
index 55b4325be9..0000000000
--- a/src/components/toolbox/buttons/css/importantButton.css
+++ /dev/null
@@ -1,5 +0,0 @@
-@import './base.css';
-
-.button {
- font-size: var(--button-font-size);
-}
diff --git a/src/components/toolbox/buttons/css/lightButton.css b/src/components/toolbox/buttons/css/lightButton.css
deleted file mode 100644
index 55b4325be9..0000000000
--- a/src/components/toolbox/buttons/css/lightButton.css
+++ /dev/null
@@ -1,5 +0,0 @@
-@import './base.css';
-
-.button {
- font-size: var(--button-font-size);
-}
diff --git a/src/components/toolbox/buttons/css/primaryButton.css b/src/components/toolbox/buttons/css/primaryButton.css
deleted file mode 100644
index ae0d41b7f1..0000000000
--- a/src/components/toolbox/buttons/css/primaryButton.css
+++ /dev/null
@@ -1,8 +0,0 @@
-@import './base.css';
-
-.button {
- min-height: 56px;
-
- @mixin buttonBasics;
- @mixin buttonPrimary;
-}
diff --git a/src/components/toolbox/buttons/css/redButton.css b/src/components/toolbox/buttons/css/redButton.css
deleted file mode 100644
index cfd5c440e2..0000000000
--- a/src/components/toolbox/buttons/css/redButton.css
+++ /dev/null
@@ -1,8 +0,0 @@
-@import './base.css';
-
-.button {
- min-height: 56px;
-
- @mixin buttonBasics;
- @mixin buttonRed;
-}
diff --git a/src/components/toolbox/buttons/css/secondaryLightButton.css b/src/components/toolbox/buttons/css/secondaryLightButton.css
deleted file mode 100644
index 1f1be89b1f..0000000000
--- a/src/components/toolbox/buttons/css/secondaryLightButton.css
+++ /dev/null
@@ -1,8 +0,0 @@
-@import './base.css';
-
-.button {
- min-height: 55px;
-
- @mixin buttonBasics;
- @mixin buttonSecondary--light;
-}
diff --git a/src/components/toolbox/buttons/css/tertiaryButton.css b/src/components/toolbox/buttons/css/tertiaryButton.css
deleted file mode 100644
index 2b09c2c678..0000000000
--- a/src/components/toolbox/buttons/css/tertiaryButton.css
+++ /dev/null
@@ -1,6 +0,0 @@
-@import './base.css';
-
-.button {
- @mixin buttonBasics;
- @mixin buttonTertiary;
-}
diff --git a/src/components/toolbox/buttons/iconButton.js b/src/components/toolbox/buttons/iconButton.js
deleted file mode 100644
index e3e44b2c10..0000000000
--- a/src/components/toolbox/buttons/iconButton.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import { IconButton as ToolBoxIconButton } from 'react-toolbox/lib/button';
-
-// this component is unnecessary and it need to be deleted
-class IconButton extends React.Component {
- render() {
- return
;
- }
-}
-
-export default IconButton;
diff --git a/src/components/toolbox/buttons/iconButton.test.js b/src/components/toolbox/buttons/iconButton.test.js
deleted file mode 100644
index d6999ab943..0000000000
--- a/src/components/toolbox/buttons/iconButton.test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { IconButton as ToolBoxIconButton } from 'react-toolbox/lib/button';
-import IconButton from './iconButton';
-
-describe('IconButton wrapper', () => {
- it('Creates only one instance of toolbox icon button', () => {
- const wrappedButton = mount(
, {});
- expect(wrappedButton.find(ToolBoxIconButton)).to.have.lengthOf(1);
- });
-});
diff --git a/src/components/toolbox/dropdown/dropdown.css b/src/components/toolbox/dropdown/dropdown.css
deleted file mode 100644
index aed9816cf9..0000000000
--- a/src/components/toolbox/dropdown/dropdown.css
+++ /dev/null
@@ -1,74 +0,0 @@
-@import '../../app/variables.css';
-
-:root {
- --dropdown-box-shadow: 0 8px 16px 0 rgba(29, 72, 119, 0.16);
- --dropdown-list-hover-color: rgba(204, 217, 228, 0.2);
-}
-
-.dropdown {
- & ul {
- box-shadow: var(--dropdown-box-shadow) !important;
- width: 160px;
- margin-left: 2px;
- }
-
- & li,
- & .selected {
- padding: 12px;
- color: var(--color-primary-standard);
- font-weight: var(--font-weight-semi-bold);
- }
-
- & .values {
- & li:hover:not(:first-child) {
- background-color: var(--dropdown-list-hover-color) !important;
- }
- }
-
- & .inputLabel {
- font-family: 'Open Sans', sans-serif;
- color: var(--color-grayscale-dark) !important;
- font-weight: var(--font-weight-bold);
- }
-
- & .inputFilled {
- margin-top: 10px;
- color: var(--color-primary-standard) !important;
- font-size: 12px;
- font-weight: bold;
- }
-
- & .value {
- padding-bottom: 0px;
-
- &::after {
- border: none;
- }
- }
-
- & .disabled {
- cursor: default !important;
- color: var(--color-primary-standard) !important;
- font-size: 12px;
- font-weight: var(--font-weight-bold);
- line-height: 27px;
- }
-}
-
-.dropdown.active {
- & .value {
- opacity: 0;
- }
-}
-
-.arrow {
- position: absolute;
- left: 95px;
- top: 35px;
- color: var(--color-primary-standard);
- cursor: pointer;
-}
-
-input:-webkit-autofill {
- box-shadow: inset 0 0 0px 9999px var(--color-white);
-}
diff --git a/src/components/toolbox/dropdown/toolBoxDropdown.js b/src/components/toolbox/dropdown/toolBoxDropdown.js
deleted file mode 100644
index 5bd07f31cf..0000000000
--- a/src/components/toolbox/dropdown/toolBoxDropdown.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import React from 'react';
-import Dropdown from 'react-toolbox/lib/dropdown';
-import { themr } from 'react-css-themr';
-import { FontIcon } from '../../fontIcon';
-import theme from './dropdown.css';
-
-class ToolBoxDropdown extends React.Component {
- render() {
- return (
-
{ this.dropdownEl = ref; }}
- >
- {
- this.dropdownEl.open({ target: this.dropdownEl.inputNode.inputNode });
- }}
- value="arrow-down"
- />
-
- );
- }
-}
-
-export default themr('TBDropdown', theme)(ToolBoxDropdown);
diff --git a/src/components/toolbox/inputs/toolBoxInput.js b/src/components/toolbox/inputs/toolBoxInput.js
index e2e1c8d4fa..69706c78c9 100644
--- a/src/components/toolbox/inputs/toolBoxInput.js
+++ b/src/components/toolbox/inputs/toolBoxInput.js
@@ -7,11 +7,6 @@ const ToolBoxInput = props => (
{
- if (ref !== null && props.shouldfocus) {
- ref.focus();
- }
- }}
>
{props.children}
diff --git a/src/components/toolbox/sliderCheckbox/checkbox.css b/src/components/toolbox/sliderCheckbox/checkbox.css
deleted file mode 100644
index bee0906a75..0000000000
--- a/src/components/toolbox/sliderCheckbox/checkbox.css
+++ /dev/null
@@ -1,208 +0,0 @@
-@import '../../app/variables';
-
-:root {
- --action-button-bg: var(--gradient-action-orange);
- --secondary-button-bg: gray;
- --gradient-bg: linear-gradient(to right, #134381, #001e45);
- --element-width: 100%;
- --element-height: 62px;
- --element-height-small: 48px;
- --label-font-size: 16px;
- --icon-text-font: var(--heading-font);
-}
-
-.sliderInput {
- user-select: none;
- width: var(--element-width);
-
- & span,
- & label,
- & div {
- user-select: none;
- }
-
- & div {
- transition: all ease 300ms;
- width: calc(100% - calc(var(--element-height) / 2));
- height: 100%;
- position: relative;
- text-indent: calc(var(--element-height) / 3);
- flex-flow: row nowrap;
- font-weight: bold;
- text-align: center;
- display: flex;
-
- &::before {
- content: '';
- display: block;
- position: absolute;
- z-index: 1;
- background: linear-gradient(to right, rgba(19, 67, 129, 0), #001e45);
- height: inherit;
- right: 0;
- width: 100%;
- }
-
- & > span {
- text-indent: var(--element-height);
- flex: 0 auto;
- width: auto;
- font-size: var(--label-font-size);
- }
-
- & > span.arrows {
- display: block;
- text-indent: 0;
- height: 100%;
- overflow: hidden;
-
- & span {
- padding-left: 15px;
- font-size: 20px;
- }
- }
-
- & > span:not(.arrows) {
- word-break: keep-all;
- min-width: 200px;
- z-index: 2;
- position: relative;
-
- &::after,
- &::before {
- display: none !important;
- }
- }
- }
-
- & label {
- height: var(--element-height);
- line-height: var(--element-height);
- width: 100%;
- border-radius: calc(var(--element-height) / 2);
- background: var(--gradient-bg);
- color: var(--color-white);
- display: block;
- position: relative;
- cursor: grab;
- }
-
- & span.circle {
- position: absolute;
- width: var(--element-height);
- height: inherit;
- line-height: inherit;
- display: block;
- text-align: center;
- border-radius: 50%;
- top: 0;
- transition: all ease 300ms;
- background: var(--action-button-bg);
-
- & .text {
- font-size: var(--label-font-size);
- font-family: var(--icon-text-font);
- }
-
- &.button {
- left: 0;
- z-index: 3;
-
- &[style] {
- cursor: grabbing;
- transition: all ease 50ms;
-
- & + div {
- opacity: 0.5;
- }
- }
- }
-
- &.goal {
- background: var(--secondary-button-bg);
- right: 0;
- z-index: 2;
- font-family: var(--icon-text-font);
- }
-
- &.begin {
- background: var(--secondary-button-bg);
- left: 0;
- z-index: 2;
- font-family: var(--icon-text-font);
- }
-
- & span {
- width: 100%;
- line-height: inherit !important;
- position: absolute;
- left: 0;
- top: 0;
- transition: all ease 300ms;
- font-size: 30px;
-
- &.checkMark {
- opacity: 0;
- }
-
- &.arrowRight {
- opacity: 1;
- }
- }
- }
-
- & input[type='radio'],
- & input[type='checkbox'] {
- position: absolute;
- visibility: hidden;
-
- &:checked + label {
- & .button {
- left: 100%;
- transform: translateX(calc(-1 * var(--element-height)));
-
- & .checkMark {
- opacity: 1;
- }
-
- & .arrowRight {
- opacity: 0;
- }
- }
-
- & > div {
- opacity: 0;
- }
- }
- }
-}
-
-@media (--small-viewport) {
- .sliderInput {
- & label {
- height: var(--element-height-small) !important;
- line-height: var(--element-height-small) !important;
- }
-
- & span.circle {
- width: var(--element-height-small);
- }
-
- & input[type='radio'],
- & input[type='checkbox'] {
- &:checked + label .button {
- transform: translateX(calc(-1 * var(--element-height-small)));
- }
- }
-
- & div {
- & span {
- text-indent: calc(var(--element-height-small) + 20px);
- }
-
- &::after {
- letter-spacing: -5px;
- }
- }
- }
-}
diff --git a/src/components/toolbox/sliderCheckbox/index.js b/src/components/toolbox/sliderCheckbox/index.js
deleted file mode 100644
index aa3cf46c75..0000000000
--- a/src/components/toolbox/sliderCheckbox/index.js
+++ /dev/null
@@ -1,167 +0,0 @@
-import React from 'react';
-import { themr } from 'react-css-themr';
-import styles from './checkbox.css';
-import { FontIcon } from '../../fontIcon';
-
-const StaticLabel = ({ theme, icons, iconName }) => (
-
- {icons[iconName]}
-
-);
-class SliderCheckbox extends React.Component {
- constructor() {
- super();
-
- this.state = {
- xOffset: 0,
- };
-
- this.xOffset = 0;
- this.delta = 0;
- this.arrows = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- }
-
- // eslint-disable-next-line class-methods-use-this
- getXOffset(e) {
- const ev = e.nativeEvent;
- if (typeof ev.pageX === 'number') {
- return ev.pageX;
- } if (ev.changedTouches && ev.changedTouches[0]) {
- return ev.changedTouches[0].pageX;
- }
- return ev.clientX;
- }
-
- startTracking(e) {
- this.trackable = true;
- this.xOffset = this.getXOffset(e);
- this.direction = this.input.checked ? -1 : 1;
- /* istanbul ignore next */
- const sliderWidth = this.props.sliderWidth || this.parent.getBoundingClientRect().width;
- /* istanbul ignore next */
- this.buttonWidth = this.props.buttonWidth || this.shape.getBoundingClientRect().width;
- this.maxMovement = sliderWidth - this.buttonWidth;
- }
-
- track(e) {
- if (this.trackable) {
- const pageX = this.getXOffset(e);
- this.delta = pageX - this.xOffset;
- const left = this.direction > 0
- ? this.delta
- : ((this.maxMovement + this.buttonWidth) - Math.abs(this.delta));
-
- if ((this.direction * this.delta) > 0
- && Math.abs(this.delta) < this.maxMovement) {
- this.shape.setAttribute('style', `left: ${left}px`);
- }
- }
- }
-
- stopTracking() {
- if (this.trackable) {
- this.trackable = false;
- // delta === 0 covers clicking
- if ((this.delta === 0 || Math.abs(this.delta) > 50) && !this.props.disabled) {
- this.change();
- } else {
- this.revert();
- }
- this.delta = 0;
- }
- }
-
- change() {
- this.input.checked = !this.input.checked;
- this.shape.removeAttribute('style');
- this.direction = this.input.checked ? -1 : 1;
- if (typeof this.props.onChange === 'function'
- && this.props.input instanceof Object
- && !(this.props.input instanceof Array)) {
- this.props.onChange({
- checked: this.input.checked,
- value: this.props.input.value,
- });
- }
- }
-
- revert() {
- this.shape.removeAttribute('style');
- }
-
- render() {
- const {
- label, input, className, hasSlidingArrows, theme,
- } = this.props;
- const icons = this.props.icons ? this.props.icons : {};
-
- const checkType = i => (typeof i === 'string');
-
- return (
-
-
{ this.input = el; }}
- onChange={this.change.bind(this)}
- />
-
{ this.parent = el; }}
- onMouseDown={this.startTracking.bind(this)}
- onTouchStart={this.startTracking.bind(this)}
- onMouseMove={this.track.bind(this)}
- onTouchMove={this.track.bind(this)}
- onMouseLeave={this.stopTracking.bind(this)}
- onMouseUp={this.stopTracking.bind(this)}
- onClick={e => e.stopPropagation()}
- onTouchEnd={this.stopTracking.bind(this)}
- >
- { this.shape = el; }}
- >
-
-
- {icons.unchecked || 'arrow-right'}
-
-
-
-
-
- {icons.checked || 'checkmark'}
-
-
-
- { label
- ? (
-
- {label}
- {
- hasSlidingArrows
- ? (
-
- { this.arrows.map(key => ) }
-
- ) : null
- }
-
- ) : ''
- }
- {
- checkType(icons.begin)
- ? : null
- }
- {
- checkType(icons.goal)
- ? : null
- }
-
-
- );
- }
-}
-
-export { SliderCheckbox };
-export default themr('sliderCheckbox', styles)(SliderCheckbox);
diff --git a/src/components/toolbox/sliderCheckbox/index.test.js b/src/components/toolbox/sliderCheckbox/index.test.js
deleted file mode 100644
index 4233168f5c..0000000000
--- a/src/components/toolbox/sliderCheckbox/index.test.js
+++ /dev/null
@@ -1,139 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { SliderCheckbox } from './index';
-
-describe('SliderCheckbox without HOC', () => {
- const props = {
- icons: { done: 'done' },
- onChange: () => {},
- input: { value: 'introduction-step' },
- theme: {
- sliderInput: 'sliderInput',
- arrowRight: 'arrowRight',
- checkMark: 'checkMark',
- circle: 'circle-theme',
- button: 'button',
- },
- buttonWidth: 40,
- sliderWidth: 300,
- };
-
- /**
- * Drags the slider for a given length (in pixels) and then updates the wrapper
- * @param {Object} wrapper - Enzyme mounted component
- * @param {Number} delta - The length of movement in pixels. negative values mean sliding to left
- */
- const drag = (wrapper, delta) => {
- wrapper.find('label').props().onMouseDown({ nativeEvent: { pageX: 870 } });
-
- // When I start dragging the arrow
- wrapper.find('label').props().onMouseMove({ nativeEvent: { pageX: 870 } });
-
- // And I keep dragging a bit more
- wrapper.find('label').props().onMouseMove({ nativeEvent: { pageX: 870 + delta } });
- wrapper.update();
- };
-
- const stopDragging = (wrapper) => {
- wrapper.find('label').props().onMouseLeave();
- };
-
- const shouldBeChecked = (wrapper) => {
- expect(wrapper.find('input').instance().checked).to.equal(true);
- };
-
- const shouldBeNotChecked = (wrapper) => {
- expect(wrapper.find('input').instance().checked).to.equal(false);
- };
-
- /**
- * Checks is the button has style.left property set as expected
- * @param {Object} wrapper - Enzyme mounted component
- * @param {String} length - The length of transform including unit, e.g. 15px
- */
- const isItTransformed = (wrapper, length) => {
- expect(wrapper.find('.circle span').first().instance().style.left).to.equal(length);
- };
-
- it('should render Checkbox', () => {
- const wrapper = mount(
);
- expect(wrapper.find(SliderCheckbox)).to.have.lengthOf(1);
- });
-
- // the values 870, 900 and 1000 are describing the position of the dragged element
- // 870 being the initial value (not dragged)
- // 900 a bit less than 50% dragged
- // 1000 a bit more than 50% dragged
-
- // To-do : enable this one when you fix the bug of sliderCheckbox
- it('checks the checkbox after dragging (more than 50%)', () => {
- const wrapper = mount(
);
- shouldBeNotChecked(wrapper);
- drag(wrapper, 51);
- isItTransformed(wrapper, '51px');
- stopDragging(wrapper);
- // The checkbox should be checked
- shouldBeChecked(wrapper);
- });
-
- it('un-checks the checkbox after dragging (more than 50%) to left', () => {
- const wrapper = mount(
);
- wrapper.find('input').instance().checked = true;
- shouldBeChecked(wrapper);
- drag(wrapper, -51);
- isItTransformed(wrapper, '249px');
- stopDragging(wrapper);
-
- // The checkbox should not be checked
- shouldBeNotChecked(wrapper);
- });
-
- it('does not check the checkbox after dragging (less than 50%)', () => {
- const icons = {
- begin: 'begin',
- goal: 'begin',
- unchecked: 'unchecked',
- checked: 'checked',
- };
- const propsWithIcons = { ...props, icons, textAsIcon: true };
- const wrapper = mount(
);
- shouldBeNotChecked(wrapper);
- drag(wrapper, 30);
- isItTransformed(wrapper, '30px');
- stopDragging(wrapper);
-
- shouldBeNotChecked(wrapper);
- isItTransformed(wrapper, '');
- });
-
- it('has default icons if not defined in props', () => {
- const propsWithNoIcons = { ...props };
- delete propsWithNoIcons.icons;
-
- const wrapper = mount(
);
- expect(wrapper.find('span.arrowRight')).to.have.lengthOf(1);
- expect(wrapper.find('span.checkMark')).to.have.lengthOf(1);
- });
-
- it('renders a label if defined in props', () => {
- const propsWithArrows = { ...props, label: 'Test slider' };
- const wrapper = mount(
);
- expect(wrapper.find('span.label')).to.have.lengthOf(1);
- });
-
- it('renders arrows in the width of slider if defined', () => {
- const propsWithArrows = { ...props, hasSlidingArrows: true, label: 'Test slider' };
- const wrapper = mount(
);
- expect(wrapper.find('span.arrow')).to.have.lengthOf(1);
- });
-
- it('handles touch events correctly', () => {
- const wrapper = mount(
);
- // onTouchStart followed by onTouchEnd without movement
- // works like clicking and checks the checkbox
- wrapper.find('label').props().onTouchStart({ nativeEvent: { changedTouches: [{ pageX: 870 }] } });
- wrapper.find('label').props().onTouchEnd({ nativeEvent: { changedTouches: [{ pageX: 870 }] } });
- shouldBeChecked(wrapper);
- });
-});
diff --git a/src/components/toolbox/transitionWrapper/index.js b/src/components/toolbox/transitionWrapper/index.js
deleted file mode 100644
index e2920337ab..0000000000
--- a/src/components/toolbox/transitionWrapper/index.js
+++ /dev/null
@@ -1,97 +0,0 @@
-import React from 'react';
-import styles from './transitionWrapper.css';
-
-class TransitionWrapper extends React.Component {
- constructor() {
- super();
-
- this.state = {
- extraProps: {
- className: styles.willTransition,
- },
- };
-
- this.cssStyleRules = {
- slideIn: styles.slideIn,
- slideOut: styles.slideOut,
- duration: 400,
- };
- }
-
- componentWillMount() {
- this.validateChildren();
-
- if (styles[`${this.props.animationName}In`]) {
- this.cssStyleRules.slideIn = styles[`${this.props.animationName}In`];
- this.cssStyleRules.slideOut = styles[`${this.props.animationName}Out`];
- }
-
- if (this.props.current === this.props.step) {
- this.transitionIn(true);
- }
- }
-
- validateChildren() {
- /* istanbul ignore if */
- if (this.props.children instanceof Array && this.props.children.length !== 1) {
- throw Error('TransitionWrapper must have exactly one child');
- }
- }
-
- componentWillUpdate(newProps) {
- const steps = this.props.step.split(',');
- if (steps.includes(newProps.current) && !steps.includes(this.props.current)) {
- this.transitionIn(newProps);
- } else if (!steps.includes(newProps.current) && steps.includes(this.props.current)) {
- this.transitionOut(newProps);
- }
- }
-
- transitionIn(AddWillTransition) {
- this.timeout = setTimeout(() => {
- const className = `${this.props.children.props.className} ${AddWillTransition ? styles.willTransition : ''} ${this.cssStyleRules.slideIn}`;
- const extraProps = { ...this.state.extraProps };
- extraProps.className = className;
- this.setState({ extraProps });
- }, this.cssStyleRules.duration);
- }
-
- transitionOut() {
- const extraProps = { ...this.state.extraProps };
- let className = extraProps.className.replace(this.cssStyleRules.slideIn, '').trim();
-
- className = `${className} ${this.cssStyleRules.slideOut}`;
-
- extraProps.className = className;
- this.setState({ extraProps });
- this.setStable();
- }
-
- setStable() {
- clearTimeout(this.timeout);
- this.timeout = setTimeout(() => {
- const extraProps = { ...this.state.extraProps };
- extraProps.className = extraProps.className
- .replace(this.cssStyleRules.slideIn, '').replace(this.cssStyleRules.slideOut, '').trim();
- this.setState({ extraProps });
- }, this.cssStyleRules.duration);
- }
-
- render() {
- const inlineStyles = {};
-
- if (this.props.animationDuration) {
- inlineStyles.style = {
- animationDuration: this.props.animationDuration || `${this.cssStyleRules.duration}ms`,
- WebkitAnimationDuration: this.props.animationDuration || `${this.cssStyleRules.duration}ms`,
- };
- }
-
- return React.cloneElement(
- this.props.children,
- { ...this.state.extraProps, ...inlineStyles },
- );
- }
-}
-
-export default TransitionWrapper;
diff --git a/src/components/toolbox/transitionWrapper/index.test.js b/src/components/toolbox/transitionWrapper/index.test.js
deleted file mode 100644
index 9642660e2e..0000000000
--- a/src/components/toolbox/transitionWrapper/index.test.js
+++ /dev/null
@@ -1,82 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { useFakeTimers } from 'sinon';
-import TransitionWrapper from './index';
-
-describe('TransitionWrapper', () => {
- let wrapper;
- let clock;
- const step = 'any-step-name';
-
- beforeEach(() => {
- clock = useFakeTimers({
- toFake: ['setTimeout', 'clearTimeout', 'Date'],
- });
- const props = {
- current: step,
- step: 'target-step-name',
- animationName: 'slide',
- animationDuration: 200,
- };
- wrapper = mount(
- Child
- );
- });
-
- afterEach(() => {
- clock.restore();
- });
-
- it('should render the child initially with animation config', () => {
- expect(wrapper.find('h1').length).to.equal(1);
- const className = wrapper.find('h1').props().className;
- expect(className).to.include('willTransition');
- });
-
- it('should show the element after state changed in favour of current child', () => {
- let className = wrapper.find('h1').props().className;
- expect(className).to.not.include('slideIn');
-
- wrapper.setProps({ current: 'target-step-name' });
- clock.tick(501);
- wrapper.update();
-
- className = wrapper.find('h1').props().className;
- expect(className).to.include('slideIn');
- });
-
- it('should hide the element after state changed against current child', () => {
- wrapper.setProps({ current: 'target-step-name' });
- clock.tick(501);
- wrapper.update();
-
- let className = wrapper.find('h1').props().className;
- expect(className).to.include('slideIn');
-
- wrapper.setProps({ current: 'any-step-name' });
- clock.tick(501);
- wrapper.update();
-
- className = wrapper.find('h1').props().className;
- expect(className).to.not.include('slideIn');
- });
-
- it('should allow to set animation name', () => {
- const props = {
- current: 'target-step-name',
- step: 'target-step-name',
- animationName: 'fade',
- };
- const customizedWrapper = mount(
- Child
- );
-
- clock.tick(501);
- customizedWrapper.update();
-
- const className = customizedWrapper.find('h1').props().className;
- expect(className).to.include('fadeIn');
- clock.restore();
- });
-});
diff --git a/src/components/toolbox/transitionWrapper/transitionWrapper.css b/src/components/toolbox/transitionWrapper/transitionWrapper.css
deleted file mode 100644
index 645deb3c59..0000000000
--- a/src/components/toolbox/transitionWrapper/transitionWrapper.css
+++ /dev/null
@@ -1,103 +0,0 @@
-.willTransition {
- &:not(.fadeIn):not(.fadeOut):not(.slideIn):not(.slideOut) {
- display: none;
- }
-
- &.slideIn,
- &.slideOut,
- &.fadeIn,
- &.fadeOut {
- animation-duration: 400ms;
- animation-fill-mode: forwards;
- }
-
- &.slideIn {
- animation-name: slideIn;
- }
-
- &.slideOut {
- animation-name: slideOut;
- }
-
- &.fadeIn {
- animation-name: fadeIn;
- }
-
- &.fadeOut {
- animation-name: fadeOut;
- }
-}
-
-@keyframes slideIn {
- 0% {
- opacity: 0;
- display: none;
- transform: translateX(100px);
- }
-
- 1% {
- opacity: 0;
- display: block;
- transform: translateX(100px);
- }
-
- 100% {
- opacity: 1;
- display: block;
- transform: translateX(0);
- }
-}
-
-@keyframes slideOut {
- 0% {
- display: block;
- opacity: 1;
- transform: translateX(0);
- }
-
- 99% {
- display: block;
- opacity: 0;
- transform: translateX(-100px);
- }
-
- 100% {
- display: none;
- opacity: 0;
- transform: translateX(-100px);
- }
-}
-
-@keyframes fadeIn {
- 0% {
- opacity: 0;
- display: none;
- }
-
- 1% {
- opacity: 0;
- display: block;
- }
-
- 100% {
- opacity: 1;
- display: block;
- }
-}
-
-@keyframes fadeOut {
- 0% {
- display: block;
- opacity: 1;
- }
-
- 99% {
- display: block;
- opacity: 0;
- }
-
- 100% {
- display: none;
- opacity: 0;
- }
-}
diff --git a/src/components/transactions/accountList.js b/src/components/transactions/accountList.js
deleted file mode 100644
index 5b96051a92..0000000000
--- a/src/components/transactions/accountList.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/* istanbul ignore file */
-import React from 'react';
-import { Link } from 'react-router-dom';
-import { FontIcon } from '../fontIcon';
-import routes from '../../constants/routes';
-import Piwik from '../../utils/piwik';
-import styles from './delegateStatistics.css';
-
-class AccountList extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- showVotesNumber: 35,
- loadAllVotes: false,
- votesFilterQuery: '',
- votesSize: (props.votes && props.votes.length) || 0,
- };
- }
-
- showMore(name, amount = 100) {
- const newAmount = this.state[name] + amount;
- this.setState({ [name]: newAmount });
- }
-
- filterList(data, filterQuery) {
- if (this.state[filterQuery] !== '') {
- data = data.filter((obj) => {
- const name = obj.props.children.trim();
- return name.includes(this.state[filterQuery]);
- });
- }
- return data;
- }
-
- getFormatedDelegates(dataName, filterQuery) {
- const data = this.props[dataName] ? this.props[dataName].map((user, key) => (
-
- {`${user.username || user.address} `}
-
- )) : [];
-
- return this.filterList(data, filterQuery);
- }
-
- search(filterName, e) {
- const { value } = e.target;
- this.setState({
- [filterName]: value,
- });
- }
-
- clearSearch(filterQuery) {
- Piwik.trackingEvent('Trasanctions_AccountList', 'button', 'Clear search');
- this.search(filterQuery, { target: { value: '' } });
- }
-
- renderSearchFilter(filterQuery, placeholder) {
- return (
-
-
- 0 ? styles.dirty : ''} `}
- value={this.state[filterQuery]}
- onChange={this.search.bind(this, filterQuery)}
- placeholder={placeholder}
- />
- 0 ? styles.dirty : ''} `}
- value={this.state[filterQuery]}
- onChange={this.search.bind(this, filterQuery)}
- placeholder={this.props.t('Filter')}
- />
-
-
- );
- }
-}
-
-export default AccountList;
diff --git a/src/components/transactions/amount.js b/src/components/transactions/amount.js
deleted file mode 100644
index f9402d85c7..0000000000
--- a/src/components/transactions/amount.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import React from 'react';
-import { translate } from 'react-i18next';
-import styles from './transactions.css';
-import LiskAmount from '../liskAmount';
-import transactionTypes from '../../constants/transactionTypes';
-
-const Amount = (props) => {
- const params = {};
- if (props.value.type === transactionTypes.send
- && props.value.senderId === props.value.recipientId) {
- params.className = 'greyLabel';
- params.pre = '';
- } else if (props.value.senderId !== props.address) {
- params.className = 'greenLabel';
- params.pre = '+';
- } else if (props.value.type === transactionTypes.send
- && props.value.recipientId !== props.address) {
- params.pre = '-';
- params.className = 'greyLabel';
- }
- const amount = props.value.type !== transactionTypes.send ? '-' :
;
- return (
-
-
- { params.pre }
- {amount}
-
-
- );
-};
-export default translate()(Amount);
diff --git a/src/components/transactions/amount.test.js b/src/components/transactions/amount.test.js
deleted file mode 100644
index 95cdb3f30a..0000000000
--- a/src/components/transactions/amount.test.js
+++ /dev/null
@@ -1,77 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import PropTypes from 'prop-types';
-import configureMockStore from 'redux-mock-store';
-import Amount from './amount';
-import i18n from '../../i18n';
-
-
-describe('Amount', () => {
- const store = configureMockStore([])({});
- it('should have className "transactions__greyLabel" for type 0', () => {
- const inputValue = {
- value: {
- type: 0,
- recipientId: '1085993630748340485L',
- senderId: '1085993630748340485L',
- },
- address: 'address',
- };
- const expectedValue = /greyLabel/g;
- const wrapper = mount(
, {
- context: { i18n, store },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- store: PropTypes.object.isRequired,
- },
- });
- const html = wrapper.find('.transactionAmount').html();
- expect(html.match(expectedValue))
- .to.have.lengthOf(1);
- });
-
- it('should have className "transactions__greenLabel" for type 1', () => {
- const inputValue = {
- value: {
- type: 1,
- recipientId: '1085993630748340485L',
- senderId: '1085993630748340485L',
- },
- address: 'address',
- };
- const expectedValue = /greenLabel/g;
- const wrapper = mount(
, {
- context: { i18n, store },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- store: PropTypes.object.isRequired,
- },
- });
- const html = wrapper.find('.transactionAmount').html();
- expect(html.match(expectedValue))
- .to.have.lengthOf(1);
- });
-
- it('should have className "transactions__greyLabel" for outgoing transaction', () => {
- const inputValue = {
- value: {
- type: 0,
- recipientId: '1085993630748340485L',
- senderId: 'address',
- },
- address: 'address',
- };
- const expectedValue = /greyLabel/g;
- const wrapper = mount(
, {
- context: { i18n, store },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- store: PropTypes.object.isRequired,
- },
- });
- const html = wrapper.find('.transactionAmount').html();
- expect(html.match(expectedValue))
- .to.have.lengthOf(1);
- });
-});
diff --git a/src/components/transactions/delegateStatistics.css b/src/components/transactions/delegateStatistics.css
deleted file mode 100644
index 20bd73a669..0000000000
--- a/src/components/transactions/delegateStatistics.css
+++ /dev/null
@@ -1,320 +0,0 @@
-@import '../app/variables.css';
-
-:root {
- --detail-label-font-weight: var(--font-weight-very-bold);
- --list-line-height: 25px;
- --details-label-font-size-XL: 15px;
- --details-label-font-size-L: 12px;
- --details-label-font-size-XS: 12px;
- --back-button-font-size-XL: 15px;
- --back-button-font-size-L: 12px;
- --back-button-font-size-XS: 12px;
- --back-button-arrow-font-size-XL: 16px;
- --back-button-arrow-font-size-L: 16px;
- --back-button-arrow-font-size-XS: 16px;
-}
-
-.addressLink {
- color: var(--color-link);
- font-weight: 600;
- text-decoration: none;
-
- &::after {
- content: "• ";
- padding: 0px 6px;
- color: var(--color-primary-standard) !important;
- }
-
- &:last-child::after {
- content: "";
- }
-}
-
-.filters {
- font-weight: var(--font-weight-bold);
- color: var(--color-grayscale-medium);
- line-height: var(--list-line-height);
- list-style: none;
- padding: 0;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
-
- & .filter {
- display: inline-block;
- cursor: pointer;
- font-size: 15px;
- font-weight: 500;
- vertical-align: middle;
- margin-right: 10px;
-
- &:not(:last-of-type) {
- margin-right: 24px;
- }
- }
-
- & .active {
- border-bottom: 2px solid var(--color-grayscale-dark);
- color: var(--color-grayscale-dark);
- }
-}
-
-.search {
- position: relative;
- color: var(--color-grayscale-medium);
-
- & input {
- height: 25px;
- border: none;
- outline: none;
- margin: 0;
- min-width: 200px;
- font-size: var(--details-label-font-size-L);
- font-weight: 600;
- padding-left: 30px;
- padding-right: 20px;
- vertical-align: top;
- background-color: transparent;
- border-radius: 0;
- border-bottom: solid 2px transparent;
- transition: all ease 250ms;
-
- &.desktopInput {
- display: inline-block;
- }
-
- &.mobileInput {
- display: none;
- }
-
- &:focus,
- &.dirty {
- border-bottom-color: var(--color-grayscale-medium);
-
- & ~ .clean {
- visibility: visible;
- }
- }
- }
-
- & .clean,
- & .search {
- color: rgba(0, 0, 0, 0.38);
- position: absolute;
- }
-
- & .search {
- font-size: 16px;
- vertical-align: middle;
- top: 6px;
- left: 8px;
- color: var(--color-grayscale-dark);
- }
-
- & .clean {
- visibility: hidden;
- top: 6px;
- right: 0;
- font-size: 16px;
- cursor: pointer;
- }
-}
-
-.details {
- line-height: var(--list-line-height);
- color: var(--color-grayscale-dark);
- background: linear-gradient(90deg, #fff 0%, #f5f8fc 100%);
- margin: 0 -48px;
- padding: 0 48px;
-
- & .showAll,
- & .showMore {
- color: var(--color-primary-standard);
- font-size: 16px;
- font-weight: 600;
- padding-top: 6px;
- cursor: pointer;
-
- & .arrowDown {
- padding-right: 5px;
- margin-top: -2px;
- margin-left: -3px;
- }
- }
-
- & .showMore {
- margin-bottom: 20px;
- }
-
- & footer {
- padding-bottom: 92px;
- }
-
- & .row {
- padding-bottom: 48px;
-
- &:last-child {
- padding-bottom: 32px;
- }
- }
-
- & .column {
- position: relative;
- padding-left: 50px;
- }
-
- & .label {
- padding-bottom: 10px;
- font-weight: var(--font-weight-very-bold);
- display: flex;
- justify-content: space-between;
- }
-
- & header {
- padding-left: 0px;
-
- & h3 {
- font-family: var(--content-font);
-
- & small {
- font-weight: var(--detail-label-font-weight);
- margin-left: -6px;
- cursor: pointer;
- }
-
- & .backButton {
- & .arrow {
- vertical-align: middle;
- }
-
- & .text {
- vertical-align: middle;
- }
- }
- }
- }
-}
-
-@media (--xLarge-viewport) {
- .details {
- & .label {
- font-size: var(--details-label-font-size-L);
- }
-
- & .value {
- & a,
- & span {
- font-size: 15px;
- font-weight: 500;
-
- & span {
- color: inherit;
- }
- }
-
- & span {
- color: var(--color-grayscale-dark);
- }
-
- & .copy {
- font-size: 24px;
- vertical-align: top;
- }
-
- &.sender a {
- font-weight: 600;
- }
- }
-
- & header {
- & small {
- font-size: var(--back-button-font-size-XL);
- }
-
- & .backButton {
- & .arrow {
- font-size: var(--back-button-arrow-font-size-XL);
- }
- }
- }
- }
-}
-
-@media (--large-viewport) {
- .details {
- & .label {
- font-size: var(--details-label-font-size-L);
- }
-
- & header {
- & small {
- font-size: var(--back-button-font-size-L);
- }
-
- & .backButton {
- & .arrow {
- font-size: var(--back-button-arrow-font-size-L);
- }
- }
- }
- }
-}
-
-@media (--small-viewport) {
- .details {
- & .row {
- margin-right: 0;
- margin-left: 0;
- padding-bottom: 0;
-
- &:last-child {
- padding-bottom: 50px;
- }
- }
-
- & .column {
- padding-bottom: 30px;
- }
-
- & .label {
- display: flex;
- flex-direction: column;
- }
- }
-}
-
-@media (--xSmall-viewport) {
- .details {
- padding-bottom: 40px;
-
- & .row {
- padding-bottom: 0px;
-
- &:last-child {
- padding-bottom: 50px;
- }
- }
-
- & .column {
- padding-bottom: 20px;
- }
-
- & .label {
- font-size: var(--details-label-font-size-XS);
- }
-
- & header {
- margin-bottom: 20px;
-
- & small {
- font-size: var(--back-button-font-size-XS);
- }
-
- & .backButton {
- & .arrow {
- font-size: var(--back-button-arrow-font-size-XS);
- }
- }
- }
- }
-}
diff --git a/src/components/transactions/rows.css b/src/components/transactions/rows.css
deleted file mode 100644
index 8474458497..0000000000
--- a/src/components/transactions/rows.css
+++ /dev/null
@@ -1,50 +0,0 @@
-@import '../app/variablesV2.css';
-
-.row {
- width: 100%;
- height: 60px;
- font-family: var(--content-font);
- font-size: var(--button-font-size-s);
- box-sizing: border-box;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- cursor: pointer;
- padding: 0 16px;
- color: var(--color-content-light);
-
- &:nth-of-type(even) {
- background-color: #f8f9fb;
- }
-
- &:hover {
- background-color: var(--color-rows-hover);
- }
-}
-
-.cellAddress {
- min-width: 140px;
-}
-
-.reference {
- text-overflow: ellipsis;
- white-space: nowrap;
- overflow: hidden;
- text-align: left;
-}
-
-.date {
- color: #868ba1;
- min-width: 70px;
-}
-
-.amount {
- color: var(--color-content-light);
- min-width: 70px;
- text-align: right;
-
- & > span:last-child {
- margin-left: 5px;
- }
-}
diff --git a/src/components/transactions/rows.js b/src/components/transactions/rows.js
deleted file mode 100644
index 036f9f1788..0000000000
--- a/src/components/transactions/rows.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import React from 'react';
-import TransactionType from './transactionType';
-import styles from './rows.css';
-import Amount from './amount';
-import Spinner from '../spinner';
-import { DateFromTimestamp } from '../timestamp/index';
-
-class Row extends React.Component {
- // eslint-disable-next-line class-methods-use-this
- shouldComponentUpdate(nextProps) {
- return nextProps.value.id !== this.props.value.id || nextProps.value.confirmations <= 1000;
- }
-
- render() {
- const { props } = this;
-
- return (
-
props.onClick(this.props)}
- >
-
-
- {
- props.value.confirmations
- ?
- :
- }
-
-
-
- );
- }
-}
-
-export default (Row);
diff --git a/src/components/transactions/rows.test.js b/src/components/transactions/rows.test.js
deleted file mode 100644
index 5d951426cf..0000000000
--- a/src/components/transactions/rows.test.js
+++ /dev/null
@@ -1,102 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import tableStyle from 'react-toolbox/lib/table/theme.css';
-import configureMockStore from 'redux-mock-store';
-import { BrowserRouter as Router } from 'react-router-dom';
-import { Provider } from 'react-redux';
-import { I18nextProvider } from 'react-i18next';
-import PropTypes from 'prop-types';
-
-import accounts from '../../../test/constants/accounts';
-import i18n from '../../i18n';
-import Rows from './rows';
-import history from '../../history';
-
-describe('Rows', () => {
- const store = configureMockStore([])({});
- const rowData = {
- id: '1038520263604146911',
- height: 5,
- blockId: '12520699228609837463',
- type: 0,
- timestamp: 35929631,
- senderPublicKey: accounts.genesis.publicKey,
- senderId: accounts.genesis.address,
- recipientId: accounts.delegate.address,
- recipientPublicKey: accounts.delegate.publicKey,
- amount: 464000000000,
- fee: 10000000,
- signature: '3d276c1cb00edbc803e8911033727fe4a77f931868f89dc2f42deeefd7aa2eef1a58cd289517546ac3135f804499d1406234597d5b6198c4b9dac373c2b1bd03',
- signatures: [],
- confirmations: 892,
- asset: {
- data: '123',
- },
- };
- const address = '16313739661670634666L';
-
- const options = {
- context: { store, history },
- childContextTypes: {
- store: PropTypes.object.isRequired,
- history: PropTypes.object.isRequired,
- },
- };
-
- it('should render 3 columns', () => {
- const wrapper = mount(
-
-
- {}}
- onClick={() => {}}
- t={v => v}
- />
-
-
- , options);
-
- expect(wrapper.find('.transactions-cell')).to.have.lengthOf(3);
- });
-
- it('should not cause any error on click if props.onClick is not defined', () => {
- const wrapper = mount(
-
-
- {}}
- t={v => v}
- />
-
-
- , options);
-
- wrapper.find('.transactions-cell').at(0).simulate('click');
- });
-
- it('should render Spinner if no value.confirmations" ', () => {
- rowData.confirmations = undefined;
- const wrapper = mount(
-
-
- {}}
- t={v => v}
- nextStep={() => {}}
- />
-
-
- , options);
- expect(wrapper.find('Spinner')).to.have.lengthOf(1);
- });
-});
diff --git a/src/components/transactions/states.css b/src/components/transactions/states.css
deleted file mode 100644
index 21fcd787e4..0000000000
--- a/src/components/transactions/states.css
+++ /dev/null
@@ -1,17 +0,0 @@
-.leftText {
- text-align: left;
- padding-left: 0px;
-}
-
-.rightText {
- text-align: right;
-}
-
-.ordinaryText {
- text-decoration: none;
- color: inherit;
-}
-
-.clickable {
- cursor: pointer;
-}
diff --git a/src/components/transactions/status.js b/src/components/transactions/status.js
deleted file mode 100644
index fd0ca89ea1..0000000000
--- a/src/components/transactions/status.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import React from 'react';
-import IconButton from '../toolbox/buttons/iconButton';
-import styles from './transactions.css';
-
-const Status = (props) => {
- let iconProps = {};
- if (props.value.type === 0
- && props.value.senderId === props.value.recipientId) {
- iconProps = {
- icon: 'replay',
- };
- } else if (props.value.senderId !== props.address) {
- iconProps = {
- icon: 'call_received',
- className: styles.in,
- };
- } else if (props.value.type !== 0 || props.value.recipientId !== props.address) {
- iconProps = {
- icon: 'call_made',
- className: styles.out,
- };
- }
- return
;
-};
-
-export default Status;
diff --git a/src/components/transactions/status.test.js b/src/components/transactions/status.test.js
deleted file mode 100644
index 8a16b181fc..0000000000
--- a/src/components/transactions/status.test.js
+++ /dev/null
@@ -1,52 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { shallow } from 'enzyme';
-import IconButton from '../toolbox/buttons/iconButton';
-import Status from './status';
-
-describe('Status', () => {
- it('shows "replay" icon for sender and receiver are the same', () => {
- const inputValue = {
- value: {
- type: 0,
- recipientId: '1085993630748340485L',
- senderId: '1085993630748340485L',
- },
- address: 'address',
- };
- const expectedValue = 'replay';
- const wrapper = shallow(
);
- expect(wrapper.find(IconButton).get(0).props.icon)
- .to.equal(expectedValue);
- });
-
- it('shows "call_received" icon for type 1', () => {
- const inputValue = {
- value: {
- type: 1,
- recipientId: '1085993630748340485L',
- senderId: '1085993630748340485L',
- },
- address: 'address',
- };
- const expectedValue = 'call_received';
- const wrapper = shallow(
);
- expect(wrapper.find(IconButton).get(0).props.icon)
- .to.equal(expectedValue);
- });
-
- it('shows "call_made" icon for outgoing transaction', () => {
- const inputValue = {
- value: {
- type: 1,
- recipientId: '1085993630748340485L',
- senderId: 'address',
- },
- address: 'address',
- };
- const expectedValue = 'call_made';
- const wrapper = shallow(
);
- expect(wrapper.find(IconButton).get(0).props.icon)
- .to.equal(expectedValue);
- });
-});
diff --git a/src/components/transactions/transactionRow.css b/src/components/transactions/transactionRow.css
deleted file mode 100644
index c0124a8f9e..0000000000
--- a/src/components/transactions/transactionRow.css
+++ /dev/null
@@ -1,123 +0,0 @@
-@import '../app/variables.css';
-@import './states.css';
-
-:root {
- --grid-header-color: var(--color-black);
- --amount-negative-color: var(--color-grayscale-dark);
- --link-color: var(--color-primary-very-light);
- --row-background-color: var(--color-white);
- --result-address-font-weight: var(--font-weight-semi-bold);
- --grid-header-line-height: 60px;
- --main-row-line-height: 70px;
- --box-padding-right-M: 0;
- --box-padding-right-L: 0;
- --box-padding-right-XL: 0;
-}
-
-.header {
- color: var(--grid-header-color);
- line-height: var(--grid-header-line-height);
- font-weight: var(--font-weight-very-bold);
-
- &:nth-child(2) {
- text-align: left;
- }
-}
-
-.reference {
- text-overflow: ellipsis;
- white-space: nowrap;
- overflow: hidden;
- text-align: left;
-}
-
-.arrowRow {
- text-align: center;
-}
-
-.rows {
- color: var(--amount-negative-color);
- border-bottom: 0;
- border-top: 0;
- margin-right: 0;
- margin-left: 0;
- line-height: var(--main-row-line-height);
- white-space: nowrap;
-
- &:nth-of-type(even) {
- background: var(--gradient-greyscale);
- }
-
- &:nth-of-type(odd) {
- background: var(--row-background-color);
- }
-
- &:hover:not(:first-child) {
- background: var(--link-color);
- }
-
- & .copyIcon {
- vertical-align: bottom;
- padding-left: 5px;
- cursor: pointer;
- }
-
- & .address {
- font-weight: var(--result-address-font-weight);
- text-overflow: ellipsis;
- overflow: hidden;
- width: 135%;
- }
-}
-
-@media (--xLarge-viewport) {
- .header {
- font-size: 15px;
- }
-
- .rows {
- padding: 0 var(--box-padding-right-XL) 0 var(--box-padding-left-XL);
- }
-}
-
-@media (--large-viewport) {
- .header {
- font-size: 12px;
- }
-
- .rows {
- padding: 0 var(--box-padding-right-L) 0 var(--box-padding-left-L);
- }
-}
-
-@media (--medium-viewport) {
- .header {
- font-size: 12px;
- }
-
- .rows {
- padding: 0 var(--box-padding-right-M) 0 var(--box-padding-left-M);
-
- &:nth-of-type(even) {
- background: var(--gradient-greyscale-mobile);
- }
-
- &:nth-of-type(odd) {
- background: var(--color-grayscale-mobile-background);
- }
- }
-
- .arrowRow {
- text-align: right;
-
- & span {
- margin-right: 8px;
- }
- }
-}
-
-@media (--small-viewport) {
- .hiddenXs {
- display: none;
- }
-}
diff --git a/src/components/transactions/transactionRow.js b/src/components/transactions/transactionRow.js
deleted file mode 100644
index 80bbc29ef6..0000000000
--- a/src/components/transactions/transactionRow.js
+++ /dev/null
@@ -1,52 +0,0 @@
-// istanbul ignore file
-import React from 'react';
-import grid from 'flexboxgrid/dist/flexboxgrid.css';
-import { translate } from 'react-i18next';
-import TransactionType from './transactionType';
-import styles from './transactionRow.css';
-import Amount from './amount';
-import Spinner from '../spinner';
-import { DateFromTimestamp } from '../timestamp/index';
-import { FontIcon } from '../fontIcon';
-
-class TransactionRow extends React.Component {
- // eslint-disable-next-line class-methods-use-this
- shouldComponentUpdate(nextProps) {
- return nextProps.value.id !== this.props.value.id || nextProps.value.confirmations <= 1000;
- }
-
- render() {
- const { props } = this;
- const onClick = !props.onClick ? (() => {}) : () => props.onClick(this.props);
- return (
-
-
-
-
- {props.value.asset && props.value.asset.data
- ? {props.value.asset.data}
- : '-'}
-
-
-
-
- {props.value.confirmations ?
- : }
-
-
-
-
-
-
-
- );
- }
-}
-
-export default translate()(TransactionRow);
diff --git a/src/components/transactions/transactionRow.test.js b/src/components/transactions/transactionRow.test.js
deleted file mode 100644
index 363ecee8f2..0000000000
--- a/src/components/transactions/transactionRow.test.js
+++ /dev/null
@@ -1,97 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import tableStyle from 'react-toolbox/lib/table/theme.css';
-import configureMockStore from 'redux-mock-store';
-import { BrowserRouter as Router } from 'react-router-dom';
-import { Provider } from 'react-redux';
-import { I18nextProvider } from 'react-i18next';
-import PropTypes from 'prop-types';
-
-import accounts from '../../../test/constants/accounts';
-import i18n from '../../i18n';
-import TransactionRow from './transactionRow';
-import history from '../../history';
-
-describe('TransactionRow', () => {
- const store = configureMockStore([])({});
- const rowData = {
- id: '1038520263604146911',
- height: 5,
- blockId: '12520699228609837463',
- type: 0,
- timestamp: 35929631,
- senderPublicKey: accounts.genesis.publicKey,
- senderId: accounts.genesis.address,
- recipientId: accounts.delegate.address,
- recipientPublicKey: accounts.delegate.publicKey,
- amount: 464000000000,
- fee: 10000000,
- signature: '3d276c1cb00edbc803e8911033727fe4a77f931868f89dc2f42deeefd7aa2eef1a58cd289517546ac3135f804499d1406234597d5b6198c4b9dac373c2b1bd03',
- signatures: [],
- confirmations: 892,
- asset: {
- data: '123',
- },
- };
- const address = '16313739661670634666L';
-
- const options = {
- context: { store, history },
- childContextTypes: {
- store: PropTypes.object.isRequired,
- history: PropTypes.object.isRequired,
- },
- };
-
- it('should render 4 columns', () => {
- const wrapper = mount(
-
-
- {}}
- onClick={() => {}}
- />
-
-
- , options);
-
- expect(wrapper.find('.transactions-cell')).to.have.lengthOf(5);
- });
-
- it('should not cause any error on click if props.onClick is not defined', () => {
- const wrapper = mount(
-
-
-
-
-
- , options);
-
- wrapper.find('.transactions-cell').at(0).simulate('click');
- });
-
- it('should render Spinner if no value.confirmations" ', () => {
- rowData.confirmations = undefined;
- const wrapper = mount(
-
-
- {}}
- />
-
-
- , options);
- expect(wrapper.find('Spinner')).to.have.lengthOf(1);
- });
-});
diff --git a/src/components/transactions/transactionType.js b/src/components/transactions/transactionType.js
deleted file mode 100644
index e8585f7aba..0000000000
--- a/src/components/transactions/transactionType.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React from 'react';
-import { translate } from 'react-i18next';
-import styles from './transactions.css';
-
-const TransactionType = (props) => { // eslint-disable-line complexity
- const { t } = props;
- let type;
- switch (props.type) {
- case 1:
- type = t('Second passphrase registration');
- break;
- case 2:
- type = t('Delegate registration');
- break;
- case 3:
- type = t('Delegate vote', { context: 'noun' });
- break;
- case 4:
- type = t('Multisignature Creation');
- break;
- case 5:
- type = t('Blockchain Application Registration');
- break;
- case 6:
- type = t('Send Lisk to Blockchain Application');
- break;
- case 7:
- type = t('Send Lisk from Blockchain Application');
- break;
- default:
- type = false;
- break;
- }
- const address = props.address !== props.senderId ? props.senderId : props.recipientId;
- const template = type || props.showTransaction
- ?
{type || t('Transaction')}
- :
{address} ;
- return template;
-};
-
-export default translate()(TransactionType);
diff --git a/src/components/transactions/transactionType.test.js b/src/components/transactions/transactionType.test.js
deleted file mode 100644
index 408e28f9fa..0000000000
--- a/src/components/transactions/transactionType.test.js
+++ /dev/null
@@ -1,82 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import PropTypes from 'prop-types';
-import { BrowserRouter as Router } from 'react-router-dom';
-import configureMockStore from 'redux-mock-store';
-import TransactionType from './transactionType';
-import history from '../../history';
-import i18n from '../../i18n';
-
-const store = configureMockStore([])({
- peers: {
- liskAPIClient: {},
- },
- account: {},
-});
-
-const options = {
- context: { i18n, store, history },
- childContextTypes: {
- store: PropTypes.object.isRequired,
- i18n: PropTypes.object.isRequired,
- history: PropTypes.object.isRequired,
- },
-};
-
-const createTest = (type) => {
- let expectedValue;
- switch (type) {
- case 0:
- expectedValue = 'Transaction';
- break;
- case 1:
- expectedValue = 'Second passphrase registration';
- break;
- case 2:
- expectedValue = 'Delegate registration';
- break;
- case 3:
- expectedValue = 'Delegate vote';
- break;
- case 4:
- expectedValue = 'Multisignature Creation';
- break;
- case 5:
- expectedValue = 'Blockchain Application Registration';
- break;
- case 6:
- expectedValue = 'Send Lisk to Blockchain Application';
- break;
- case 7:
- expectedValue = 'Send Lisk from Blockchain Application';
- break;
- default:
- expectedValue = false;
- break;
- }
-
- it(`show TransactionType equal to "${expectedValue}" for transaction type ${type}`, () => {
- const inputValue = {
- type,
- senderId: '1085993630748340485L',
- };
- const wrapper = mount(
, options);
- expect(wrapper.find('span').text()).to.be.equal(expectedValue);
- });
-};
-
-describe('TransactionType', () => {
- for (let i = 1; i < 8; i++) {
- createTest(i);
- }
-});
-
-it('sets TransactionType equal the values of "props.senderId"', () => {
- const inputValue = {
- type: 0,
- senderId: '1085993630748340485L',
- };
- const wrapper = mount(
, options);
- expect(wrapper.text()).to.equal(inputValue.senderId);
-});
diff --git a/src/components/transactions/transactions.css b/src/components/transactions/transactions.css
deleted file mode 100644
index 901936ec0b..0000000000
--- a/src/components/transactions/transactions.css
+++ /dev/null
@@ -1,175 +0,0 @@
-@import '../app/variables.css';
-@import './states.css';
-
-:root {
- --amount-positive-color: var(--color-success-dark);
- --amount-negative-color: var(--color-grayscale-dark);
- --filter-list-color: var(--color-grayscale-medium);
- --header-balance-unit-font-size-XL: 20px;
- --header-balance-unit-font-size-L: 18px;
- --header-subtitle-font-size-XL: 18px;
- --header-subtitle-font-size-L: 16px;
- --list-line-height: 25px;
- --header-line-height: 36px;
-}
-
-.smallButton {
- display: inline-block;
-}
-
-.wrapper {
- border-top-left-radius: 0px;
- border-bottom-left-radius: 0px;
- box-shadow: none;
-}
-
-.transactions {
- & .activity {
- display: flex;
- flex-direction: column;
- height: var(--main-box-height);
-
- & header {
- padding-top: 20px;
-
- & .accountTitle {
- color: var(--color-grayscale-medium);
- }
-
- & .copy {
- color: var(--color-grayscale-medium);
- }
-
- & .title {
- margin: 26px 0;
- float: left;
- }
-
- & .account {
- text-align: right;
- }
-
- & h2 {
- font-weight: var(--font-weight-semi-bold);
- }
-
- & h3 {
- display: inline-block;
- margin: 0;
- }
-
- & .address {
- text-align: right;
- cursor: pointer;
- color: var(--color-grayscale-dark);
- }
-
- & .transfer {
- color: var(--color-grayscale-dark);
- }
-
- & .balanceUnit {
- font-weight: var(--font-weight-semi-bold);
- }
-
- & .headerButtons {
- float: right;
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: calc(100% / 2 - 30%);
- min-width: 243px;
- margin-top: 20px;
- }
-
- & .headerButtons > a {
- display: flex;
- align-items: center;
- font-size: 16px;
- font-weight: 600;
- color: var(--color-primary-standard);
- cursor: pointer;
- text-decoration: none;
- }
-
- & > div > a:first-child {
- margin-right: 15px;
- }
-
- & > div > a:last-child {
- & button {
- font-size: 16px;
- }
- }
- }
- }
-}
-
-.greyLabel {
- font-weight: var(--font-weight-semi-bold);
- color: var(--amount-negative-color);
-}
-
-.greenLabel {
- font-weight: var(--font-weight-semi-bold);
- color: var(--amount-positive-color) !important;
-}
-
-.list {
- font-weight: var(--font-weight-bold);
- color: var(--filter-list-color);
- line-height: var(--list-line-height);
- list-style: none;
- padding-left: 0px;
- margin-bottom: 37px;
-
- & .item {
- display: inline-block;
- cursor: pointer;
-
- &:not(:last-of-type) {
- margin-right: 50px;
- }
- }
-
- & .active {
- border-bottom: 2px solid var(--amount-negative-color);
- color: var(--amount-negative-color);
- }
-}
-
-@media (--xLarge-viewport) {
- .transactions {
- & .activity {
- & header {
- & h2 {
- & .balanceUnit {
- font-size: var(--header-balance-unit-font-size-XL);
- }
- }
-
- & .address {
- font-size: var(--header-subtitle-font-size-XL);
- }
- }
- }
- }
-}
-
-@media (--large-viewport) {
- .transactions {
- & .activity {
- & header {
- & h2 {
- & .balanceUnit {
- font-size: var(--header-balance-unit-font-size-L);
- }
- }
-
- & .address {
- font-size: var(--header-subtitle-font-size-L);
- }
- }
- }
- }
-}
diff --git a/src/components/transactions/transactionsHeader.js b/src/components/transactions/transactionsHeader.js
deleted file mode 100644
index 1f7638dae0..0000000000
--- a/src/components/transactions/transactionsHeader.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import React from 'react';
-import grid from 'flexboxgrid/dist/flexboxgrid.css';
-import { translate } from 'react-i18next';
-import styles from './transactionRow.css';
-
-const TransactionsHeader = ({ t }) => (
-
-);
-
-export default translate()(TransactionsHeader);
diff --git a/src/components/transactions/transactionsHeader.test.js b/src/components/transactions/transactionsHeader.test.js
deleted file mode 100644
index 6582a00065..0000000000
--- a/src/components/transactions/transactionsHeader.test.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import tableStyle from 'react-toolbox/lib/table/theme.css';
-import PropTypes from 'prop-types';
-import i18n from '../../i18n';
-import TransactionsHeader from './transactionsHeader';
-
-describe('TransactionsHeader', () => {
- it('should have 3 header columns', () => {
- const wrapper = mount(
-
,
- {
- context: { i18n },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- },
- },
- );
-
- expect(wrapper.find('.transactions-header')).to.have.lengthOf(4);
- });
-});
diff --git a/src/components/transactions/transactionsList.css b/src/components/transactions/transactionsList.css
deleted file mode 100644
index 3b7c2a18ba..0000000000
--- a/src/components/transactions/transactionsList.css
+++ /dev/null
@@ -1,45 +0,0 @@
-@import '../app/variables.css';
-
-.empty {
- text-align: center;
- font-weight: var(--font-weight-semi-bold);
- padding-top: 100px;
- color: var(--color-grayscale-dark);
-}
-
-.results {
- overflow-y: initial;
-
- & > div > div {
- font-weight: 600;
- }
-}
-
-@media (--xLarge-viewport) {
- .results {
- overflow: auto;
- margin: 0px calc(0 - var(--box-padding-left-XL));
- }
-}
-
-@media (--large-viewport) {
- .results {
- overflow: auto;
- margin: 0px calc(0 - var(--box-padding-left-L));
- }
-}
-
-@media (--medium-viewport) {
- .results {
- overflow: auto;
- margin: 0px calc(0 - var(--box-padding-left-M));
- }
-}
-
-.onShowMore {
- height: auto !important;
-}
-
-.onBarEnabled {
- margin-bottom: 0 !important;
-}
diff --git a/src/components/transactions/transactionsList.js b/src/components/transactions/transactionsList.js
deleted file mode 100644
index 1875a0df1c..0000000000
--- a/src/components/transactions/transactionsList.js
+++ /dev/null
@@ -1,83 +0,0 @@
-import React from 'react';
-// import tableStyle from 'react-toolbox/lib/table/theme.css';
-import Rows from './rows';
-
-import txFilters from '../../constants/transactionFilters';
-import txTypes from '../../constants/transactionTypes';
-import styles from './transactionsList.css';
-import { parseSearchParams } from '../../utils/searchParams';
-
-class TransactionsList extends React.Component {
- componentWillReceiveProps(nextProps) {
- // istanbul ignore else
- if (nextProps.transactions && this.props.nextStep) this.showDetails(nextProps.transactions);
- }
-
- showDetails(transactions) {
- const paramsId = parseSearchParams(this.props.history.location.search).id;
-
- // istanbul ignore else
- if (paramsId) {
- const value = transactions.filter(transaction => transaction.id === paramsId)[0];
- // istanbul ignore else
- if (value) this.props.nextStep({ value, t: this.props.t });
- }
- }
-
- render() { // eslint-disable-line
- const {
- transactions,
- dashboard,
- address,
- onClick,
- showMore,
- t,
- } = this.props;
- // All, incoming, outgoing are filter values. To be more consistance with other possible tabs
- // We can refer to props.filter as tabObj
- const tabObj = this.props.filter;
- const fixIncomingFilter = (transaction) => {
- const isTypeNonSend = transaction.type !== txTypes.send;
- const isFilterIncoming = tabObj && tabObj.value === txFilters.incoming;
- const isAccountInit = transaction.type === txTypes.send
- && transaction.senderId === transaction.recipientId;
-
- return !(isFilterIncoming && (isTypeNonSend || isAccountInit));
- };
-
- // istanbul ignore else
- if (transactions.length === 0) {
- // istanbul ignore else
- if (dashboard || (tabObj && tabObj.value !== txFilters.all)) {
- return (
-
- {t('There are no {{filterName}} transactions.', {
- filterName: tabObj && tabObj.name ? tabObj.name.toLowerCase() : '',
- })}
-
- );
- }
- return null;
- }
-
- return (
-
- {
- transactions
- .filter(fixIncomingFilter)
- .map(transaction => (
-
- ))
- }
-
- );
- }
-}
-
-export default TransactionsList;
diff --git a/src/components/transactions/transactionsList.test.js b/src/components/transactions/transactionsList.test.js
deleted file mode 100644
index 32d4530ce7..0000000000
--- a/src/components/transactions/transactionsList.test.js
+++ /dev/null
@@ -1,99 +0,0 @@
-import React from 'react';
-import thunk from 'redux-thunk';
-import { expect } from 'chai';
-import { spy } from 'sinon';
-import { mount } from 'enzyme';
-import PropTypes from 'prop-types';
-import TransactionsList from './transactionsList';
-
-import { prepareStore } from '../../../test/unit-test-utils/applicationInit';
-import peersReducer from '../../store/reducers/peers';
-import accountReducer from '../../store/reducers/account';
-import transactionReducer from '../../store/reducers/transaction';
-import txFilters from '../../constants/transactionFilters';
-import i18n from '../../i18n';
-
-describe('TransactionsList', () => {
- let wrapper;
- const emptyTx = [];
- const transactions = [{
- id: '11327666066806006572',
- type: 0,
- timestamp: 15647029,
- senderId: '5201600508578320196L',
- recipientId: '11950819909555235066L',
- amount: 69550000000,
- fee: 10000000,
- confirmations: 4314504,
- address: '12345678L',
- }];
-
- const store = prepareStore({
- peers: peersReducer,
- account: accountReducer,
- transaction: transactionReducer,
- }, [
- thunk,
- ]);
-
- const options = {
- context: { store, i18n },
- childContextTypes: {
- store: PropTypes.object.isRequired,
- i18n: PropTypes.object.isRequired,
- },
- };
-
- const props = {
- address: '',
- filter: {
- value: txFilters.incoming,
- name: 'In',
- },
- transactions,
- loading: false,
- dashboard: false,
- onClick: () => {},
- loadMore: () => {},
- prevStep: () => {},
- t: () => {},
- history: { location: { search: { id: transactions[0].id } } },
- };
-
- it('should render empty state template if transactions list is empty', () => {
- const propsNoTx = { ...props, transactions: emptyTx };
- wrapper = mount(
, options);
- expect(wrapper.find('.empty-message')).to.have.lengthOf(1);
- });
-
- it('should render nothing if transactions list is empty and filter is ALL', () => {
- const propsNoTx = {
- ...props,
- transactions: emptyTx,
- filter: {
- value: txFilters.all,
- name: 'All',
- },
- };
- wrapper = mount(
, options);
- expect(wrapper.html()).to.be.equal(null);
- });
-
- it('should render tx details if nextStep is a function', () => {
- const propsTxDetails = { ...props, nextStep: spy() };
- wrapper = mount(
, options);
-
- wrapper.setProps({
- history: {
- location: {
- search: { id: transactions[0].id },
- },
- },
- });
- wrapper.update();
- expect(propsTxDetails.nextStep).to.have.been.calledWith({
- value: transactions[0],
- t: propsTxDetails.t,
- });
- });
-});
diff --git a/src/components/transactions/transactionsOverview.js b/src/components/transactions/transactionsOverview.js
deleted file mode 100644
index 8f206cc00b..0000000000
--- a/src/components/transactions/transactionsOverview.js
+++ /dev/null
@@ -1,178 +0,0 @@
-import React from 'react';
-import { connect } from 'react-redux';
-import Waypoint from 'react-waypoint';
-// import grid from 'flexboxgrid/dist/flexboxgrid.css';
-import EmptyState from '../emptyState';
-import TransactionsList from './transactionsList';
-import styles from './transactions.css';
-import txFilters from '../../constants/transactionFilters';
-import { getIndexOfBookmark } from '../../utils/bookmarks';
-import Piwik from '../../utils/piwik';
-
-class TransactionsOverview extends React.Component {
- constructor(props) {
- super(props);
- this.canLoadMore = true;
-
- this.props.onInit();
- }
-
- loadMore() {
- Piwik.trackingEvent('TransactionsOverview', 'button', 'Load more');
- if (this.canLoadMore) {
- this.canLoadMore = false;
- this.props.onLoadMore();
- }
- }
-
- // eslint-disable-next-line class-methods-use-this
- isSmallScreen() {
- return window.innerWidth <= 768;
- }
-
- componentDidUpdate() {
- this.canLoadMore = this.props.count === null
- || this.props.count > this.props.transactions.length;
- }
-
- isActiveFilter(filter) {
- return (!this.props.activeFilter && filter === txFilters.all)
- || (this.props.activeFilter === filter);
- }
-
- shouldShowEmptyState() {
- return this.props.transactions.length === 0 && !this.isLoading()
- && (!this.props.activeFilter || this.props.activeFilter === txFilters.all);
- }
-
- isLoading() {
- return this.props.loading.length > 0;
- }
-
- setTransactionsFilter(filter) {
- Piwik.trackingEvent('TransactionsOverview', 'button', 'Set transactions filter');
- this.props.onFilterSet(filter);
- }
-
- render() { // eslint-disable-line complexity
- const filters = [
- {
- name: this.props.t('All'),
- value: txFilters.all,
- className: 'filter-all',
- },
- {
- name: this.isSmallScreen() ? this.props.t('In') : this.props.t('Incoming'),
- value: txFilters.incoming,
- className: 'filter-in',
- },
- {
- name: this.isSmallScreen() ? this.props.t('Out') : this.props.t('Outgoing'),
- value: txFilters.outgoing,
- className: 'filter-out',
- },
- ];
-
- if (this.props.delegate && this.props.delegate.username) {
- filters[txFilters.statistics] = {
- name: this.isSmallScreen() ? this.props.t('Stats') : this.props.t('Delegate statistics'),
- value: txFilters.statistics,
- className: 'delegate-statistics',
- };
- } else {
- filters[txFilters.accountInfo] = {
- name: this.isSmallScreen() ? this.props.t('Info') : this.props.t('Account Info'),
- value: txFilters.accountInfo,
- className: 'account-info',
- };
- }
-
- const index = getIndexOfBookmark(
- this.props.bookmarks,
- { address: this.props.address },
- );
- const accountTitle = this.props.bookmarks[index]
- && this.props.bookmarks[index].title;
- const hasTitle = index !== -1 && accountTitle !== this.props.address;
-
- return (
-
-
-
- {this.props.t('Transaction')}
- {
- hasTitle && (
-
- {this.props.t(' of')}
- {' '}
- {accountTitle}
-
- )
- }
-
-
- {this.shouldShowEmptyState()
- ? (
-
- )
- : null }
- {this.shouldShowEmptyState()
- ? null
- : (
-
- {filters.map((filter, i) => (
- this.setTransactionsFilter(filter.value)}
- >
- {filter.name}
-
- ))}
-
- )
- }
- {
-
this.props.onTransactionRowClick(props)}
- />
- }
- {
- // the whole transactions box should be scrollable on XS
- // otherwise only the transaction list should be scrollable
- // (see transactionList.js)
- this.isSmallScreen()
- ? (
- { this.loadMore(); }}
- />
- )
- : null
- }
-
- );
- }
-}
-const mapStateToProps = state => ({
- bookmarks: state.bookmarks,
- peers: state.peers,
- account: state.account,
-});
-
-export default connect(mapStateToProps)(TransactionsOverview);
diff --git a/src/components/transactions/transactionsOverview.test.js b/src/components/transactions/transactionsOverview.test.js
deleted file mode 100644
index bb09917447..0000000000
--- a/src/components/transactions/transactionsOverview.test.js
+++ /dev/null
@@ -1,77 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { spy } from 'sinon';
-import { mountWithContext } from '../../../test/unit-test-utils/mountHelpers';
-import TransactionsOverview from './transactionsOverview';
-import store from '../../store';
-import accounts from '../../../test/constants/accounts';
-
-describe('TransactionsOverview', () => {
- let wrapper;
- let props;
- let onInitSpy;
- let onLoadMoreSpy;
- let onFilterSetSpy;
-
- beforeEach(() => {
- window.innerWidth = 200;
- props = {
- t: () => {},
- loading: [],
- peers: {
- liskAPIClient: {},
- },
- transactions: [{ id: '13395546734664987127' }],
- count: 1000,
- address: accounts.genesis.address,
- onInit: () => {},
- onLoadMore: () => {},
- onFilterSet: () => {},
- match: { url: '' },
- };
- store.getState = () => ({
- bookmarks: { LSK: [] },
- peers: { status: {}, options: {}, liskAPIClient: {} },
- transactions: {
- confirmed: [],
- },
- account: {
- address: accounts.genesis.address,
- },
- search: {},
- });
- onInitSpy = spy(props, 'onInit');
- onLoadMoreSpy = spy(props, 'onLoadMore');
- onFilterSetSpy = spy(props, 'onFilterSet');
- wrapper = mountWithContext(
-
,
- { storeState: store },
- );
- });
-
- it('should render Waypoint on smallScreen', () => {
- expect(wrapper).to.have.descendants('Waypoint');
- });
-
- it('should show empty state when no transactions', () => {
- wrapper.setProps({ transactions: [] });
- wrapper.update();
- expect(wrapper.find('EmptyState')).to.be.present();
- });
-
- /* eslint-disable no-unused-expressions */
- it('should call onInit on constructor call', () => {
- expect(onInitSpy).to.have.been.calledOnce;
- });
-
- it('should call onLoadMore when Waypoint reached', () => {
- wrapper.find('Waypoint').props().onEnter();
- expect(onLoadMoreSpy).to.have.been.calledOnce;
- });
-
- it('should call onFilterSet when filtering transations', () => {
- wrapper.find('.transaction-filter-item').first().simulate('click');
- expect(onFilterSetSpy).to.have.been.calledOnce;
- });
- /* eslint-enable no-unused-expressions */
-});
diff --git a/src/components/transactionsV2/transactionTypeV2.css b/src/components/transactionsV2/transactionTypeV2.css
deleted file mode 100644
index c06c2259a4..0000000000
--- a/src/components/transactionsV2/transactionTypeV2.css
+++ /dev/null
@@ -1,55 +0,0 @@
-@import '../app/variablesV2.css';
-@import '../app/mixins.css';
-
-.transactionType {
- align-items: center;
- display: flex;
-
- & .icon {
- display: block;
- height: 24px;
- margin-right: 24px;
- width: 24px;
- }
-
- & .info {
- display: flex;
-
- & > .avatar {
- margin-right: 24px;
- }
-
- & > .accountInfo {
- display: flex;
- flex-direction: column;
- justify-content: space-evenly;
- }
- }
-
- & .title {
- @mixin headingSmall;
-
- color: var(--color-maastricht-blue);
- display: block;
- }
-
- & .address {
- @mixin contentSmallest;
-
- color: var(--color-slate-gray);
- }
-}
-
-@media (--medium-viewport) {
- .transactionType {
- & .icon {
- display: none;
- }
-
- & .info {
- & > .avatar {
- display: none;
- }
- }
- }
-}
diff --git a/src/components/transactionsV2/transactionTypeV2.js b/src/components/transactionsV2/transactionTypeV2.js
deleted file mode 100644
index dc509198b9..0000000000
--- a/src/components/transactionsV2/transactionTypeV2.js
+++ /dev/null
@@ -1,82 +0,0 @@
-import React from 'react';
-import { translate } from 'react-i18next';
-import AccountVisual from '../accountVisual';
-import styles from './transactionTypeV2.css';
-import { getIndexOfBookmark } from '../../utils/bookmarks';
-import svg from '../../utils/svgIcons';
-import { getTokenFromAddress } from '../../utils/api/transactions';
-
-const TransactionTypeV2 = (props) => { // eslint-disable-line complexity
- const { t } = props;
- const address = props.address !== props.senderId ? props.senderId : props.recipientId;
- let type;
- let icon = svg.txDefault;
- switch (props.type) {
- case 1:
- type = t('Second passphrase registration');
- icon = svg.tx2ndPassphrase;
- break;
- case 2:
- type = t('Delegate registration');
- icon = svg.txDelegate;
- break;
- case 3:
- type = t('Delegate vote', { context: 'noun' });
- icon = svg.txVote;
- break;
- case 4:
- type = t('Multisignature Creation');
- break;
- case 5:
- type = t('Blockchain Application Registration');
- break;
- case 6:
- type = t('Send Lisk to Blockchain Application');
- break;
- case 7:
- type = t('Send Lisk from Blockchain Application');
- break;
- default:
- type = false;
- break;
- }
- const token = getTokenFromAddress(address);
-
- const index = getIndexOfBookmark(
- props.bookmarks,
- { address, token },
- );
- const hasTitle = index > -1;
- const accountTitle = hasTitle && props.bookmarks[token][index]
- && props.bookmarks[token][index].title;
-
- return (
-
-
-
- { type || props.showTransaction
- ? (
-
{type || t('Transaction')}
- ) : (
-
-
-
-
- {
- hasTitle ? accountTitle : address
- }
-
- { hasTitle && {address} }
-
-
- )}
-
-
- );
-};
-
-export default translate()(TransactionTypeV2);
diff --git a/src/components/transactionsV2/transactionTypeV2.test.js b/src/components/transactionsV2/transactionTypeV2.test.js
deleted file mode 100644
index a468b9f9cb..0000000000
--- a/src/components/transactionsV2/transactionTypeV2.test.js
+++ /dev/null
@@ -1,93 +0,0 @@
-import React from 'react';
-import { mount } from 'enzyme';
-import PropTypes from 'prop-types';
-import TransactionTypeV2 from './transactionTypeV2';
-import accounts from '../../../test/constants/accounts';
-import i18n from '../../i18n';
-
-const options = {
- context: { i18n },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- },
-};
-
-const createTest = (type) => {
- let expectedValue;
- switch (type) {
- case 0:
- expectedValue = 'Transaction';
- break;
- case 1:
- expectedValue = 'Second passphrase registration';
- break;
- case 2:
- expectedValue = 'Delegate registration';
- break;
- case 3:
- expectedValue = 'Delegate vote';
- break;
- case 4:
- expectedValue = 'Multisignature Creation';
- break;
- case 5:
- expectedValue = 'Blockchain Application Registration';
- break;
- case 6:
- expectedValue = 'Send Lisk to Blockchain Application';
- break;
- case 7:
- expectedValue = 'Send Lisk from Blockchain Application';
- break;
- default:
- expectedValue = 'Transaction';
- break;
- }
-
- it(`show TransactionType equal to "${expectedValue}" for transaction type ${type}`, () => {
- const props = {
- type,
- senderId: accounts.delegate.address,
- showTransaction: true,
- bookmarks: {
- LSK: [],
- },
- };
- const wrapper = mount(
, options);
- expect(wrapper.find('.title')).toIncludeText(expectedValue);
- });
-};
-
-describe('TransactionType V2', () => {
- for (let i = 1; i < 9; i++) {
- createTest(i);
- }
-
- it('sets TransactionType equal the values of "props.senderId"', () => {
- const props = {
- type: 0,
- senderId: accounts.delegate.address,
- bookmarks: {
- LSK: [],
- },
- };
- const wrapper = mount(
, options);
- expect(wrapper).toIncludeText(props.senderId);
- });
-
- it('Should render bookmark name if account is bookmarked', () => {
- const title = 'bookmark test';
- const props = {
- type: 0,
- senderId: accounts.delegate.address,
- bookmarks: {
- LSK: [{
- address: accounts.delegate.address,
- title,
- }],
- },
- };
- const wrapper = mount(
, options);
- expect(wrapper).toIncludeText(title);
- });
-});
diff --git a/src/components/transferTabs/index.js b/src/components/transferTabs/index.js
deleted file mode 100644
index 485f593596..0000000000
--- a/src/components/transferTabs/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import React from 'react';
-import { translate } from 'react-i18next';
-import grid from 'flexboxgrid/dist/flexboxgrid.css';
-import styles from './tabs.css';
-
-const TransferTabs = ({ t, setTabSend, isActiveTabSend }) => (
-
-
{ setTabSend(true); }}
- >
- {t('Send')}
-
-
{ setTabSend(false); }}
- >
- {t('Request')}
-
-
-);
-
-export default translate()(TransferTabs);
diff --git a/src/components/transferTabs/tabs.css b/src/components/transferTabs/tabs.css
deleted file mode 100644
index 65fc8facbb..0000000000
--- a/src/components/transferTabs/tabs.css
+++ /dev/null
@@ -1,31 +0,0 @@
-@import '../app/variables.css';
-
-.tab {
- font-size: 16px;
- vertical-align: middle;
- text-align: center;
- line-height: 50px;
- font-weight: var(--font-weight-normal);
- border: 3px solid transparent;
- border-radius: 6px;
- background: var(--gradient-action-blue);
- background-clip: padding-box;
- padding: 2px;
- cursor: pointer;
-}
-
-.tabActive {
- color: var(--color-white);
- background: var(--gradient-action-blue);
-}
-
-.tabInactive {
- color: var(--color-primary-medium);
- background: var(--color-white);
-}
-
-@media (--medium-viewport) {
- .tab {
- display: none;
- }
-}
diff --git a/src/components/trezor/index.js b/src/components/trezor/index.js
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/src/utils/form.js b/src/utils/form.js
index 360e2a0ff1..ca40fd4cfd 100644
--- a/src/utils/form.js
+++ b/src/utils/form.js
@@ -1,27 +1,5 @@
-
-export const authStatePrefill = account => ({
- secondPassphrase: {
- value: null,
- },
- passphrase: {
- value: (account && account.passphrase) || '',
- },
-});
-
-export const authStateIsValid = state => (
- !state.passphrase.error
- && state.passphrase.value !== ''
- && !state.secondPassphrase.error
- && state.secondPassphrase.value !== ''
-);
-
export const passphraseIsValid = passphrase => (!passphrase.error && passphrase.value !== '');
-export const handleChange = function (name, value, error) {
- this.setState({
- [name]: {
- value,
- error: typeof error === 'string' ? error : undefined,
- },
- });
+export default {
+ passphraseIsValid,
};