mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-30 00:52:42 +03:00
wip
This commit is contained in:
parent
1f97f99518
commit
99222cadbd
@ -105,6 +105,7 @@ export const SET_OWN_PROFILE_TABS = 'SET_OWN_PROFILE_TABS';
|
||||
export const SET_BENEFICIARIES = 'SET_BENEFICIARIES';
|
||||
export const REMOVE_BENEFICIARIES = 'REMOVE_BENEFICIARIES';
|
||||
export const TEMP_BENEFICIARIES_ID = 'temp-beneficiaries';
|
||||
export const POWER_DOWN_BENEFICIARIES_ID = 'power-down-beneficiaries';
|
||||
|
||||
//CACHE
|
||||
export const PURGE_EXPIRED_CACHE = 'PURGE_EXPIRED_CACHE';
|
||||
|
@ -10,15 +10,16 @@ import { useAppDispatch, useAppSelector } from '../../../hooks';
|
||||
import { BeneficiaryModal, FormInput, IconButton, TextButton } from '../../../components';
|
||||
import { Beneficiary } from '../../../redux/reducers/editorReducer';
|
||||
import { lookupAccounts } from '../../../providers/hive/dhive';
|
||||
import { TEMP_BENEFICIARIES_ID } from '../../../redux/constants/constants';
|
||||
import { TEMP_BENEFICIARIES_ID, POWER_DOWN_BENEFICIARIES_ID } from '../../../redux/constants/constants';
|
||||
import { removeBeneficiaries, setBeneficiaries as setBeneficiariesAction } from '../../../redux/actions/editorActions';
|
||||
|
||||
interface BeneficiarySelectionContent {
|
||||
draftId:string;
|
||||
setDisableDone:(value:boolean)=>void;
|
||||
powerDown?: boolean;
|
||||
}
|
||||
|
||||
const BeneficiarySelectionContent = ({ draftId, setDisableDone }) => {
|
||||
const BeneficiarySelectionContent = ({ draftId, setDisableDone, powerDown }) => {
|
||||
const intl = useIntl();
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
@ -35,6 +36,12 @@ const BeneficiarySelectionContent = ({ draftId, setDisableDone }) => {
|
||||
const [isWeightValid, setIsWeightValid] = useState(false);
|
||||
const [newEditable, setNewEditable] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if(powerDown){
|
||||
readTempBeneficiaries();
|
||||
}
|
||||
},[]);
|
||||
|
||||
useEffect(() => {
|
||||
readTempBeneficiaries();
|
||||
}, [draftId]);
|
||||
@ -46,7 +53,7 @@ const BeneficiarySelectionContent = ({ draftId, setDisableDone }) => {
|
||||
|
||||
const readTempBeneficiaries = async () => {
|
||||
if(beneficiariesMap){
|
||||
const tempBeneficiaries = beneficiariesMap[draftId || TEMP_BENEFICIARIES_ID];
|
||||
const tempBeneficiaries = beneficiariesMap[powerDown ? POWER_DOWN_BENEFICIARIES_ID : draftId || TEMP_BENEFICIARIES_ID];
|
||||
|
||||
if (isArray(tempBeneficiaries) && tempBeneficiaries.length > 0) {
|
||||
|
||||
@ -66,7 +73,7 @@ const BeneficiarySelectionContent = ({ draftId, setDisableDone }) => {
|
||||
|
||||
|
||||
const _saveBeneficiaries = (value:Beneficiary[]) => {
|
||||
dispatch(setBeneficiariesAction(draftId || TEMP_BENEFICIARIES_ID, value));
|
||||
dispatch(setBeneficiariesAction(powerDown ? POWER_DOWN_BENEFICIARIES_ID : draftId || TEMP_BENEFICIARIES_ID, value));
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@ import { isEmptyDate } from '../../../utils/time';
|
||||
|
||||
import styles from './transferStyles';
|
||||
import { OptionsModal } from '../../../components/atoms';
|
||||
import BeneficiarySelectionContent from '../../editor/children/beneficiarySelectionContent';
|
||||
/* Props
|
||||
* ------------------------------------------------
|
||||
* @prop { type } name - Description....
|
||||
@ -43,6 +44,7 @@ class PowerDownView extends Component {
|
||||
isTransfering: false,
|
||||
isOpenWithdrawAccount: false,
|
||||
destinationAccounts: [],
|
||||
disableDone: false,
|
||||
};
|
||||
|
||||
this.startActionSheet = React.createRef();
|
||||
@ -155,6 +157,13 @@ class PowerDownView extends Component {
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
_renderBeneficiarySelectionContent = () => (
|
||||
<BeneficiarySelectionContent setDisableDone={this._handleSetDisableDone} powerDown={true} />
|
||||
);
|
||||
|
||||
_handleSetDisableDone = (value) => {
|
||||
this.setState({ disableDone: value });
|
||||
};
|
||||
_handleOnDropdownChange = (value) => {
|
||||
const { fetchBalance } = this.props;
|
||||
|
||||
@ -228,6 +237,7 @@ class PowerDownView extends Component {
|
||||
<BasicHeader title={intl.formatMessage({ id: `transfer.${transferType}` })} />
|
||||
<View style={styles.container}>
|
||||
<ScrollView>
|
||||
{this._renderBeneficiarySelectionContent()}
|
||||
<View style={styles.middleContent}>
|
||||
<TransferFormItem
|
||||
label={intl.formatMessage({ id: 'transfer.from' })}
|
||||
|
Loading…
Reference in New Issue
Block a user