From 763e571f37f14c2287ba21eff068ddfb554e8458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EA=B7=9C=EC=B2=A0?= Date: Fri, 22 Oct 2021 15:09:36 +0900 Subject: [PATCH 1/6] Add isAllwonced --- src/modules/asset/Purchase.tsx | 3 +++ src/modules/asset/components/TxInput.tsx | 3 +++ src/modules/staking/Stake.tsx | 3 +++ src/shared/components/ConfirmationModal.tsx | 4 +++- src/shared/components/StakingConfirmModal.tsx | 4 +++- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/modules/asset/Purchase.tsx b/src/modules/asset/Purchase.tsx index 1153ffcfc..ce3f86863 100644 --- a/src/modules/asset/Purchase.tsx +++ b/src/modules/asset/Purchase.tsx @@ -92,6 +92,7 @@ const Purchase: FunctionComponent = () => { const balanceInToken = (balanceInCrypto * cryptoPrice) / tokenPrice; const { elContract } = useErcContract(); const [approvalGasPrice, setApprovalGasPrice] = useState(''); + const [isAllowanced, setIsAllowanced] = useState(false); const { addCount, isApproved, setIsApproved, isLoading, setIsLoading } = useCountingEstimatedGas(setEstimatedGas); const maxValueInToken = remainingSupplyInToken @@ -178,6 +179,7 @@ const Purchase: FunctionComponent = () => { step: TxStep.None, }); setIsApproved(Number(utils.formatEther(res)) > balanceInCrypto); + setIsAllowanced(Number(utils.formatEther(res)) > balanceInCrypto); }) .catch((e: any) => { afterTxFailed(e.message); @@ -233,6 +235,7 @@ const Purchase: FunctionComponent = () => { estimatedGas={estimagedGasPrice} isApproved={isApproved} approve={approve} + isAllowanced={isAllowanced} isLoading={isLoading} approvalGasPrice={approvalGasPrice} createTx={() => { diff --git a/src/modules/asset/components/TxInput.tsx b/src/modules/asset/components/TxInput.tsx index df5505460..a5d32b9fa 100644 --- a/src/modules/asset/components/TxInput.tsx +++ b/src/modules/asset/components/TxInput.tsx @@ -57,6 +57,7 @@ interface ITxInput { setCurrent: Dispatch>; setValues: Dispatch>; approve: () => void; + isAllowanced: boolean; isLoading: boolean; approvalGasPrice?: string; createTx: () => void; @@ -96,6 +97,7 @@ const TxInput: React.FC = ({ setCurrent, setValues, approve, + isAllowanced, isLoading, approvalGasPrice, createTx, @@ -355,6 +357,7 @@ const TxInput: React.FC = ({ }, ]} isApproved={isApproved} + isAllowanced={isAllowanced} isLoading={isLoading} approvalGasPrice={approvalGasPrice || ''} assetTypeOrRefund={isRefund || assetInCrypto.type} diff --git a/src/modules/staking/Stake.tsx b/src/modules/staking/Stake.tsx index 54877034f..836fc7969 100644 --- a/src/modules/staking/Stake.tsx +++ b/src/modules/staking/Stake.tsx @@ -85,6 +85,7 @@ const Stake: React.FC = () => { const [totalPrincipal, setTotalPrincipal] = useState( constants.Zero, ); + const [isAllowanced, setIsAllowanced] = useState(false); const { addCount, isApproved, setIsApproved, isLoading, setIsLoading } = useCountingEstimatedGas(setEstimatedGas, StakingType.Stake); const currentStakingRound = getCurrentStakingRound(); @@ -329,6 +330,7 @@ const Stake: React.FC = () => { if (isWalletUser) { getApproveGasPrice(); setIsApproved(isAllowanceForApprove()); + setIsAllowanced(isAllowanceForApprove()); setModalVisible(true); setEstimatedGas(StakingType.Stake, selectedRound, value); } else { @@ -369,6 +371,7 @@ const Stake: React.FC = () => { }, ]} isApproved={isApproved} + isAllowanced={isAllowanced} submitButtonText={t('staking.nth_staking', { round: selectedRound })} handler={() => onPressStaking()} isLoading={isLoading} diff --git a/src/shared/components/ConfirmationModal.tsx b/src/shared/components/ConfirmationModal.tsx index 079e05073..4fde78fc6 100644 --- a/src/shared/components/ConfirmationModal.tsx +++ b/src/shared/components/ConfirmationModal.tsx @@ -21,6 +21,7 @@ interface Props { subtitle: string; list: { label: string; value: string; subvalue?: string }[]; isApproved: boolean; + isAllowanced: boolean; isLoading?: boolean; approvalGasPrice: string; assetTypeOrRefund?: CryptoType | string; @@ -35,6 +36,7 @@ const ConfirmationModal: React.FC = ({ subtitle, list, isApproved, + isAllowanced, isLoading, approvalGasPrice, assetTypeOrRefund, @@ -96,7 +98,7 @@ const ConfirmationModal: React.FC = ({ backgroundColor: AppColors.WHITE, }}> - {assetTypeOrRefund === CryptoType.EL && ( + {assetTypeOrRefund === CryptoType.EL && !isAllowanced && ( )} {isApproved ? ( diff --git a/src/shared/components/StakingConfirmModal.tsx b/src/shared/components/StakingConfirmModal.tsx index b9d7f16b5..fc2401f95 100644 --- a/src/shared/components/StakingConfirmModal.tsx +++ b/src/shared/components/StakingConfirmModal.tsx @@ -21,6 +21,7 @@ interface Props { subtitle: string; list: { label: string; value: string; subvalue?: string }[]; isApproved: boolean; + isAllowanced: boolean; submitButtonText: string; handler: () => void; isLoading: boolean; @@ -35,6 +36,7 @@ const StakingConfirmModal: React.FC = ({ subtitle, list, isApproved, + isAllowanced, submitButtonText, handler, isLoading, @@ -96,7 +98,7 @@ const StakingConfirmModal: React.FC = ({ backgroundColor: AppColors.WHITE, }}> - {stakingType === StakingType.Stake && ( + {stakingType === StakingType.Stake && !isAllowanced && ( )} {isApproved ? ( From cab18fb6d94199b3cdf8d9a17581ceb435d9b14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EA=B7=9C=EC=B2=A0?= Date: Fri, 22 Oct 2021 16:39:42 +0900 Subject: [PATCH 2/6] Add i18n language --- src/shared/components/ToastMessage.tsx | 37 +++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/shared/components/ToastMessage.tsx b/src/shared/components/ToastMessage.tsx index 365d9988d..319a17732 100644 --- a/src/shared/components/ToastMessage.tsx +++ b/src/shared/components/ToastMessage.tsx @@ -16,7 +16,7 @@ type Props = { const ToastMessage: React.FC = ({ waitingTx, toastHide }) => { const fadeAnim = useRef(new Animated.Value(0)).current; - const { t } = useTranslation(); + const { t, i18n } = useTranslation(); const [isVisible, setIsVisible] = useState(true); const fadeIn = () => { @@ -81,9 +81,11 @@ const ToastMessage: React.FC = ({ waitingTx, toastHide }) => { }) } style={{ - fontSize: 14, + textAlign: 'center', + fontSize: i18n.language === 'en' ? 11 : 14, fontFamily: 'NanumSquareEB', color: AppColors.WHITE, + width: 220, }} /> @@ -96,16 +98,27 @@ const ToastMessage: React.FC = ({ waitingTx, toastHide }) => { height: 20, }} /> - + {i18n.language === 'en' ? ( + + ) : ( + + )} ) : ( <> From 9bd6fb0f9a327e5a7bd5cf304d47cfd549264d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EA=B7=9C=EC=B2=A0?= Date: Fri, 22 Oct 2021 16:40:26 +0900 Subject: [PATCH 3/6] Add isAllowanced --- src/modules/asset/Refund.tsx | 1 + src/modules/staking/Unstake.tsx | 1 + src/modules/staking/UnstakeAndMigrate.tsx | 1 + 3 files changed, 3 insertions(+) diff --git a/src/modules/asset/Refund.tsx b/src/modules/asset/Refund.tsx index 37afc54df..fcd7b1085 100644 --- a/src/modules/asset/Refund.tsx +++ b/src/modules/asset/Refund.tsx @@ -178,6 +178,7 @@ const Refund: FunctionComponent = () => { setValues={setValues} estimatedGas={state.estimateGas} isApproved={true} + isAllowanced={true} isLoading={isLoading} isRefund={PurposeType.Refund} approve={() => ''} diff --git a/src/modules/staking/Unstake.tsx b/src/modules/staking/Unstake.tsx index 73305a7c7..df30f3f1c 100644 --- a/src/modules/staking/Unstake.tsx +++ b/src/modules/staking/Unstake.tsx @@ -217,6 +217,7 @@ const Unstake: React.FC = () => { subtitle={t('staking.confirmation_title')} list={confirmationList} isApproved={true} + isAllowanced={true} submitButtonText={t('staking.nth_unstaking', { round: selectedRound, })} diff --git a/src/modules/staking/UnstakeAndMigrate.tsx b/src/modules/staking/UnstakeAndMigrate.tsx index 300638743..9aa7221af 100644 --- a/src/modules/staking/UnstakeAndMigrate.tsx +++ b/src/modules/staking/UnstakeAndMigrate.tsx @@ -356,6 +356,7 @@ const UnstakeAndMigrate: React.FC = () => { subtitle={t('staking.confirmation_title')} list={confirmationList} isApproved={true} + isAllowanced={true} submitButtonText={t('staking.nth_unstaking', { round: selectedRound, })} From 1dd5f953736214bc10d126765f6e46ff19608d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EA=B7=9C=EC=B2=A0?= Date: Fri, 22 Oct 2021 16:40:47 +0900 Subject: [PATCH 4/6] Add translation --- src/i18n/en.json | 28 +++++++++++++++++++++++++--- src/i18n/ko.json | 2 +- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/i18n/en.json b/src/i18n/en.json index 69325a863..8549a5a4d 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -292,7 +292,18 @@ "transaction": { "pending": "Transaction now in progress.", "fail": "Transaction failed", - "created": "Completed transaction" + "created": "Completed transaction", + "create_transaction": "Transaction has been sent.", + "success_transaction": "{{transferType}} has been completed.", + "purchase_transaction": "{{transferType}} has been completed.", + "failed_withdrawal": "Asset token withdrawal failed.", + "failed_purchase": "Failed to purchase real estate tokens.", + "failed_refund": "Failed to refund real estate tokens.", + "failed_productReward": "Failed to receive interest.", + "failed_stake": "Staking failed.", + "failed_unstake": "Unstaking failed.", + "failed_migrate": "Migration failed.", + "failed_stakingReward": "Failed to receive compensation." }, "main": { "total_assets": "Total assets", @@ -313,7 +324,10 @@ "my_staking": "My staking and rewards", "staking_by_crypto": "{{stakingCrypto}} staking and {{rewardCrypto}} rewards", "staking_amount": "{{round}}$t(ordinal_suffix.{{round}}) round staking", - "reward_amount": "{{round}}$t(ordinal_suffix.{{round}}) round rewards" + "reward_amount": "{{round}}$t(ordinal_suffix.{{round}}) round rewards", + "pending_transaction": "Pending transactions", + "pending_transaction_count": "There is currently {{count}} transaction pending.", + "pending_transaction_counts": "There are currently {{count}} transactions pending." }, "recovery_key": { "keep": "Save your recovery key", @@ -483,6 +497,14 @@ "refund_notice": "Refunds for real estate properties previously purchased through our website may take up to 3 business days and the dedicated account manager will contact you by email." }, "ordinal_suffix": ["", "st", "nd", "rd", "th", "th", "th"], - "datetime_format": "MM.DD.YYYY HH:mm:ss" + "datetime_format": "MM.DD.YYYY HH:mm:ss", + "withdrawal": "Asset token withdrawal", + "purchase": "The real estate token purchase", + "refund": "The real estate token refund", + "productReward": "Interest payment", + "stake": "Staking", + "unstake": "Unstaking", + "migrate": "Migration", + "stakingReward": "Compensation receipt" } } diff --git a/src/i18n/ko.json b/src/i18n/ko.json index bb33ce959..3083fb23e 100644 --- a/src/i18n/ko.json +++ b/src/i18n/ko.json @@ -497,7 +497,7 @@ "refund_notice": "기존 상품의 경우 환불은 3영업일 이내에 완료되며, 담당 팀이 이메일로 연락을 드립니다." }, "datetime_format": "YYYY.MM.DD HH:mm:ss", - "withdrawal": "자산 출금", + "withdrawal": "자산 토큰 출금", "purchase": "부동산 토큰 구매", "refund": "부동산 토큰 환불", "productReward": "이자 출금", From e11475d41e1ca43d8844838a8ef0326cf2521cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EA=B7=9C=EC=B2=A0?= Date: Fri, 22 Oct 2021 16:42:54 +0900 Subject: [PATCH 5/6] Add i18n language --- .../dashboard/components/WaitingTxBox.tsx | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/modules/dashboard/components/WaitingTxBox.tsx b/src/modules/dashboard/components/WaitingTxBox.tsx index cb35158f2..7b474b4b0 100644 --- a/src/modules/dashboard/components/WaitingTxBox.tsx +++ b/src/modules/dashboard/components/WaitingTxBox.tsx @@ -11,7 +11,7 @@ const WaitingTxBox: React.FC<{ isFocused: boolean; }> = ({ isFocused }) => { const navigation = useNavigation(); - const { t } = useTranslation(); + const { t, i18n } = useTranslation(); const { waitingTxs } = useContext(TransactionContext); return ( @@ -47,12 +47,21 @@ const WaitingTxBox: React.FC<{ label={t('main.pending_transaction')} style={{ color: AppColors.SUB_BLACK }} /> - + {waitingTxs.length >= 2 && i18n.language === 'en' ? ( + + ) : ( + + )} )} From f29233ad31a1678338358da293c944e5f5eaf77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EA=B7=9C=EC=B2=A0?= Date: Fri, 22 Oct 2021 16:43:28 +0900 Subject: [PATCH 6/6] Modify translation --- src/i18n/zh-hans.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/zh-hans.json b/src/i18n/zh-hans.json index 6ae1863c1..1a7c3c61a 100644 --- a/src/i18n/zh-hans.json +++ b/src/i18n/zh-hans.json @@ -493,7 +493,7 @@ }, "numeral_character": ["", "一", "二", "三", "四", "五", "六"], "datetime_format": "YYYY.MM.DD HH:mm:ss", - "withdrawal": "资产出金", + "withdrawal": "资产代币出金", "purchase": "购买房地产代币", "refund": "房地产代币退款", "productReward": "利息出金",