From cf430b33c7ab7913ba92e64cf1aca3f619728c10 Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Thu, 11 Jul 2019 16:43:30 -0700 Subject: [PATCH 1/7] Add copy prop to SettingItem component. --- src/component/setting.js | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/component/setting.js b/src/component/setting.js index dd07b69dc..e0c8d639a 100644 --- a/src/component/setting.js +++ b/src/component/setting.js @@ -85,11 +85,20 @@ const iStyles = StyleSheet.create({ item: { height: 60, }, - name: { + left: { flex: 1, + }, + name: { color: color.grey, fontSize: font.sizeSub, }, + copy: { + width: '80%', + fontSize: font.sizeS, + lineHeight: font.lineHeightS, + color: color.greyListLabel, + opacity: 0.74, + }, lbl: { fontSize: font.sizeS, color: color.greyListLabel, @@ -100,9 +109,22 @@ const iStyles = StyleSheet.create({ }, }); -export const SettingItem = ({ name, onSelect, label, arrow, children }) => ( - - {name} +export const SettingItem = ({ + name, + copy, + onSelect, + label, + arrow, + children, +}) => ( + + + {name} + {copy ? {copy} : null} + {label ? {label} : null} {children} {arrow ? ( @@ -115,6 +137,7 @@ export const SettingItem = ({ name, onSelect, label, arrow, children }) => ( SettingItem.propTypes = { name: PropTypes.string.isRequired, + copy: PropTypes.string, onSelect: PropTypes.func, label: PropTypes.string, arrow: PropTypes.bool, From 507c9aabe4733dd79a6435d665f31a2d20e3fcff Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Thu, 11 Jul 2019 16:43:42 -0700 Subject: [PATCH 2/7] Add select autopilot view for mobile. --- src/view/select-atpl-mobile.js | 91 ++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 src/view/select-atpl-mobile.js diff --git a/src/view/select-atpl-mobile.js b/src/view/select-atpl-mobile.js new file mode 100644 index 000000000..04b2734d3 --- /dev/null +++ b/src/view/select-atpl-mobile.js @@ -0,0 +1,91 @@ +import React from 'react'; +import { View } from 'react-native'; +import { createStyles, maxWidth } from '../component/media-query'; +import { observer } from 'mobx-react'; +import PropTypes from 'prop-types'; +import Background from '../component/background'; +import MainContent from '../component/main-content'; +import { CopyOnboardText, Text } from '../component/text'; +import { RadioButton, GlasButton } from '../component/button'; +import { SettingItem } from '../component/setting'; +import { color, font, smallBreakWidth } from '../component/style'; + +// +// Select Autopilot View +// + +const baseStyles = { + content: { + paddingLeft: 20, + paddingRight: 20, + }, + title: { + marginTop: 60, + textAlign: 'center', + }, + copyTxt: { + textAlign: 'center', + marginTop: 10, + maxWidth: 300, + }, + list: { + marginTop: 50, + width: undefined, + alignSelf: 'stretch', + }, +}; + +const styles = createStyles( + baseStyles, + + maxWidth(smallBreakWidth, { + title: { + fontSize: font.sizeL + 10, + lineHeight: font.sizeL + 10, + marginTop: 40, + }, + list: { + marginTop: 20, + }, + }) +); + +const SelectAutopilotView = ({ store, autopilot, info }) => ( + + + + Automatically set up channels? + + + { + "If you want to avoid manual channel creation, the app can allocate funds to channels for you. It's called autopilot." + } + + + (store.settings.autopilot ? {} : autopilot.toggle())} + > + + + (!store.settings.autopilot ? {} : autopilot.toggle())} + > + + + + + info.initLoaderSyncing()}>Next + +); + +SelectAutopilotView.propTypes = { + store: PropTypes.object.isRequired, + autopilot: PropTypes.object.isRequired, + info: PropTypes.object.isRequired, +}; + +export default observer(SelectAutopilotView); From 9512fc392bb50475535d6409ce24299ddfe3740e Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Thu, 11 Jul 2019 16:45:57 -0700 Subject: [PATCH 3/7] Add nav action mobile to screen storybook. --- stories/screen-story.js | 52 ++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/stories/screen-story.js b/stories/screen-story.js index f32695265..1231bc6c5 100644 --- a/stories/screen-story.js +++ b/stories/screen-story.js @@ -5,6 +5,7 @@ import { action } from '@storybook/addon-actions'; import sinon from 'sinon'; import { Store } from '../src/store'; import NavAction from '../src/action/nav'; +import NavActionMobile from '../src/action/nav-mobile'; import IpcAction from '../src/action/ipc'; import GrpcAction from '../src/action/grpc'; import InfoAction from '../src/action/info'; @@ -93,6 +94,7 @@ const store = new Store(); store.init(); const file = sinon.createStubInstance(FileAction); const nav = sinon.createStubInstance(NavAction); +const navMobile = sinon.createStubInstance(NavActionMobile); const db = sinon.createStubInstance(AppStorage); const ipc = sinon.createStubInstance(IpcAction); const grpc = sinon.createStubInstance(GrpcAction); @@ -133,14 +135,14 @@ storiesOf('Screens', module) .add('Select Seed', () => ( )) - .add('Seed Intro (Mobile)', () => ) + .add('Seed Intro (Mobile)', () => ) .add('Seed', () => ) .add('Seed (Mobile)', () => ) .add('Seed Verify', () => ( )) .add('Seed Verify (Mobile)', () => ( - + )) .add('Restore Wallet: Seed', () => ( @@ -157,7 +159,7 @@ storiesOf('Screens', module) )) .add('Set PIN (Mobile)', () => ( - + )) .add('Set PIN Confirm (Mobile)', () => ( @@ -175,7 +177,7 @@ storiesOf('Screens', module) )) .add('Reset Password - Saved', () => ) .add('Reset PIN - Current (Mobile)', () => ( - + )) .add('Reset PIN - New (Mobile)', () => ( @@ -183,7 +185,7 @@ storiesOf('Screens', module) .add('Reset PIN - Confirm New (Mobile)', () => ( )) - .add('Reset PIN - Saved (Mobile)', () => ) + .add('Reset PIN - Saved (Mobile)', () => ) .add('New Address', () => ( )) @@ -218,24 +220,28 @@ storiesOf('Screens', module) )) .add('Notifications', () => ) .add('Notifications (Mobile)', () => ( - + )) .add('CLI', () => ) .add('Transactions', () => ( )) .add('Transactions (Mobile)', () => ( - + )) .add('Transaction Details', () => ( )) .add('Transaction Details (Mobile)', () => ( - + )) .add('Channels', () => ) .add('Channels (Mobile)', () => ( - + )) .add('Channels (Opening)', () => ( @@ -244,12 +250,12 @@ storiesOf('Screens', module) )) .add('Channel Details', () => ) .add('Channel Details (Mobile)', () => ( - + )) .add('Channel Delete', () => ( @@ -258,54 +264,58 @@ storiesOf('Screens', module) )) .add('Channel Create (Mobile)', () => ( - + )) .add('Deposit', () => ) .add('Deposit (Mobile)', () => ( - + )) .add('Payment', () => ) .add('Pay Lightning Confirm', () => ( )) .add('Pay Lightning Confirm (Mobile)', () => ( - + )) .add('Pay Lightning Done', () => ( )) .add('Pay Lightning Done (Mobile)', () => ( - + )) .add('Payment Failed', () => ) .add('Payment Failed (Mobile)', () => ( - + )) .add('Pay Bitcoin', () => ( )) .add('Pay Bitcoin (Mobile)', () => ( - + )) .add('Pay Bitcoin Confirm', () => ( )) .add('Pay Bitcoin Confirm (Mobile)', () => ( - + )) .add('Pay Bitcoin Done', () => ) .add('Pay Bitcoin Done (Mobile)', () => ( - + )) .add('Invoice', () => ) .add('Invoice (Mobile)', () => ( - + )) .add('Invoice QR', () => ( )) .add('Invoice QR (Mobile)', () => ( - + )); // set some dummy data From d7a777b30faa047627af2e4c9cbf009b7f092f5e Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Thu, 11 Jul 2019 16:46:10 -0700 Subject: [PATCH 4/7] Wire up Select Autopilot mobile view. --- src/action/nav-mobile.js | 4 ++++ src/view/main-mobile.js | 8 +++++++- src/view/new-address-mobile.js | 6 +++--- stories/screen-story.js | 6 +++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/action/nav-mobile.js b/src/action/nav-mobile.js index 4a7078de6..9312cffbb 100644 --- a/src/action/nav-mobile.js +++ b/src/action/nav-mobile.js @@ -97,6 +97,10 @@ class NavAction { this._navigate('NewAddress'); } + goSelectAutopilot() { + this._navigate('SelectAutopilot'); + } + goLoaderSyncing() { this._navigate('LoaderSyncing'); this._reset('Main', 'LoaderSyncing'); diff --git a/src/view/main-mobile.js b/src/view/main-mobile.js index 981437f16..7e9a2dee1 100644 --- a/src/view/main-mobile.js +++ b/src/view/main-mobile.js @@ -18,6 +18,7 @@ import SetPinConfirmView from './set-pin-confirm-mobile'; import SeedSuccessView from './seed-success-mobile'; import RestoreSeedView from './restore-seed-mobile'; import NewAddressView from './new-address-mobile'; +import SelectAutopilotView from './select-atpl-mobile'; import PinView from './pin-mobile'; import ResetPinCurrentView from './reset-pin-current-mobile'; @@ -93,7 +94,11 @@ const SeedSuccess = () => ; const RestoreSeed = () => ; const NewAddress = () => ( - + +); + +const SelectAutopilot = () => ( + ); const Password = () => ; @@ -212,6 +217,7 @@ const MainStack = createStackNavigator( SeedSuccess, RestoreSeed, NewAddress, + SelectAutopilot, Password, LoaderSyncing, Home, diff --git a/src/view/new-address-mobile.js b/src/view/new-address-mobile.js index deb32cc79..e87975777 100644 --- a/src/view/new-address-mobile.js +++ b/src/view/new-address-mobile.js @@ -59,7 +59,7 @@ const styles = createStyles( }) ); -const NewAddressView = ({ store, invoice, info }) => ( +const NewAddressView = ({ store, invoice, nav }) => ( @@ -80,7 +80,7 @@ const NewAddressView = ({ store, invoice, info }) => ( > {store.walletAddress} - info.initLoaderSyncing()}> + nav.goSelectAutopilot()}> Done @@ -96,7 +96,7 @@ const NewAddressView = ({ store, invoice, info }) => ( NewAddressView.propTypes = { store: PropTypes.object.isRequired, invoice: PropTypes.object.isRequired, - info: PropTypes.object.isRequired, + nav: PropTypes.object.isRequired, }; export default observer(NewAddressView); diff --git a/stories/screen-story.js b/stories/screen-story.js index 1231bc6c5..3ec7a4a46 100644 --- a/stories/screen-story.js +++ b/stories/screen-story.js @@ -85,6 +85,7 @@ import ResetPinConfirm from '../src/view/reset-pin-confirm-mobile'; import ResetPinSaved from '../src/view/reset-pin-saved-mobile'; import NewAddress from '../src/view/new-address'; import NewAddressMobile from '../src/view/new-address-mobile'; +import SelectAutopilotMobile from '../src/view/select-atpl-mobile'; import Wait from '../src/view/wait'; import WaitMobile from '../src/view/wait-mobile'; import RestoreSeed from '../src/view/restore-seed'; @@ -190,7 +191,10 @@ storiesOf('Screens', module) )) .add('New Address (Mobile)', () => ( - + + )) + .add('Select Autopilot (Mobile)', () => ( + )) .add('Loader - Syncing Chain', () => ) .add('Loader - Syncing Chain (Mobile)', () => ( From a69eb0c811fc0f78b759148f00bded4a352d4cae Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Tue, 20 Aug 2019 16:07:54 -0700 Subject: [PATCH 5/7] Create new SettingsCopy component and update Select Autopilot styles. --- src/component/setting.js | 75 ++++++++++++++++++++++------------ src/view/select-atpl-mobile.js | 18 ++++---- 2 files changed, 57 insertions(+), 36 deletions(-) diff --git a/src/component/setting.js b/src/component/setting.js index e0c8d639a..93d9ecfd8 100644 --- a/src/component/setting.js +++ b/src/component/setting.js @@ -85,20 +85,11 @@ const iStyles = StyleSheet.create({ item: { height: 60, }, - left: { - flex: 1, - }, name: { + flex: 1, color: color.grey, fontSize: font.sizeSub, }, - copy: { - width: '80%', - fontSize: font.sizeS, - lineHeight: font.lineHeightS, - color: color.greyListLabel, - opacity: 0.74, - }, lbl: { fontSize: font.sizeS, color: color.greyListLabel, @@ -109,22 +100,9 @@ const iStyles = StyleSheet.create({ }, }); -export const SettingItem = ({ - name, - copy, - onSelect, - label, - arrow, - children, -}) => ( - - - {name} - {copy ? {copy} : null} - +export const SettingItem = ({ name, onSelect, label, arrow, children }) => ( + + {name} {label ? {label} : null} {children} {arrow ? ( @@ -137,13 +115,56 @@ export const SettingItem = ({ SettingItem.propTypes = { name: PropTypes.string.isRequired, - copy: PropTypes.string, onSelect: PropTypes.func, label: PropTypes.string, arrow: PropTypes.bool, children: PropTypes.node, }; +// +// Setting Copy Item +// + +const iCopyStyles = StyleSheet.create({ + item: { + height: 100, + }, + left: { + flex: 1, + flexDirection: 'column', + justifyContent: 'center', + }, + name: { + color: color.grey, + fontSize: font.sizeSub, + marginBottom: 5, + }, + copy: { + width: '80%', + fontSize: font.sizeS, + lineHeight: font.lineHeightS, + color: color.greyListLabel, + opacity: 0.74, + }, +}); + +export const SettingCopyItem = ({ name, onSelect, copy, children }) => ( + + + {name} + {copy} + + {children} + +); + +SettingCopyItem.propTypes = { + name: PropTypes.string.isRequired, + onSelect: PropTypes.func, + copy: PropTypes.string, + children: PropTypes.node, +}; + // // Setting Header // diff --git a/src/view/select-atpl-mobile.js b/src/view/select-atpl-mobile.js index 04b2734d3..fc2dd9811 100644 --- a/src/view/select-atpl-mobile.js +++ b/src/view/select-atpl-mobile.js @@ -7,7 +7,7 @@ import Background from '../component/background'; import MainContent from '../component/main-content'; import { CopyOnboardText, Text } from '../component/text'; import { RadioButton, GlasButton } from '../component/button'; -import { SettingItem } from '../component/setting'; +import { SettingCopyItem } from '../component/setting'; import { color, font, smallBreakWidth } from '../component/style'; // @@ -20,16 +20,16 @@ const baseStyles = { paddingRight: 20, }, title: { - marginTop: 60, + marginTop: 80, textAlign: 'center', }, copyTxt: { textAlign: 'center', marginTop: 10, - maxWidth: 300, + maxWidth: 260, }, list: { - marginTop: 50, + marginTop: 40, width: undefined, alignSelf: 'stretch', }, @@ -62,23 +62,23 @@ const SelectAutopilotView = ({ store, autopilot, info }) => ( } - (store.settings.autopilot ? {} : autopilot.toggle())} > - - + (!store.settings.autopilot ? {} : autopilot.toggle())} > - + - info.initLoaderSyncing()}>Next + info.initLoaderSyncing()}>Save ); From c95a9a384e4e610a2766748084b5c45e2518d407 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Wed, 21 Aug 2019 14:26:43 +0200 Subject: [PATCH 6/7] Refactor SettingCopyItem styles --- src/component/setting.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/component/setting.js b/src/component/setting.js index 93d9ecfd8..bcc68c74a 100644 --- a/src/component/setting.js +++ b/src/component/setting.js @@ -127,24 +127,24 @@ SettingItem.propTypes = { const iCopyStyles = StyleSheet.create({ item: { - height: 100, + height: null, + paddingTop: 20, + paddingBottom: 20, }, left: { flex: 1, - flexDirection: 'column', - justifyContent: 'center', }, name: { color: color.grey, fontSize: font.sizeSub, - marginBottom: 5, }, copy: { - width: '80%', fontSize: font.sizeS, lineHeight: font.lineHeightS, color: color.greyListLabel, opacity: 0.74, + paddingRight: 50, + marginTop: 5, }, }); From 95e022ada83c573875fdb59d47519016b03f9eac Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Wed, 21 Aug 2019 14:27:01 +0200 Subject: [PATCH 7/7] Cleanup select-atpl-mobile.js --- src/view/select-atpl-mobile.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/view/select-atpl-mobile.js b/src/view/select-atpl-mobile.js index fc2dd9811..760352156 100644 --- a/src/view/select-atpl-mobile.js +++ b/src/view/select-atpl-mobile.js @@ -25,7 +25,7 @@ const baseStyles = { }, copyTxt: { textAlign: 'center', - marginTop: 10, + marginTop: 20, maxWidth: 260, }, list: { @@ -45,7 +45,7 @@ const styles = createStyles( marginTop: 40, }, list: { - marginTop: 20, + marginTop: 50, }, }) ); @@ -65,14 +65,14 @@ const SelectAutopilotView = ({ store, autopilot, info }) => ( (store.settings.autopilot ? {} : autopilot.toggle())} + onSelect={() => !store.settings.autopilot && autopilot.toggle()} > (!store.settings.autopilot ? {} : autopilot.toggle())} + onSelect={() => store.settings.autopilot && autopilot.toggle()} >