mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-21 12:21:31 +03:00
Merge branch 'master' of https://github.com/esteemapp/esteem-mobile into feature/boost-promote
This commit is contained in:
commit
ebb0825832
@ -296,13 +296,15 @@
|
||||
"power_down": "Power Down",
|
||||
"account": "Account",
|
||||
"destination_accounts": "Destination Account(s)",
|
||||
"amount_information": "Drag the sliderto adjust to amount",
|
||||
"amount_information": "Drag the slider to adjust to amount",
|
||||
"save": "Save",
|
||||
"percent": "Percentage",
|
||||
"percent_information": "Percentage of power down to this account",
|
||||
"auto_vests": "Automatically power up to the target account",
|
||||
"stop": "Stop",
|
||||
"stop_information": "Are you sure to stop?",
|
||||
"incoming_funds": "Incoming Funds"
|
||||
"incoming_funds": "Incoming Funds",
|
||||
"sc_power_down_error": "Steem connect setWithdrawVestingRoute not implemented yet.",
|
||||
"estimated_weekly": "Estimated Weekly"
|
||||
}
|
||||
}
|
||||
|
@ -38,12 +38,12 @@
|
||||
"vote": "Szavazás",
|
||||
"reblog": "Megosztás",
|
||||
"login": "Bejelentkezés",
|
||||
"incoming_transfer_title": "Incoming transfer",
|
||||
"outgoing_transfer_title": "Outgoing transfer",
|
||||
"incoming_transfer_title": "Bejövő átutalás",
|
||||
"outgoing_transfer_title": "Kimenő átutalás",
|
||||
"checkin_extra": "Bónusz",
|
||||
"delegation": "Delegation",
|
||||
"delegation_title": "Delegation reward",
|
||||
"delegation_desc": "You can earn 1 point per day for each 100sp delegation",
|
||||
"delegation": "Delegálás",
|
||||
"delegation_title": "Delegálási jutalom",
|
||||
"delegation_desc": "Minen 100sp delegálásért napi 1 pontot kaphatsz",
|
||||
"post_title": "Bejegyzés pontok",
|
||||
"comment_title": "Hozzászólás pontok",
|
||||
"vote_title": "Szavazási pontok",
|
||||
@ -203,12 +203,12 @@
|
||||
"no_internet": "Nincs kapcsolat!",
|
||||
"confirm": "Megerősítés",
|
||||
"removed": "Eltávolítva",
|
||||
"same_user": "This user already added to list"
|
||||
"same_user": "Ez a felhasználó már szerepel a listán"
|
||||
},
|
||||
"post": {
|
||||
"reblog_alert": "Biztos, hogy megosztod?",
|
||||
"removed_hint": "A bejegyzést eltávolította",
|
||||
"copy_link": "Copy Link"
|
||||
"copy_link": "Link másolása"
|
||||
},
|
||||
"drafts": {
|
||||
"title": "Piszkozatok",
|
||||
@ -283,26 +283,26 @@
|
||||
"memo_desc": "Ez az üzenet nyilvános",
|
||||
"to_placeholder": "Felhasználónév",
|
||||
"memo_placeholder": "Megjegyzés ide",
|
||||
"transfer_token": "Transfer",
|
||||
"points": "Points Transfer",
|
||||
"transfer_to_saving": "Transfer To Saving",
|
||||
"transfer_token": "Átutalás",
|
||||
"points": "Pontok Átutalása",
|
||||
"transfer_to_saving": "Átutalás a megtakarításokhoz",
|
||||
"powerUp": "Power Up",
|
||||
"withdraw_to_saving": "Withdraw To Saving",
|
||||
"withdraw_to_saving": "Átutalás A Megtakarításokhoz",
|
||||
"steemconnect_title": "Steemconnect átutalás",
|
||||
"next": "KÖVETKEZŐ",
|
||||
"withdraw_steem": "Withdraw Steem",
|
||||
"withdraw_sbd": "Withdraw Steem Dollar",
|
||||
"delegate": "Delegate",
|
||||
"withdraw_steem": "Steem Visszavonás",
|
||||
"withdraw_sbd": "Steem Dollár Visszavonás",
|
||||
"delegate": "Delegálás",
|
||||
"power_down": "Power Down",
|
||||
"account": "Account",
|
||||
"destination_accounts": "Destination Account(s)",
|
||||
"amount_information": "Drag the sliderto adjust to amount",
|
||||
"save": "Save",
|
||||
"percent": "Percentage",
|
||||
"percent_information": "Percentage of power down to this account",
|
||||
"auto_vests": "Automatically power up to the target account",
|
||||
"stop": "Stop",
|
||||
"stop_information": "Are you sure to stop?",
|
||||
"incoming_funds": "Incoming Funds"
|
||||
"account": "Fiók",
|
||||
"destination_accounts": "Cél Fiók(ok)",
|
||||
"amount_information": "A csúszka húzásával állítsd be a mennyiséget",
|
||||
"save": "Mentés",
|
||||
"percent": "Százalék",
|
||||
"percent_information": "Power Down százaléka ennek a fióknak",
|
||||
"auto_vests": "Automatikus power up a megadott fióknak",
|
||||
"stop": "Megállítás",
|
||||
"stop_information": "Bistos megállítod?",
|
||||
"incoming_funds": "Bejövő tőke"
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@
|
||||
"no_internet": "인터넷 연결을 확인하세요!",
|
||||
"confirm": "확인",
|
||||
"removed": "삭제되었습니다",
|
||||
"same_user": "This user already added to list"
|
||||
"same_user": "이 사용자는 목록에 이미 추가되었습니다"
|
||||
},
|
||||
"post": {
|
||||
"reblog_alert": "정말 리블로그 하시겠습니까?",
|
||||
@ -289,19 +289,19 @@
|
||||
"withdraw_to_saving": "안전 금고로 출금",
|
||||
"steemconnect_title": "Steemconnect 송금",
|
||||
"next": "다음",
|
||||
"withdraw_steem": "Withdraw Steem",
|
||||
"withdraw_sbd": "Withdraw Steem Dollar",
|
||||
"delegate": "Delegate",
|
||||
"power_down": "Power Down",
|
||||
"account": "Account",
|
||||
"destination_accounts": "Destination Account(s)",
|
||||
"amount_information": "Drag the sliderto adjust to amount",
|
||||
"save": "Save",
|
||||
"percent": "Percentage",
|
||||
"percent_information": "Percentage of power down to this account",
|
||||
"auto_vests": "Automatically power up to the target account",
|
||||
"stop": "Stop",
|
||||
"stop_information": "Are you sure to stop?",
|
||||
"incoming_funds": "Incoming Funds"
|
||||
"withdraw_steem": "스팀 출금",
|
||||
"withdraw_sbd": "스팀 달러 출금",
|
||||
"delegate": "임대",
|
||||
"power_down": "파워 다운",
|
||||
"account": "계정",
|
||||
"destination_accounts": "대상 계정",
|
||||
"amount_information": "슬라이드를 드래그해서 수량을 설정할 수 있습니다",
|
||||
"save": "저장",
|
||||
"percent": "비율",
|
||||
"percent_information": "이 계정에 대한 파워 다운 비율",
|
||||
"auto_vests": "대상 계정에 자동으로 파워 업 하기",
|
||||
"stop": "중지",
|
||||
"stop_information": "중지하시겠습니까?",
|
||||
"incoming_funds": "입금 예정 스팀"
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@
|
||||
"no_internet": "Sem ligação!",
|
||||
"confirm": "Confirmar",
|
||||
"removed": "Removido",
|
||||
"same_user": "This user already added to list"
|
||||
"same_user": "Este usuário já foi adicionado à lista"
|
||||
},
|
||||
"post": {
|
||||
"reblog_alert": "Tem certeza de que deseja reblogar?",
|
||||
@ -290,19 +290,19 @@
|
||||
"withdraw_to_saving": "Levantar das poupanças",
|
||||
"steemconnect_title": "Transferência por Steemconnect",
|
||||
"next": "SEGUINTE",
|
||||
"withdraw_steem": "Withdraw Steem",
|
||||
"withdraw_sbd": "Withdraw Steem Dollar",
|
||||
"delegate": "Delegate",
|
||||
"power_down": "Power Down",
|
||||
"account": "Account",
|
||||
"destination_accounts": "Destination Account(s)",
|
||||
"amount_information": "Drag the sliderto adjust to amount",
|
||||
"save": "Save",
|
||||
"percent": "Percentage",
|
||||
"percent_information": "Percentage of power down to this account",
|
||||
"auto_vests": "Automatically power up to the target account",
|
||||
"stop": "Stop",
|
||||
"stop_information": "Are you sure to stop?",
|
||||
"incoming_funds": "Incoming Funds"
|
||||
"withdraw_steem": "Levantar Steem",
|
||||
"withdraw_sbd": "Levantar Steem Dólar",
|
||||
"delegate": "Delegar",
|
||||
"power_down": "Decarregar Poder",
|
||||
"account": "Conta",
|
||||
"destination_accounts": "Conta(s) de destino",
|
||||
"amount_information": "Arraste o controle deslizante para ajustar a quantidade",
|
||||
"save": "Guardar",
|
||||
"percent": "Percentagem",
|
||||
"percent_information": "Percentagem de Descarga de Poder para esta conta",
|
||||
"auto_vests": "Carregar Poder automaticamente para a conta alvo",
|
||||
"stop": "Parar",
|
||||
"stop_information": "Tem certeza que deseja parar?",
|
||||
"incoming_funds": "Fundos recebidos"
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@
|
||||
"no_internet": "Nu există conexiune!",
|
||||
"confirm": "Confirmă",
|
||||
"removed": "Şters",
|
||||
"same_user": "This user already added to list"
|
||||
"same_user": "Utilizator adăugat deja la listă"
|
||||
},
|
||||
"post": {
|
||||
"reblog_alert": "Ești sigur că vrei să redistribui?",
|
||||
@ -284,25 +284,25 @@
|
||||
"to_placeholder": "Nume de utilizator",
|
||||
"memo_placeholder": "Introdu comentariul tău aici",
|
||||
"transfer_token": "Transfer",
|
||||
"points": "Points Transfer",
|
||||
"points": "Transfer Puncte",
|
||||
"transfer_to_saving": "Tranferă la economii",
|
||||
"powerUp": "Power Up",
|
||||
"withdraw_to_saving": "Retrage la economii",
|
||||
"steemconnect_title": "Transfer Steemconnect",
|
||||
"next": "URMĂTORUL",
|
||||
"withdraw_steem": "Withdraw Steem",
|
||||
"withdraw_sbd": "Withdraw Steem Dollar",
|
||||
"delegate": "Delegate",
|
||||
"withdraw_steem": "Retrage Steem",
|
||||
"withdraw_sbd": "Retrage Steem Dolar",
|
||||
"delegate": "Delegare",
|
||||
"power_down": "Power Down",
|
||||
"account": "Account",
|
||||
"destination_accounts": "Destination Account(s)",
|
||||
"amount_information": "Drag the sliderto adjust to amount",
|
||||
"save": "Save",
|
||||
"percent": "Percentage",
|
||||
"percent_information": "Percentage of power down to this account",
|
||||
"auto_vests": "Automatically power up to the target account",
|
||||
"stop": "Stop",
|
||||
"stop_information": "Are you sure to stop?",
|
||||
"incoming_funds": "Incoming Funds"
|
||||
"account": "Cont",
|
||||
"destination_accounts": "Cont(uri) de Destinație",
|
||||
"amount_information": "Trage glisorul pentru a ajusta cantitatea",
|
||||
"save": "Salvează",
|
||||
"percent": "Procentaj",
|
||||
"percent_information": "Procentul de power down la acest cont",
|
||||
"auto_vests": "Power up automat contul ţintă",
|
||||
"stop": "Oprește",
|
||||
"stop_information": "Ești sigur că vrei să te oprești?",
|
||||
"incoming_funds": "Fondurile Primite"
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
"comingsoon": "Доска Лидерства будет здесь!",
|
||||
"notification": "Уведомления",
|
||||
"leaderboard": "Лидеры",
|
||||
"epoint": "Очки",
|
||||
"epoint": "Баллы",
|
||||
"leaderboard_title": "Доска Лидерства",
|
||||
"recent": "Недавно",
|
||||
"yesterday": "Вчера",
|
||||
@ -38,29 +38,29 @@
|
||||
"vote": "Голос",
|
||||
"reblog": "Репост",
|
||||
"login": "Логин",
|
||||
"incoming_transfer_title": "Incoming transfer",
|
||||
"outgoing_transfer_title": "Outgoing transfer",
|
||||
"incoming_transfer_title": "Входящий перевод",
|
||||
"outgoing_transfer_title": "Исходящий перевод",
|
||||
"checkin_extra": "Бонус",
|
||||
"delegation": "Delegation",
|
||||
"delegation_title": "Delegation reward",
|
||||
"delegation_desc": "You can earn 1 point per day for each 100sp delegation",
|
||||
"post_title": "Очки за пост",
|
||||
"comment_title": "Очки за комментарий",
|
||||
"vote_title": "Очки за голос",
|
||||
"reblog_title": "Очки за репост",
|
||||
"login_title": "Очки за логин",
|
||||
"checkin_title": "Очки за пользование",
|
||||
"delegation": "Делегирование",
|
||||
"delegation_title": "Награда за делегирование",
|
||||
"delegation_desc": "За каждые делегированные 100SP вы будете получать 1 балл в день",
|
||||
"post_title": "Баллы за пост",
|
||||
"comment_title": "Баллы за комментарий",
|
||||
"vote_title": "Баллы за голос",
|
||||
"reblog_title": "Баллы за репост",
|
||||
"login_title": "Баллы за логин",
|
||||
"checkin_title": "Баллы за пользование",
|
||||
"checkin_extra_title": "Бонус за использование",
|
||||
"no_activity": "Здесь пусто!",
|
||||
"outgoing_transfer_description": "",
|
||||
"incoming_transfer_description": "",
|
||||
"post_desc": "Зарабатывай очки за посты. По 15 очков за каждый.",
|
||||
"comment_desc": "Каждый коммент помогает набирать аудиторию, завязывает дружбу и приносит 5 очков.",
|
||||
"checkin_desc": "Чекин в приложении eSteem даёт 0.25 очков и помогает оставаться на связи с друзьями.",
|
||||
"vote_desc": "Голосуя вы награждаете других и высказываете своё уважение, а также получаете процент очков в зависимости от силы голоса.",
|
||||
"reblog_desc": "Делитесь постами с друзьями и получайте по 1 очку.",
|
||||
"login_desc": "Когда вы логинитесь в приложения eSteem, вы автоматически получаете 100 очков.",
|
||||
"checkin_extra_desc": "Постоянное использование приложения даёт вам дополнительный шанс получить 10 очков. Чем больше активности, тем больше очков."
|
||||
"post_desc": "Зарабатывай баллы за посты. По 15 баллов за каждый.",
|
||||
"comment_desc": "Каждый коммент помогает набирать аудиторию, завязывает дружбу и приносит 5 баллов.",
|
||||
"checkin_desc": "Чекин в приложении eSteem даёт 0.25 баллов и помогает оставаться на связи с друзьями.",
|
||||
"vote_desc": "Голосуя вы награждаете других и высказываете своё уважение, а также получаете процент баллов в зависимости от силы голоса.",
|
||||
"reblog_desc": "Делитесь постами с друзьями и получайте по 1 баллу.",
|
||||
"login_desc": "Когда вы логинитесь в приложения eSteem, вы автоматически получаете 100 баллов.",
|
||||
"checkin_extra_desc": "Постоянное использование приложения даёт вам дополнительный шанс получить 10 баллов. Чем больше активности, тем больше награда."
|
||||
},
|
||||
"messages": {
|
||||
"comingsoon": "Здесь будут сообщения!"
|
||||
@ -203,12 +203,12 @@
|
||||
"no_internet": "No internet connection",
|
||||
"confirm": "Подтвердить",
|
||||
"removed": "Удалено",
|
||||
"same_user": "This user already added to list"
|
||||
"same_user": "Этот пользователь уже добавлен в список"
|
||||
},
|
||||
"post": {
|
||||
"reblog_alert": "Вы уверены, что хотите сделать репост?",
|
||||
"removed_hint": "Сообщение удалено",
|
||||
"copy_link": "Copy Link"
|
||||
"copy_link": "Копировать ссылку"
|
||||
},
|
||||
"drafts": {
|
||||
"title": "Черновики",
|
||||
@ -283,26 +283,26 @@
|
||||
"memo_desc": "Эта заметка публична",
|
||||
"to_placeholder": "Пользователь",
|
||||
"memo_placeholder": "Введите свою заметку",
|
||||
"transfer_token": "Transfer",
|
||||
"points": "Points Transfer",
|
||||
"transfer_to_saving": "Transfer To Saving",
|
||||
"transfer_token": "Перевод",
|
||||
"points": "Передача баллов",
|
||||
"transfer_to_saving": "Перевести в сейф",
|
||||
"powerUp": "Увеличение силы",
|
||||
"withdraw_to_saving": "Withdraw To Saving",
|
||||
"withdraw_to_saving": "Снять в сейф",
|
||||
"steemconnect_title": "Перевод Steemconnect",
|
||||
"next": "ДАЛЕЕ",
|
||||
"withdraw_steem": "Withdraw Steem",
|
||||
"withdraw_sbd": "Withdraw Steem Dollar",
|
||||
"delegate": "Delegate",
|
||||
"power_down": "Power Down",
|
||||
"account": "Account",
|
||||
"destination_accounts": "Destination Account(s)",
|
||||
"amount_information": "Drag the sliderto adjust to amount",
|
||||
"save": "Save",
|
||||
"percent": "Percentage",
|
||||
"percent_information": "Percentage of power down to this account",
|
||||
"auto_vests": "Automatically power up to the target account",
|
||||
"stop": "Stop",
|
||||
"stop_information": "Are you sure to stop?",
|
||||
"incoming_funds": "Incoming Funds"
|
||||
"withdraw_steem": "Вывести Steem",
|
||||
"withdraw_sbd": "Вывести Steem Dollar",
|
||||
"delegate": "Делегировать",
|
||||
"power_down": "Понижение Силы",
|
||||
"account": "Aккаунт",
|
||||
"destination_accounts": "Аккаунт(ы) получателя",
|
||||
"amount_information": "Потяните ползунок для регулировки количества",
|
||||
"save": "Сохранить",
|
||||
"percent": "Проценты",
|
||||
"percent_information": "Процент понижения Силы в этот аккаунт",
|
||||
"auto_vests": "Автоматически переводить в Силу на целевой аккаунт",
|
||||
"stop": "Остановить",
|
||||
"stop_information": "Вы уверены, что хотите остановить?",
|
||||
"incoming_funds": "Входящие средства"
|
||||
}
|
||||
}
|
||||
|
@ -692,7 +692,7 @@ export const delegateVestingShares = (currentAccount, pin, data) => {
|
||||
'delegate_vesting_shares',
|
||||
{
|
||||
delegator: data.from,
|
||||
delegatee: data.to,
|
||||
delegatee: data.destination,
|
||||
vesting_shares: data.amount,
|
||||
},
|
||||
],
|
||||
|
@ -1,48 +1,18 @@
|
||||
import React, { PureComponent, Fragment } from 'react';
|
||||
import { View, Text } from 'react-native';
|
||||
|
||||
// Constants
|
||||
|
||||
// Components
|
||||
|
||||
import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
import { Logo } from '../../../components';
|
||||
|
||||
// import styles from './launchStyles';
|
||||
|
||||
class LaunchScreen extends PureComponent {
|
||||
/* Props
|
||||
* ------------------------------------------------
|
||||
* @prop { type } name - Description....
|
||||
*/
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
// Component Life Cycles
|
||||
|
||||
// Component Functions
|
||||
|
||||
render() {
|
||||
return <Fragment />;
|
||||
|
||||
// Temporarily removed
|
||||
// return (
|
||||
// <View
|
||||
// style={{
|
||||
// flex: 1,
|
||||
// justifyContent: 'center',
|
||||
// alignItems: 'center',
|
||||
// marginBottom: 130,
|
||||
// }}
|
||||
// >
|
||||
// <Logo style={{ width: 130, height: 130 }} />
|
||||
// {/* <Text style={{ fontSize: 24 }}>eSteem</Text>
|
||||
// <Text style={{ fontSize: 24 }}>mobile</Text> */}
|
||||
// </View>
|
||||
// );
|
||||
}
|
||||
}
|
||||
const LaunchScreen = () => (
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
marginBottom: 80,
|
||||
}}
|
||||
>
|
||||
<Logo style={{ width: 105, height: 110 }} />
|
||||
</View>
|
||||
);
|
||||
|
||||
export default LaunchScreen;
|
||||
|
@ -1,25 +0,0 @@
|
||||
import EStyleSheet from 'react-native-extended-stylesheet';
|
||||
|
||||
export default EStyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
backgroundColor: 'red',
|
||||
},
|
||||
title: {
|
||||
fontFamily: 'Sansation_Bold',
|
||||
color: '$primaryDarkBlue',
|
||||
fontSize: 30,
|
||||
paddingBottom: 0,
|
||||
},
|
||||
subTitle: {
|
||||
fontFamily: 'Sansation_Regular',
|
||||
color: '#00519c',
|
||||
fontSize: 24,
|
||||
},
|
||||
logo: {
|
||||
width: '$deviceWidth / 4',
|
||||
height: '$deviceWidth / 4',
|
||||
},
|
||||
});
|
@ -134,6 +134,8 @@ class TransferContainer extends Component {
|
||||
break;
|
||||
case 'delegate':
|
||||
func = delegateVestingShares;
|
||||
currentAccount = selectedAccount;
|
||||
data.amount = `${amount.toFixed(6)} VESTS`;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -4,6 +4,7 @@ import TransferContainer from './container/transferContainer';
|
||||
|
||||
import TransferView from './screen/transferScreen';
|
||||
import PowerDownView from './screen/powerDownScreen';
|
||||
import DelegateView from './screen/delegateScreen';
|
||||
|
||||
const Transfer = ({ navigation }) => (
|
||||
<TransferContainer navigation={navigation}>
|
||||
@ -44,7 +45,19 @@ const Transfer = ({ navigation }) => (
|
||||
/>
|
||||
);
|
||||
case 'delegate':
|
||||
return null;
|
||||
return (
|
||||
<DelegateView
|
||||
accounts={accounts}
|
||||
currentAccountName={currentAccountName}
|
||||
selectedAccount={selectedAccount}
|
||||
getAccountsWithUsername={getAccountsWithUsername}
|
||||
balance={balance}
|
||||
fetchBalance={fetchBalance}
|
||||
transferToAccount={transferToAccount}
|
||||
accountType={accountType}
|
||||
handleOnModalClose={handleOnModalClose}
|
||||
/>
|
||||
);
|
||||
case 'power_down':
|
||||
return (
|
||||
<PowerDownView
|
||||
|
232
src/screens/transfer/screen/delegateScreen.js
Normal file
232
src/screens/transfer/screen/delegateScreen.js
Normal file
@ -0,0 +1,232 @@
|
||||
import React, { Component, Fragment } from 'react';
|
||||
import { View, Text, WebView } from 'react-native';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import Slider from 'react-native-slider';
|
||||
import get from 'lodash/get';
|
||||
import ActionSheet from 'react-native-actionsheet';
|
||||
|
||||
// Constants
|
||||
import AUTH_TYPE from '../../../constants/authType';
|
||||
import { steemConnectOptions } from '../../../constants/steemConnectOptions';
|
||||
|
||||
// Components
|
||||
import { BasicHeader } from '../../../components/basicHeader';
|
||||
import { TransferFormItem } from '../../../components/transferFormItem';
|
||||
import { DropdownButton } from '../../../components/dropdownButton';
|
||||
import { TextInput } from '../../../components/textInput';
|
||||
import { MainButton } from '../../../components/mainButton';
|
||||
import { UserAvatar } from '../../../components/userAvatar';
|
||||
import { Icon } from '../../../components/icon';
|
||||
import { Modal } from '../../../components/modal';
|
||||
|
||||
import parseToken from '../../../utils/parseToken';
|
||||
import { isEmptyDate } from '../../../utils/time';
|
||||
|
||||
// Styles
|
||||
import styles from './transferStyles';
|
||||
|
||||
class DelegateScreen extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
amount: 0,
|
||||
isTransfering: false,
|
||||
from: props.currentAccountName,
|
||||
destination: '',
|
||||
steemConnectTransfer: false,
|
||||
};
|
||||
|
||||
this.startActionSheet = React.createRef();
|
||||
}
|
||||
|
||||
// Component Life Cycles
|
||||
|
||||
// Component Functions
|
||||
_setState = (key, value) => {
|
||||
const { getAccountsWithUsername, balance } = this.props;
|
||||
|
||||
if (key) {
|
||||
switch (key) {
|
||||
case 'destination':
|
||||
getAccountsWithUsername(value).then(res => {
|
||||
const isValid = res.includes(value);
|
||||
|
||||
this.setState({ isUsernameValid: isValid });
|
||||
});
|
||||
this.setState({ [key]: value });
|
||||
break;
|
||||
case 'amount':
|
||||
if (parseFloat(Number(value)) <= parseFloat(balance)) {
|
||||
this.setState({ [key]: value });
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
this.setState({ [key]: value });
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_handleTransferAction = () => {
|
||||
const { transferToAccount, accountType } = this.props;
|
||||
const { from, destination, amount } = this.state;
|
||||
|
||||
this.setState({ isTransfering: true });
|
||||
|
||||
if (accountType === AUTH_TYPE.STEEM_CONNECT) {
|
||||
this.setState({ steemConnectTransfer: true });
|
||||
} else {
|
||||
transferToAccount(from, destination, amount, '');
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnAmountChange = (state, amount) => {
|
||||
let _amount = amount.toString();
|
||||
if (_amount.includes(',')) {
|
||||
_amount = amount.replace(',', '.');
|
||||
}
|
||||
|
||||
this._setState(state, _amount);
|
||||
};
|
||||
|
||||
_handleOnDropdownChange = value => {
|
||||
const { fetchBalance } = this.props;
|
||||
|
||||
fetchBalance(value);
|
||||
this.setState({ from: value, amount: 0 });
|
||||
};
|
||||
|
||||
_renderDropdown = (accounts, currentAccountName) => (
|
||||
<DropdownButton
|
||||
dropdownButtonStyle={styles.dropdownButtonStyle}
|
||||
rowTextStyle={styles.rowTextStyle}
|
||||
style={styles.dropdown}
|
||||
dropdownStyle={styles.dropdownStyle}
|
||||
textStyle={styles.dropdownText}
|
||||
options={accounts.map(item => item.username)}
|
||||
defaultText={currentAccountName}
|
||||
selectedOptionIndex={accounts.findIndex(item => item.username === currentAccountName)}
|
||||
onSelect={(index, value) => this._handleOnDropdownChange(value)}
|
||||
/>
|
||||
);
|
||||
|
||||
_renderInput = (placeholder, state, keyboardType, isTextArea) => (
|
||||
<TextInput
|
||||
style={[isTextArea ? styles.textarea : styles.input]}
|
||||
onChangeText={amount => this._handleOnAmountChange(state, amount)}
|
||||
value={this.state[state]}
|
||||
placeholder={placeholder}
|
||||
placeholderTextColor="#c1c5c7"
|
||||
autoCapitalize="none"
|
||||
multiline={isTextArea}
|
||||
numberOfLines={isTextArea ? 4 : 1}
|
||||
keyboardType={keyboardType}
|
||||
/>
|
||||
);
|
||||
|
||||
_renderInformationText = text => <Text style={styles.amountText}>{text}</Text>;
|
||||
|
||||
render() {
|
||||
const { intl, accounts, currentAccountName, selectedAccount, handleOnModalClose } = this.props;
|
||||
const { amount, isTransfering, from, destination, steemConnectTransfer } = this.state;
|
||||
let availableVestingShares = 0;
|
||||
|
||||
if (!isEmptyDate(get(selectedAccount, 'next_vesting_withdrawal'))) {
|
||||
// powering down
|
||||
availableVestingShares =
|
||||
parseToken(get(selectedAccount, 'vesting_shares')) -
|
||||
(Number(get(selectedAccount, 'to_withdraw')) - Number(get(selectedAccount, 'withdrawn'))) /
|
||||
1e6 -
|
||||
parseToken(get(selectedAccount, 'delegated_vesting_shares'));
|
||||
} else {
|
||||
// not powering down
|
||||
availableVestingShares =
|
||||
parseToken(get(selectedAccount, 'vesting_shares')) -
|
||||
parseToken(get(selectedAccount, 'delegated_vesting_shares'));
|
||||
}
|
||||
const fixedAmount = `${amount.toFixed(6)} VESTS`;
|
||||
const path = `sign/delegate-vesting-shares?delegator=${from}&delegatee=${destination}&vesting_shares=${encodeURIComponent(
|
||||
fixedAmount,
|
||||
)}`;
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<BasicHeader title={intl.formatMessage({ id: 'transfer.delegate' })} />
|
||||
<View style={styles.container}>
|
||||
<View style={styles.topContent}>
|
||||
<UserAvatar username={from} size="xl" style={styles.userAvatar} noAction />
|
||||
<Icon style={styles.icon} name="arrow-forward" iconType="MaterialIcons" />
|
||||
<UserAvatar username={destination} size="xl" style={styles.userAvatar} noAction />
|
||||
</View>
|
||||
<View style={styles.middleContent}>
|
||||
<TransferFormItem
|
||||
label={intl.formatMessage({ id: 'transfer.account' })}
|
||||
rightComponent={() => this._renderDropdown(accounts, currentAccountName)}
|
||||
/>
|
||||
<TransferFormItem
|
||||
label={intl.formatMessage({ id: 'transfer.to' })}
|
||||
rightComponent={() =>
|
||||
this._renderInput(
|
||||
intl.formatMessage({ id: 'transfer.to_placeholder' }),
|
||||
'destination',
|
||||
'default',
|
||||
)
|
||||
}
|
||||
/>
|
||||
<TransferFormItem
|
||||
label={intl.formatMessage({ id: 'transfer.amount' })}
|
||||
rightComponent={() => this._renderInformationText(`${amount.toFixed(6)} VESTS`)}
|
||||
/>
|
||||
<Slider
|
||||
style={styles.slider}
|
||||
trackStyle={styles.track}
|
||||
thumbStyle={styles.thumb}
|
||||
minimumTrackTintColor="#357ce6"
|
||||
thumbTintColor="#007ee5"
|
||||
maximumValue={availableVestingShares}
|
||||
value={amount}
|
||||
onValueChange={value => {
|
||||
this.setState({ amount: value });
|
||||
}}
|
||||
/>
|
||||
<Text style={styles.informationText}>
|
||||
{intl.formatMessage({ id: 'transfer.amount_information' })}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.bottomContent}>
|
||||
<MainButton
|
||||
style={styles.button}
|
||||
onPress={() => this.startActionSheet.current.show()}
|
||||
isLoading={isTransfering}
|
||||
>
|
||||
<Text style={styles.buttonText}>{intl.formatMessage({ id: 'transfer.next' })}</Text>
|
||||
</MainButton>
|
||||
</View>
|
||||
</View>
|
||||
<ActionSheet
|
||||
ref={this.startActionSheet}
|
||||
options={[
|
||||
intl.formatMessage({ id: 'alert.confirm' }),
|
||||
intl.formatMessage({ id: 'alert.cancel' }),
|
||||
]}
|
||||
title={intl.formatMessage({ id: 'transfer.information' })}
|
||||
cancelButtonIndex={1}
|
||||
destructiveButtonIndex={0}
|
||||
onPress={index => (index === 0 ? this._handleTransferAction() : null)}
|
||||
/>
|
||||
<Modal
|
||||
isOpen={steemConnectTransfer}
|
||||
isFullScreen
|
||||
isCloseButton
|
||||
handleOnModalClose={handleOnModalClose}
|
||||
title={intl.formatMessage({ id: 'transfer.steemconnect_title' })}
|
||||
>
|
||||
<WebView source={{ uri: `${steemConnectOptions.base_url}${path}` }} />
|
||||
</Modal>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default injectIntl(DelegateScreen);
|
@ -1,12 +1,11 @@
|
||||
import React, { Fragment, Component } from 'react';
|
||||
import { Text, View, WebView, ScrollView, Alert } from 'react-native';
|
||||
import { Text, View, ScrollView, Alert } from 'react-native';
|
||||
import ActionSheet from 'react-native-actionsheet';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import Slider from 'react-native-slider';
|
||||
import get from 'lodash/get';
|
||||
|
||||
import { getWithdrawRoutes } from '../../../providers/steem/dsteem';
|
||||
import { steemConnectOptions } from '../../../constants/steemConnectOptions';
|
||||
import AUTH_TYPE from '../../../constants/authType';
|
||||
|
||||
import { BasicHeader } from '../../../components/basicHeader';
|
||||
@ -75,13 +74,16 @@ class PowerDownView extends Component {
|
||||
};
|
||||
|
||||
_handleTransferAction = () => {
|
||||
const { transferToAccount, accountType } = this.props;
|
||||
const { transferToAccount, accountType, intl } = this.props;
|
||||
const { from, destinationAccounts, amount } = this.state;
|
||||
|
||||
this.setState({ isTransfering: true });
|
||||
|
||||
if (accountType === AUTH_TYPE.STEEM_CONNECT) {
|
||||
this.setState({ steemConnectTransfer: true });
|
||||
Alert.alert(
|
||||
intl.formatMessage({ id: 'alert.warning' }),
|
||||
intl.formatMessage({ id: 'transfer.sc_power_down_error' }),
|
||||
);
|
||||
} else {
|
||||
transferToAccount(from, destinationAccounts, amount, '');
|
||||
}
|
||||
@ -190,14 +192,12 @@ class PowerDownView extends Component {
|
||||
accounts,
|
||||
selectedAccount,
|
||||
intl,
|
||||
handleOnModalClose,
|
||||
getAccountsWithUsername,
|
||||
transferType,
|
||||
currentAccountName,
|
||||
steemPerMVests,
|
||||
} = this.props;
|
||||
const { amount, steemConnectTransfer, isTransfering, isOpenWithdrawAccount } = this.state;
|
||||
let path;
|
||||
const { amount, isTransfering, isOpenWithdrawAccount } = this.state;
|
||||
let poweringDownVests = 0;
|
||||
let availableVestingShares = 0;
|
||||
|
||||
@ -293,6 +293,9 @@ class PowerDownView extends Component {
|
||||
style={styles.steemInformation}
|
||||
text={`+ ${fundPerWeek.toFixed(3)} STEEM`}
|
||||
/>
|
||||
<Text style={styles.informationText}>
|
||||
{intl.formatMessage({ id: 'transfer.estimated_weekly' })}
|
||||
</Text>
|
||||
<MainButton
|
||||
style={styles.button}
|
||||
isDisable={amount <= 0}
|
||||
@ -355,15 +358,6 @@ class PowerDownView extends Component {
|
||||
handleOnSubmit={this._handleOnSubmit}
|
||||
/>
|
||||
</Modal>
|
||||
<Modal
|
||||
isOpen={steemConnectTransfer}
|
||||
isFullScreen
|
||||
isCloseButton
|
||||
handleOnModalClose={handleOnModalClose}
|
||||
title={intl.formatMessage({ id: 'transfer.steemconnect_title' })}
|
||||
>
|
||||
<WebView source={{ uri: `${steemConnectOptions.base_url}${path}` }} />
|
||||
</Modal>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ export default EStyleSheet.create({
|
||||
marginTop: 30,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
stopButton: {
|
||||
width: '$deviceWidth / 3',
|
||||
@ -53,6 +54,7 @@ export default EStyleSheet.create({
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
backgroundColor: 'red',
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
buttonText: {
|
||||
color: 'white',
|
||||
@ -107,11 +109,10 @@ export default EStyleSheet.create({
|
||||
elevation: 3,
|
||||
},
|
||||
slider: {
|
||||
flex: 1,
|
||||
marginHorizontal: 30,
|
||||
},
|
||||
formButton: {
|
||||
padding: 7,
|
||||
padding: 12,
|
||||
borderRadius: 5,
|
||||
backgroundColor: '$primaryBlue',
|
||||
marginTop: 5,
|
||||
@ -126,7 +127,7 @@ export default EStyleSheet.create({
|
||||
informationText: {
|
||||
alignSelf: 'center',
|
||||
color: '$iconColor',
|
||||
marginLeft: 5,
|
||||
margin: 10,
|
||||
},
|
||||
spInformation: {
|
||||
backgroundColor: 'red',
|
||||
|
Loading…
Reference in New Issue
Block a user