From bb12830cb61fe9f60bbc23e0cc806dd1f0cac0a9 Mon Sep 17 00:00:00 2001 From: Javier Bueno Date: Wed, 17 Jul 2024 23:25:01 +0200 Subject: [PATCH] merge develop --- .../src/components/legacy/Modal/Modal.tsx | 5 + .../src/legacy/Catalyst/DownloadCatalyst.tsx | 239 ++++++++++++++++++ .../src/legacy/Catalyst/DownloadCatalyst.json | 58 +++++ 3 files changed, 302 insertions(+) create mode 100644 apps/wallet-mobile/src/legacy/Catalyst/DownloadCatalyst.tsx diff --git a/apps/wallet-mobile/src/components/legacy/Modal/Modal.tsx b/apps/wallet-mobile/src/components/legacy/Modal/Modal.tsx index 46eb8d69e7..a5a76d0502 100644 --- a/apps/wallet-mobile/src/components/legacy/Modal/Modal.tsx +++ b/apps/wallet-mobile/src/components/legacy/Modal/Modal.tsx @@ -101,6 +101,10 @@ const useStyles = () => { marginTop: 0, }, container: { +<<<<<<< Updated upstream +======= + height: 350, +>>>>>>> Stashed changes backgroundColor: color.bg_color_high, borderRadius: 4, ...atoms.px_xl, @@ -112,6 +116,7 @@ const useStyles = () => { ...atoms.p_lg, }, content: { + flex: 1, marginTop: 15, }, withTitle: { diff --git a/apps/wallet-mobile/src/legacy/Catalyst/DownloadCatalyst.tsx b/apps/wallet-mobile/src/legacy/Catalyst/DownloadCatalyst.tsx new file mode 100644 index 0000000000..8c26522153 --- /dev/null +++ b/apps/wallet-mobile/src/legacy/Catalyst/DownloadCatalyst.tsx @@ -0,0 +1,239 @@ +import {useCatalyst} from '@yoroi/staking' +import {useTheme} from '@yoroi/theme' +import React from 'react' +import {defineMessages, useIntl} from 'react-intl' +import {Image, Linking, ScrollView, StyleSheet, TouchableOpacity, View, ViewProps} from 'react-native' +import {SafeAreaView} from 'react-native-safe-area-context' + +import appstoreBadge from '../../assets/img/app-store-badge.png' +import playstoreBadge from '../../assets/img/google-play-badge.png' +import AppDownload from '../../assets/img/pic-catalyst-step1.png' +import {Button, ProgressStep, Spacer, Text, useModal} from '../../components' +import {Space} from '../../components/Space/Space' +import {useSelectedWallet} from '../../features/WalletManager/common/hooks/useSelectedWallet' +import globalMessages, {confirmationMessages} from '../../kernel/i18n/global-messages' +import {useStakingInfo} from '../Dashboard/StakePoolInfos' +import {Actions, Row} from './components' +import {useCatalystCurrentFund} from './useCatalystCurrentFund' + +type Props = { + onNext: () => void +} +export const DownloadCatalyst = ({onNext}: Props) => { + const strings = useStrings() + const {wallet} = useSelectedWallet() + const {stakingInfo} = useStakingInfo(wallet, {suspense: true}) + const {openModal} = useModal() + const styles = useStyles() + const {fund} = useCatalystCurrentFund() + const intl = useIntl() + + const formatDate = React.useCallback( + (date: Date) => + intl.formatDate(date, { + dateStyle: 'short', + timeStyle: 'medium', + hour12: false, + }), + [intl], + ) + + React.useEffect(() => { + if (stakingInfo?.status !== 'not-registered') { + openModal(strings.attention, , 270) + } + }, [openModal, stakingInfo?.status, strings.attention]) + + const fundName = fund.info.fundName + const registrationStart = `${formatDate(fund.info.snapshotStart)}: ${strings.registrationStart}` + const votingStart = `${formatDate(fund.info.votingStart)}: ${strings.votingStart}` + const votingEnd = `${formatDate(fund.info.votingEnd)}: ${strings.votingEnd}` + const votingResults = `${formatDate(fund.info.tallyingEnd)}: ${strings.votingResults}` + + return ( + + + + + + + {strings.subTitle} + + + + + + + + + + + + + + + + + + + {strings.tip} + + + + {fundName} + + {registrationStart} + + {votingStart} + + {votingEnd} + + {votingResults} + + + + +