From a0294031b2f1f215afe1f202204030b7bd2ba900 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Mon, 26 Nov 2018 12:21:31 +0100 Subject: [PATCH] style(home): new layout for wallet settings form --- app/components/Home/Home.js | 4 +- app/components/Home/WalletLauncher.js | 28 ++--- .../Home/WalletSettingsFormLocal.js | 103 ++++++++---------- app/components/UI/DataRow.js | 8 +- stories/containers/home.stories.js | 8 +- .../__snapshots__/PaySummaryRow.spec.js.snap | 2 - .../UI/__snapshots__/Button.spec.js.snap | 1 + .../UI/__snapshots__/Sidebar.spec.js.snap | 4 +- 8 files changed, 71 insertions(+), 87 deletions(-) diff --git a/app/components/Home/Home.js b/app/components/Home/Home.js index d946d6a8..03a79d5c 100644 --- a/app/components/Home/Home.js +++ b/app/components/Home/Home.js @@ -71,8 +71,8 @@ class Home extends React.Component { - - + + - + @@ -75,8 +75,8 @@ class WalletLauncher extends React.Component { {wallet.type === 'local' && ( <> - Settings - + Settings + )} - + + + Delete + + + + + + ) } diff --git a/app/components/Home/WalletSettingsFormLocal.js b/app/components/Home/WalletSettingsFormLocal.js index d15ae78f..8623a522 100644 --- a/app/components/Home/WalletSettingsFormLocal.js +++ b/app/components/Home/WalletSettingsFormLocal.js @@ -1,7 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import { Flex } from 'rebass' -import { DataRow, Form, Input, Label, Range, Toggle } from 'components/UI' +import { Bar, DataRow, Form, Input, Label, Range, Text, Toggle } from 'components/UI' import * as yup from 'yup' class WalletSettingsFormLocal extends React.Component { @@ -18,51 +18,6 @@ class WalletSettingsFormLocal extends React.Component { } } - validateAutopilotAllocation = value => { - try { - yup - .number() - .required() - .positive() - .min(0) - .max(100) - .typeError('A number is required') - .validateSync(value) - } catch (error) { - return error.message - } - } - - validateAutopilotMaxchannels = value => { - try { - yup - .number() - .required() - .positive() - .integer() - .max(100) - .typeError('A number is required') - .validateSync(value) - } catch (error) { - return error.message - } - } - - validateAutopilotChansize = value => { - try { - yup - .number() - .required() - .positive() - .integer() - .max(100000000) - .typeError('A number is required') - .validateSync(value) - } catch (error) { - return error.message - } - } - preSubmit = values => { if (values.autopilotAllocation) { values.autopilotAllocation = values.autopilotAllocation / 100 @@ -93,14 +48,53 @@ class WalletSettingsFormLocal extends React.Component { > {({ formState }) => ( + Naming + + Alias} + left={ + <> + + + The wallet name is only visible for you inside Zap. + + + } + right={ + + } + /> + + + + + The alias will be visible for others on the network. + + + } right={ Autopilot} right={} /> + + {formState.values.autopilot ? ( ( - - {left} - - - {right} - + {left} + {right} ) diff --git a/stories/containers/home.stories.js b/stories/containers/home.stories.js index c2163b71..9cebef93 100644 --- a/stories/containers/home.stories.js +++ b/stories/containers/home.stories.js @@ -30,13 +30,7 @@ const store = new Store({ }, { id: 2, - autopilot: true, - autopilotAllocation: 0.9, - autopilotMaxchannels: 10, - autopilotMaxchansize: 16777215, - autopilotMinchansize: 20000, - autopilotMinconfs: 1, - autopilotPrivate: false, + autopilot: false, chain: 'bitcoin', network: 'mainnet', type: 'local' diff --git a/test/unit/components/Pay/__snapshots__/PaySummaryRow.spec.js.snap b/test/unit/components/Pay/__snapshots__/PaySummaryRow.spec.js.snap index d35dd621..9563e65f 100644 --- a/test/unit/components/Pay/__snapshots__/PaySummaryRow.spec.js.snap +++ b/test/unit/components/Pay/__snapshots__/PaySummaryRow.spec.js.snap @@ -8,13 +8,11 @@ exports[`component.Form.DataRow should render correctly 1`] = ` > left contnet right content diff --git a/test/unit/components/UI/__snapshots__/Button.spec.js.snap b/test/unit/components/UI/__snapshots__/Button.spec.js.snap index 9d87670c..21e3d7be 100644 --- a/test/unit/components/UI/__snapshots__/Button.spec.js.snap +++ b/test/unit/components/UI/__snapshots__/Button.spec.js.snap @@ -32,6 +32,7 @@ exports[`component.UI.Button should render correctly 1`] = ` border-radius: 5; font-weight: 300; line-height: '18px'; + white-space: nowrap; } .c0:disabled { diff --git a/test/unit/components/UI/__snapshots__/Sidebar.spec.js.snap b/test/unit/components/UI/__snapshots__/Sidebar.spec.js.snap index 977da21c..98041ddf 100644 --- a/test/unit/components/UI/__snapshots__/Sidebar.spec.js.snap +++ b/test/unit/components/UI/__snapshots__/Sidebar.spec.js.snap @@ -2,7 +2,7 @@ exports[`component.UI.Sidebar should render correctly 1`] = ` .c0 { - width: 33.33333333333333%; + width: 25%; color: primaryText; background-color: tertiaryColor; position: relative; @@ -12,6 +12,6 @@ exports[`component.UI.Sidebar should render correctly 1`] = `