Skip to content

Commit

Permalink
fix: resolving comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kubabutkiewicz committed Mar 8, 2024
1 parent 1bc3731 commit 09eb438
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,7 @@ function MoneyRequestConfirmationList({
}, [isSplitBill, isTypeRequest, iouType, iouAmount, receiptPath, formattedAmount, isDistanceRequestWithPendingRoute, translate]);

const selectedParticipants: Participant[] = useMemo(() => selectedParticipantsProp.filter((participant) => participant.selected), [selectedParticipantsProp]);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const payeePersonalDetails = useMemo(() => payeePersonalDetailsProp || currentUserPersonalDetails, [payeePersonalDetailsProp, currentUserPersonalDetails]);
const payeePersonalDetails = useMemo(() => payeePersonalDetailsProp ?? currentUserPersonalDetails, [payeePersonalDetailsProp, currentUserPersonalDetails]);
const canModifyParticipants = !isReadOnly && canModifyParticipantsProp && hasMultipleParticipants;
const shouldDisablePaidBySection = canModifyParticipants;

Expand Down Expand Up @@ -443,7 +442,7 @@ function MoneyRequestConfirmationList({
*/
IOU.setMoneyRequestPendingFields(transactionID, {waypoints: isDistanceRequestWithPendingRoute ? CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD : null});

const distanceMerchant = DistanceRequestUtils.getDistanceMerchant(hasRoute, distance, unit, rate ?? 0, currency ?? 'USD', translate, toLocaleDigit);
const distanceMerchant = DistanceRequestUtils.getDistanceMerchant(hasRoute, distance, unit, rate ?? 0, currency ?? CONST.CURRENCY.USD, translate, toLocaleDigit);
IOU.setMoneyRequestMerchant(transactionID, distanceMerchant, false);
}, [isDistanceRequestWithPendingRoute, hasRoute, distance, unit, rate, currency, translate, toLocaleDigit, isDistanceRequest, transactionID]);

Expand Down Expand Up @@ -476,7 +475,7 @@ function MoneyRequestConfirmationList({
if (!selectedParticipants.length) {
return;
}
if (iouCategory && iouCategory.length > CONST.API_TRANSACTION_CATEGORY_MAX_LENGTH) {
if (iouCategory.length > CONST.API_TRANSACTION_CATEGORY_MAX_LENGTH) {
setFormError('iou.error.invalidCategoryLength');
return;
}
Expand Down Expand Up @@ -609,7 +608,7 @@ function MoneyRequestConfirmationList({
shouldShowTextInput={false}
shouldUseStyleForChildren={false}
optionHoveredStyle={canModifyParticipants ? styles.hoveredComponentBG : {}}
footerContent={(!isEmpty(iou?.id) || isEditingSplitBill) && footerContent}
footerContent={(!!iou?.id || isEditingSplitBill) && footerContent}
listStyles={listStyles}
shouldAllowScrollingChildren
>
Expand All @@ -619,6 +618,8 @@ function MoneyRequestConfirmationList({
</View>
)}

{console.log('receiptImage', receiptImage)}
{console.log('receiptThumbnail', receiptThumbnail)}
{receiptImage || receiptThumbnail ? (
<Image
style={styles.moneyRequestImage}
Expand Down
2 changes: 1 addition & 1 deletion src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ type RequestAmountParams = {amount: string};

type RequestedAmountMessageParams = {formattedAmount: string; comment?: string};

type SplitAmountParams = {amount: number | string};
type SplitAmountParams = {amount: string};

type DidSplitAmountMessageParams = {formattedAmount: string; comment: string};

Expand Down
3 changes: 2 additions & 1 deletion src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import type {
import type {Participant} from '@src/types/onyx/IOU';
import type * as OnyxCommon from '@src/types/onyx/OnyxCommon';
import type DeepValueOf from '@src/types/utils/DeepValueOf';
import type {EmptyObject} from '@src/types/utils/EmptyObject';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import times from '@src/utils/times';
import Timing from './actions/Timing';
Expand Down Expand Up @@ -1764,7 +1765,7 @@ function getShareLogOptions(reports: OnyxCollection<Report>, personalDetails: On
/**
* Build the IOUConfirmation options for showing the payee personalDetail
*/
function getIOUConfirmationOptionsFromPayeePersonalDetail(personalDetail: PersonalDetails | Record<string, never>, amountText?: string): PayeePersonalDetails {
function getIOUConfirmationOptionsFromPayeePersonalDetail(personalDetail: PersonalDetails | EmptyObject, amountText?: string): PayeePersonalDetails {
const formattedLogin = LocalePhoneNumber.formatPhoneNumber(personalDetail.login ?? '');
return {
text: PersonalDetailsUtils.getDisplayNameOrDefault(personalDetail, formattedLogin),
Expand Down

0 comments on commit 09eb438

Please sign in to comment.