Skip to content
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

Remove unused attachment placeholder code #25557

Merged
merged 11 commits into from
Sep 29, 2023
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
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,
cubuspl42 marked this conversation as resolved.
Show resolved Hide resolved
)}
>
<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,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@marcaaron Any thoughts? You are to blame for this line 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I searched for isLoading and "isLoading" in the frontend code-base and I couldn't find any set of this property in the context of report actions.


/** 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