Skip to content

Commit

Permalink
Merge pull request #25557 from cubuspl42/nuke-unused-attachment-previ…
Browse files Browse the repository at this point in the history
…ew-1

Remove unused attachment placeholder code
  • Loading branch information
flodnv committed Sep 29, 2023
2 parents 2f53f4f + 38ac505 commit 5b5bdc8
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 38 deletions.
7 changes: 1 addition & 6 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,7 @@ function ReportActionItem(props) {
draftMessage={props.draftMessage}
isChronosReport={ReportUtils.chatIncludesChronos(originalReport)}
/>
<View
style={StyleUtils.getReportActionItemStyle(
hovered || isWhisper || isContextMenuActive || props.draftMessage,
(props.network.isOffline && props.action.isLoading) || props.action.error,
)}
>
<View style={StyleUtils.getReportActionItemStyle(hovered || isWhisper || isContextMenuActive || props.draftMessage)}>
<OfflineWithFeedback
onClose={() => ReportActions.clearReportActionErrors(props.report.reportID, props.action)}
pendingAction={props.draftMessage ? null : props.action.pendingAction}
Expand Down
23 changes: 0 additions & 23 deletions src/pages/home/report/ReportActionItemFragment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, {memo} from 'react';
import {ActivityIndicator, View} from 'react-native';
import PropTypes from 'prop-types';
import Str from 'expensify-common/lib/str';
import reportActionFragmentPropTypes from './reportActionFragmentPropTypes';
Expand Down Expand Up @@ -27,9 +26,6 @@ const propTypes = {
/** The message fragment needing to be displayed */
fragment: reportActionFragmentPropTypes.isRequired,

/** Is this fragment an attachment? */
isAttachment: PropTypes.bool,

/** If this fragment is attachment than has info? */
attachmentInfo: PropTypes.shape({
/** The file name of attachment */
Expand All @@ -48,9 +44,6 @@ const propTypes = {
/** Message(text) of an IOU report action */
iouMessage: PropTypes.string,

/** Does this fragment belong to a reportAction that has not yet loaded? */
loading: PropTypes.bool,

/** The reportAction's source */
source: PropTypes.oneOf(['Chronos', 'email', 'ios', 'android', 'web', 'email', '']),

Expand All @@ -76,15 +69,13 @@ const propTypes = {
};

const defaultProps = {
isAttachment: false,
attachmentInfo: {
name: '',
size: 0,
type: '',
source: '',
},
iouMessage: '',
loading: false,
isSingleLine: false,
source: '',
style: [],
Expand All @@ -96,20 +87,6 @@ const defaultProps = {
function ReportActionItemFragment(props) {
switch (props.fragment.type) {
case 'COMMENT': {
// If this is an attachment placeholder, return the placeholder component
if (props.isAttachment && props.loading) {
return Str.isImage(props.attachmentInfo.name) ? (
<RenderHTML html={`<comment><img src="${props.attachmentInfo.source}" data-expensify-preview-modal-disabled="true"/></comment>`} />
) : (
<View style={[styles.chatItemAttachmentPlaceholder]}>
<ActivityIndicator
size="large"
color={themeColors.textSupporting}
style={[styles.flex1]}
/>
</View>
);
}
const {html, text} = props.fragment;
const isPendingDelete = props.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && props.network.isOffline;

Expand Down
2 changes: 0 additions & 2 deletions src/pages/home/report/ReportActionItemMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ function ReportActionItemMessage(props) {
<ReportActionItemFragment
key={`actionFragment-${props.action.reportActionID}-${index}`}
fragment={fragment}
isAttachment={props.action.isAttachment}
iouMessage={iouMessage}
isThreadParentMessage={ReportActionsUtils.isThreadParentMessage(props.action, props.reportID)}
attachmentInfo={props.action.attachmentInfo}
pendingAction={props.action.pendingAction}
source={lodashGet(props.action, 'originalMessage.source')}
accountID={props.action.actorAccountID}
loading={props.action.isLoading}
style={props.style}
/>
))
Expand Down
2 changes: 0 additions & 2 deletions src/pages/home/report/ReportActionItemSingle.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ function ReportActionItemSingle(props) {
key={`person-${props.action.reportActionID}-${index}`}
accountID={actorAccountID}
fragment={fragment}
isAttachment={props.action.isAttachment}
isLoading={props.action.isLoading}
delegateAccountID={props.action.delegateAccountID}
isSingleLine
actorIcon={icon}
Expand Down
3 changes: 0 additions & 3 deletions src/pages/home/report/reportActionPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ export default {
IOUTransactionID: PropTypes.string,
}),

/** Whether we have received a response back from the server */
isLoading: PropTypes.bool,

/** Error message that's come back from the server. */
error: PropTypes.string,

Expand Down
4 changes: 2 additions & 2 deletions src/styles/StyleUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ function getEmojiPickerStyle(isSmallScreenWidth: boolean): ViewStyle | CSSProper
/**
* Generate the styles for the ReportActionItem wrapper view.
*/
function getReportActionItemStyle(isHovered = false, isLoading = false): ViewStyle | CSSProperties {
function getReportActionItemStyle(isHovered = false): ViewStyle | CSSProperties {
// TODO: Remove this "eslint-disable-next" once the theme switching migration is done and styles are fully typed (GH Issue: https://github.com/Expensify/App/issues/27337)
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return {
Expand All @@ -587,7 +587,7 @@ function getReportActionItemStyle(isHovered = false, isLoading = false): ViewSty
? themeColors.hoverComponentBG
: // Warning: Setting this to a non-transparent color will cause unread indicator to break on Android
themeColors.transparent,
opacity: isLoading ? 0.5 : 1,
opacity: 1,
...styles.cursorInitial,
};
}
Expand Down

0 comments on commit 5b5bdc8

Please sign in to comment.