Skip to content

Commit

Permalink
refactor flag page
Browse files Browse the repository at this point in the history
  • Loading branch information
dukenv0307 committed Aug 4, 2023
1 parent f6e1f73 commit cbca70c
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/pages/FlagCommentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import * as ReportUtils from '../libs/ReportUtils';
import * as ReportActionsUtils from '../libs/ReportActionsUtils';
import * as Session from '../libs/actions/Session';
import FullPageNotFoundView from '../components/BlockingViews/FullPageNotFoundView';
import FullscreenLoadingIndicator from '../components/FullscreenLoadingIndicator';
import withReportAndReportActionOrNotFound from './home/report/withReportAndReportActionOrNotFound';

const propTypes = {
Expand All @@ -40,16 +39,12 @@ const propTypes = {
}),
}).isRequired,

/** Indicates whether the report data is loading */
isLoadingReportData: PropTypes.bool,

...withLocalizePropTypes,
};

const defaultProps = {
reportActions: {},
report: {},
isLoadingReportData: true,
};

/**
Expand Down Expand Up @@ -156,19 +151,10 @@ function FlagCommentPage(props) {
/>
));

const isLoadingInitialReport = props.isLoadingReportData && _.isEmpty(props.report);
const isLoadingInitialReportActions = _.isEmpty(props.reportActions) || (props.report.isLoadingReportActions && _.isEmpty(getActionToFlag()));
const isExistReport = isLoadingInitialReport || (!_.isEmpty(props.report) && !!props.report.reportID);

const shouldShowLoading = (isLoadingInitialReport || isLoadingInitialReportActions) && isExistReport;
if (shouldShowLoading) {
return <FullscreenLoadingIndicator />;
}

return (
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
{({safeAreaPaddingBottomStyle}) => (
<FullPageNotFoundView shouldShow={!shouldShowLoading && !ReportUtils.shouldShowFlagComment(getActionToFlag(), props.report)}>
<FullPageNotFoundView shouldShow={!ReportUtils.shouldShowFlagComment(getActionToFlag(), props.report)}>
<HeaderWithBackButton title={props.translate('reportActionContextMenu.flagAsOffensive')} />
<ScrollView
contentContainerStyle={safeAreaPaddingBottomStyle}
Expand Down

0 comments on commit cbca70c

Please sign in to comment.