-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat(26270): Add Skeleton UI for Money Requests #26613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c251101
b2912b2
6c6e69d
c237268
230b2cc
ad392c3
166c12d
cc9f83f
ae1f08d
d37fcfb
93df38a
aae804d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import React from 'react'; | ||
| import {Rect} from 'react-native-svg'; | ||
| import SkeletonViewContentLoader from 'react-content-loader/native'; | ||
| import variables from '../styles/variables'; | ||
| import themeColors from '../styles/themes/default'; | ||
| import styles from '../styles/styles'; | ||
|
|
||
| function MoneyRequestSkeletonView() { | ||
| return ( | ||
| <SkeletonViewContentLoader | ||
| animate | ||
| width={styles.w100.width} | ||
| height={variables.moneyRequestSkeletonHeight} | ||
| backgroundColor={themeColors.borderLighter} | ||
| foregroundColor={themeColors.border} | ||
| > | ||
| <Rect | ||
| x="16" | ||
| y="20" | ||
| width="40" | ||
| height="8" | ||
| /> | ||
| <Rect | ||
| x="16" | ||
| y="46" | ||
| width="120" | ||
| height="20" | ||
| /> | ||
| <Rect | ||
| x="16" | ||
| y="78" | ||
| width="80" | ||
| height="8" | ||
| /> | ||
| </SkeletonViewContentLoader> | ||
| ); | ||
| } | ||
|
|
||
| MoneyRequestSkeletonView.displayName = 'MoneyRequestSkeletonView'; | ||
| export default MoneyRequestSkeletonView; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ import * as ReceiptUtils from '../../libs/ReceiptUtils'; | |
| import ReportActionItemImages from './ReportActionItemImages'; | ||
| import transactionPropTypes from '../transactionPropTypes'; | ||
| import colors from '../../styles/colors'; | ||
| import MoneyRequestSkeletonView from '../MoneyRequestSkeletonView'; | ||
|
|
||
| const propTypes = { | ||
| /** The active IOUReport, used for Onyx subscription */ | ||
|
|
@@ -234,77 +235,81 @@ function MoneyRequestPreview(props) { | |
| isHovered={isScanning} | ||
| /> | ||
| )} | ||
| <View style={styles.moneyRequestPreviewBoxText}> | ||
| <View style={[styles.flexRow]}> | ||
| <View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}> | ||
| <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}>{getPreviewHeaderText()}</Text> | ||
| {Boolean(getSettledMessage()) && ( | ||
| <> | ||
| <Icon | ||
| src={Expensicons.DotIndicator} | ||
| width={4} | ||
| height={4} | ||
| additionalStyles={[styles.mr1, styles.ml1]} | ||
| /> | ||
| <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}>{getSettledMessage()}</Text> | ||
| </> | ||
| {_.isEmpty(props.transaction) ? ( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This caused regression of showing skeleton forever when delete money request offline - #26939 |
||
| <MoneyRequestSkeletonView /> | ||
| ) : ( | ||
| <View style={styles.moneyRequestPreviewBoxText}> | ||
| <View style={[styles.flexRow]}> | ||
| <View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}> | ||
| <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}>{getPreviewHeaderText()}</Text> | ||
| {Boolean(getSettledMessage()) && ( | ||
| <> | ||
| <Icon | ||
| src={Expensicons.DotIndicator} | ||
| width={4} | ||
| height={4} | ||
| additionalStyles={[styles.mr1, styles.ml1]} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coming from Dot separator in the report preview component appears bottom aligned
|
||
| /> | ||
| <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}>{getSettledMessage()}</Text> | ||
| </> | ||
| )} | ||
| </View> | ||
| {hasFieldErrors && ( | ||
| <Icon | ||
| src={Expensicons.DotIndicator} | ||
| fill={colors.red} | ||
| /> | ||
| )} | ||
| </View> | ||
| {hasFieldErrors && ( | ||
| <Icon | ||
| src={Expensicons.DotIndicator} | ||
| fill={colors.red} | ||
| /> | ||
| )} | ||
| </View> | ||
| <View style={[styles.flexRow]}> | ||
| <View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}> | ||
| <Text style={styles.textHeadline}>{getDisplayAmountText()}</Text> | ||
| {ReportUtils.isSettled(props.iouReport.reportID) && !props.isBillSplit && ( | ||
| <View style={styles.defaultCheckmarkWrapper}> | ||
| <Icon | ||
| src={Expensicons.Checkmark} | ||
| fill={themeColors.iconSuccessFill} | ||
| <View style={[styles.flexRow]}> | ||
| <View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}> | ||
| <Text style={styles.textHeadline}>{getDisplayAmountText()}</Text> | ||
| {ReportUtils.isSettled(props.iouReport.reportID) && !props.isBillSplit && ( | ||
| <View style={styles.defaultCheckmarkWrapper}> | ||
| <Icon | ||
| src={Expensicons.Checkmark} | ||
| fill={themeColors.iconSuccessFill} | ||
| /> | ||
| </View> | ||
| )} | ||
| </View> | ||
| {props.isBillSplit && ( | ||
| <View style={styles.moneyRequestPreviewBoxAvatar}> | ||
| <MultipleAvatars | ||
| icons={participantAvatars} | ||
| shouldStackHorizontally | ||
| size="small" | ||
| isHovered={props.isHovered} | ||
| shouldUseCardBackground | ||
| /> | ||
| </View> | ||
| )} | ||
| </View> | ||
| {props.isBillSplit && ( | ||
| <View style={styles.moneyRequestPreviewBoxAvatar}> | ||
| <MultipleAvatars | ||
| icons={participantAvatars} | ||
| shouldStackHorizontally | ||
| size="small" | ||
| isHovered={props.isHovered} | ||
| shouldUseCardBackground | ||
| /> | ||
| {shouldShowMerchant && ( | ||
| <View style={[styles.flexRow]}> | ||
| <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20, styles.breakWord]}>{requestMerchant}</Text> | ||
| </View> | ||
| )} | ||
| </View> | ||
| {shouldShowMerchant && ( | ||
| <View style={[styles.flexRow]}> | ||
| <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20, styles.breakWord]}>{requestMerchant}</Text> | ||
| </View> | ||
| )} | ||
| <View style={[styles.flexRow]}> | ||
| <View style={[styles.flex1]}> | ||
| {!isCurrentUserManager && props.shouldShowPendingConversionMessage && ( | ||
| <Text style={[styles.textLabel, styles.colorMuted, styles.mt1]}>{props.translate('iou.pendingConversionMessage')}</Text> | ||
| <View style={[styles.flex1]}> | ||
| {!isCurrentUserManager && props.shouldShowPendingConversionMessage && ( | ||
| <Text style={[styles.textLabel, styles.colorMuted, styles.mt1]}>{props.translate('iou.pendingConversionMessage')}</Text> | ||
| )} | ||
| {shouldShowDescription && <Text style={[styles.mt1, styles.colorMuted]}>{description}</Text>} | ||
| </View> | ||
| {props.isBillSplit && !_.isEmpty(participantAccountIDs) && ( | ||
| <Text style={[styles.textLabel, styles.colorMuted, styles.ml1]}> | ||
| {props.translate('iou.amountEach', { | ||
| amount: CurrencyUtils.convertToDisplayString( | ||
| IOUUtils.calculateAmount(isPolicyExpenseChat ? 1 : participantAccountIDs.length - 1, requestAmount, requestCurrency), | ||
| requestCurrency, | ||
| ), | ||
| })} | ||
| </Text> | ||
| )} | ||
| {shouldShowDescription && <Text style={[styles.mt1, styles.colorMuted]}>{description}</Text>} | ||
| </View> | ||
| {props.isBillSplit && !_.isEmpty(participantAccountIDs) && ( | ||
| <Text style={[styles.textLabel, styles.colorMuted, styles.ml1]}> | ||
| {props.translate('iou.amountEach', { | ||
| amount: CurrencyUtils.convertToDisplayString( | ||
| IOUUtils.calculateAmount(isPolicyExpenseChat ? 1 : participantAccountIDs.length - 1, requestAmount, requestCurrency), | ||
| requestCurrency, | ||
| ), | ||
| })} | ||
| </Text> | ||
| )} | ||
| </View> | ||
| </View> | ||
| )} | ||
| </View> | ||
| </OfflineWithFeedback> | ||
| </View> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.