From 53bc97eddbe60fed0703b12497940aeafdaacd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20M=C3=B3rawski?= Date: Fri, 21 Jul 2023 18:58:22 +0300 Subject: [PATCH 01/19] ui and first data flow attemps merchant and date value are taken from the "iou" key-value pair. Clearing this up with Alex. --- .../MoneyRequestConfirmationList.js | 53 +++- src/components/MoneyRequestDetails.js | 28 +- src/languages/en.js | 120 ++++---- src/languages/es.js | 118 ++++---- src/libs/actions/IOU.js | 285 ++++++++++-------- .../iou/steps/MoneyRequestConfirmPage.js | 21 +- 6 files changed, 355 insertions(+), 270 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index b376e02b1095..37e83692f658 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -1,25 +1,28 @@ -import React, {useState, useCallback, useMemo} from 'react'; +import React, { useCallback, useMemo, useReducer, useState } from 'react'; import PropTypes from 'prop-types'; -import {withOnyx} from 'react-native-onyx'; +import { withOnyx } from 'react-native-onyx'; import _ from 'underscore'; +import { View } from 'react-native'; import styles from '../styles/styles'; import * as OptionsListUtils from '../libs/OptionsListUtils'; import OptionsSelector from './OptionsSelector'; import ONYXKEYS from '../ONYXKEYS'; -import withLocalize, {withLocalizePropTypes} from './withLocalize'; -import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions'; +import withLocalize, { withLocalizePropTypes } from './withLocalize'; +import withWindowDimensions, { windowDimensionsPropTypes } from './withWindowDimensions'; import compose from '../libs/compose'; import CONST from '../CONST'; import ButtonWithDropdownMenu from './ButtonWithDropdownMenu'; import Log from '../libs/Log'; import SettlementButton from './SettlementButton'; import ROUTES from '../ROUTES'; -import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from './withCurrentUserPersonalDetails'; +import withCurrentUserPersonalDetails, { withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes } from './withCurrentUserPersonalDetails'; import * as IOUUtils from '../libs/IOUUtils'; import MenuItemWithTopDescription from './MenuItemWithTopDescription'; import Navigation from '../libs/Navigation/Navigation'; import optionPropTypes from './optionPropTypes'; import * as CurrencyUtils from '../libs/CurrencyUtils'; +import Button from './Button'; +import * as Expensicons from './Icon/Expensicons'; const propTypes = { /** Callback to inform parent modal of success */ @@ -82,9 +85,9 @@ const propTypes = { }; const defaultProps = { - onConfirm: () => {}, - onSendMoney: () => {}, - onSelectParticipant: () => {}, + onConfirm: () => { }, + onSendMoney: () => { }, + onSelectParticipant: () => { }, iouType: CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, payeePersonalDetails: null, canModifyParticipants: false, @@ -101,7 +104,10 @@ const defaultProps = { function MoneyRequestConfirmationList(props) { // Destructure functions from props to pass it as a dependecy to useCallback/useMemo hooks. // Prop functions pass props itself as a "this" value to the function which means they change every time props change. - const {translate, onSendMoney, onConfirm, onSelectParticipant} = props; + const { translate, onSendMoney, onConfirm, onSelectParticipant } = props; + + // A flag and a toggler for showing the rest of the form fields + const [showAllFields, toggleShowAllFields] = useReducer((state) => !state, false); /** * Returns the participants with amount @@ -272,6 +278,7 @@ function MoneyRequestConfirmationList(props) { /> ); }, [confirm, props.selectedParticipants, props.bankAccountRoute, props.iouCurrencyCode, props.iouType, props.isReadOnly, props.policyID, selectedParticipants, splitOrRequestOptions]); + console.log('list', props); return ( + + +