diff --git a/src/components/modals/PocketChangeModal.tsx b/src/components/modals/PocketChangeModal.tsx new file mode 100644 index 00000000000..6039b581bf0 --- /dev/null +++ b/src/components/modals/PocketChangeModal.tsx @@ -0,0 +1,103 @@ +import * as React from 'react' +import { View } from 'react-native' +import type { AirshipBridge } from 'react-native-airship' + +import { useHandler } from '../../hooks/useHandler' +import { lstrings } from '../../locales/strings' +import { type Theme, useTheme } from '../services/ThemeContext' +import { SettingsHeaderRow } from '../settings/SettingsHeaderRow' +import { SettingsSliderRow } from '../settings/SettingsSliderRow' +import { SettingsSwitchRow } from '../settings/SettingsSwitchRow' +import { EdgeText } from '../themed/EdgeText' +import { ModalMessage } from '../themed/ModalParts' +import { ThemedModal } from '../themed/ThemedModal' + +const POCKET_AMOUNTS_XMR = [0.1, 0.2, 0.3, 0.5, 0.8, 1.3] + +export interface PocketChangeConfig { + enabled: boolean + amountIndex: number // Index into POCKET_AMOUNTS_XMR +} + +interface Props { + bridge: AirshipBridge + initialConfig: PocketChangeConfig +} + +export const PocketChangeModal: React.FC = props => { + const { bridge, initialConfig } = props + const theme = useTheme() + const styles = getStyles(theme) + const [enabled, setEnabled] = React.useState(initialConfig.enabled) + const [amountIndex, setAmountIndex] = React.useState( + initialConfig.amountIndex + ) + + const handleCancel = useHandler((): void => { + bridge.resolve(undefined) + }) + + return ( + + + {lstrings.pocketchange_description} + + + + {enabled && ( + <> + + + + + + + {POCKET_AMOUNTS_XMR[amountIndex]} XMR{' '} + {lstrings.pocketchange_per_pocket} + + + + {lstrings.pocketchange_explainer} + + )} + + + ) +} + +const getStyles = (theme: Theme): ReturnType => { + return makeStyles({ + container: { + flex: 1, + paddingHorizontal: theme.rem(1) + }, + amountDisplay: { + paddingVertical: theme.rem(0.5), + alignItems: 'center' as const + }, + amountText: { + fontSize: theme.rem(1.25), + color: theme.primaryText, + fontWeight: '500' as const + } + }) +} + +const makeStyles = (styles: any): any => styles