Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions assets/images/empty-state__attach-receipt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import Download from '@assets/images/download.svg';
import DragAndDrop from '@assets/images/drag-and-drop.svg';
import DragHandles from '@assets/images/drag-handles.svg';
import Emoji from '@assets/images/emoji.svg';
import EmptyStateAttachReceipt from '@assets/images/empty-state__attach-receipt.svg';
import EmptyStateRoutePending from '@assets/images/emptystate__routepending.svg';
import EReceiptIcon from '@assets/images/eReceiptIcon.svg';
import Exclamation from '@assets/images/exclamation.svg';
Expand Down Expand Up @@ -176,6 +177,7 @@ export {
EReceiptIcon,
Emoji,
EmptyStateRoutePending,
EmptyStateAttachReceipt,
Exclamation,
Exit,
ExpensifyCard,
Expand Down
44 changes: 44 additions & 0 deletions src/components/ReceiptEmptyState.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import PropTypes from 'prop-types';
import React from 'react';
import styles from '@styles/styles';
import variables from '@styles/variables';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback';

const propTypes = {
/** Whether or not there is an error */
hasError: PropTypes.bool,

/** Callback to be called on onPress */
onPress: PropTypes.func,
};

const defaultProps = {
hasError: false,
onPress: () => {},
};

// Returns an SVG icon indicating that the user should attach a receipt
function ReceiptEmptyState({hasError, onPress}) {
return (
<PressableWithoutFeedback
accessibilityRole="imagebutton"
onPress={onPress}
style={[styles.alignItemsCenter, styles.justifyContentCenter, styles.moneyRequestViewImage, styles.moneyRequestAttachReceipt, hasError && styles.borderColorDanger]}
>
<Icon
src={Expensicons.EmptyStateAttachReceipt}
width={variables.eReceiptIconWidth}
height={variables.eReceiptIconHeight}
fill="transparent"
/>
</PressableWithoutFeedback>
);
}

ReceiptEmptyState.displayName = 'ReceiptEmptyState';
ReceiptEmptyState.propTypes = propTypes;
ReceiptEmptyState.defaultProps = defaultProps;

export default ReceiptEmptyState;
7 changes: 7 additions & 0 deletions src/components/ReportActionItem/MoneyRequestView.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import categoryPropTypes from '@components/categoryPropTypes';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import ReceiptEmptyState from '@components/ReceiptEmptyState';
import SpacerView from '@components/SpacerView';
import Switch from '@components/Switch';
import tagPropTypes from '@components/tagPropTypes';
Expand Down Expand Up @@ -176,6 +177,12 @@ function MoneyRequestView({report, betas, parentReport, policyCategories, should
</View>
</OfflineWithFeedback>
)}
{!hasReceipt && canEdit && !isSettled && Permissions.canUseViolations() && (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<ReceiptEmptyState
hasError={hasErrors}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdanwards I have a question. Is the hasErrors always false in this line?

onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT))}
/>
)}
<OfflineWithFeedback pendingAction={getPendingFieldAction('pendingFields.amount')}>
<MenuItemWithTopDescription
title={formattedTransactionAmount ? formattedTransactionAmount.toString() : ''}
Expand Down
5 changes: 5 additions & 0 deletions src/styles/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3834,6 +3834,11 @@ const styles = (theme: ThemeColors) =>
maxWidth: 400,
},

moneyRequestAttachReceipt: {
backgroundColor: theme.appBG,
borderColor: theme.textSupporting,
},

mapViewContainer: {
...flex.flex1,
minHeight: 300,
Expand Down