|
| 1 | +import React from 'react'; |
| 2 | +import { View } from 'react-native'; |
| 3 | +import { createStyles, maxWidth } from '../component/media-query'; |
| 4 | +import { observer } from 'mobx-react'; |
| 5 | +import PropTypes from 'prop-types'; |
| 6 | +import Background from '../component/background'; |
| 7 | +import MainContent from '../component/main-content'; |
| 8 | +import { CopyOnboardText, Text } from '../component/text'; |
| 9 | +import { RadioButton, GlasButton } from '../component/button'; |
| 10 | +import { SettingItem } from '../component/setting'; |
| 11 | +import { color, font, smallBreakWidth } from '../component/style'; |
| 12 | + |
| 13 | +// |
| 14 | +// Select Autopilot View |
| 15 | +// |
| 16 | + |
| 17 | +const baseStyles = { |
| 18 | + content: { |
| 19 | + paddingLeft: 20, |
| 20 | + paddingRight: 20, |
| 21 | + }, |
| 22 | + title: { |
| 23 | + marginTop: 60, |
| 24 | + textAlign: 'center', |
| 25 | + }, |
| 26 | + copyTxt: { |
| 27 | + textAlign: 'center', |
| 28 | + marginTop: 10, |
| 29 | + maxWidth: 300, |
| 30 | + }, |
| 31 | + list: { |
| 32 | + marginTop: 50, |
| 33 | + width: undefined, |
| 34 | + alignSelf: 'stretch', |
| 35 | + }, |
| 36 | +}; |
| 37 | + |
| 38 | +const styles = createStyles( |
| 39 | + baseStyles, |
| 40 | + |
| 41 | + maxWidth(smallBreakWidth, { |
| 42 | + title: { |
| 43 | + fontSize: font.sizeL + 10, |
| 44 | + lineHeight: font.sizeL + 10, |
| 45 | + marginTop: 40, |
| 46 | + }, |
| 47 | + list: { |
| 48 | + marginTop: 20, |
| 49 | + }, |
| 50 | + }) |
| 51 | +); |
| 52 | + |
| 53 | +const SelectAutopilotView = ({ store, autopilot, info }) => ( |
| 54 | + <Background color={color.blackDark}> |
| 55 | + <MainContent style={styles.content}> |
| 56 | + <CopyOnboardText style={styles.title}> |
| 57 | + Automatically set up channels? |
| 58 | + </CopyOnboardText> |
| 59 | + <Text style={styles.copyTxt}> |
| 60 | + { |
| 61 | + "If you want to avoid manual channel creation, the app can allocate funds to channels for you. It's called autopilot." |
| 62 | + } |
| 63 | + </Text> |
| 64 | + <View style={styles.list}> |
| 65 | + <SettingItem |
| 66 | + name="Use autopilot (recommended)" |
| 67 | + copy="I want the app to create channels and move my funds into those channels automatically." |
| 68 | + onSelect={() => (store.settings.autopilot ? {} : autopilot.toggle())} |
| 69 | + > |
| 70 | + <RadioButton selected={store.settings.autopilot === true} /> |
| 71 | + </SettingItem> |
| 72 | + <SettingItem |
| 73 | + name="Create channels manually" |
| 74 | + copy="I don't want the app to automatically create channels for me. I can do this all myself." |
| 75 | + onSelect={() => (!store.settings.autopilot ? {} : autopilot.toggle())} |
| 76 | + > |
| 77 | + <RadioButton selected={store.settings.autopilot === false} /> |
| 78 | + </SettingItem> |
| 79 | + </View> |
| 80 | + </MainContent> |
| 81 | + <GlasButton onPress={() => info.initLoaderSyncing()}>Next</GlasButton> |
| 82 | + </Background> |
| 83 | +); |
| 84 | + |
| 85 | +SelectAutopilotView.propTypes = { |
| 86 | + store: PropTypes.object.isRequired, |
| 87 | + autopilot: PropTypes.object.isRequired, |
| 88 | + info: PropTypes.object.isRequired, |
| 89 | +}; |
| 90 | + |
| 91 | +export default observer(SelectAutopilotView); |
0 commit comments