Skip to content

Commit

Permalink
Merge pull request #54985 from mkzie2/mkzie2-issue/54769
Browse files Browse the repository at this point in the history
Fix the border bottom doesn't display in the header of completed task report
  • Loading branch information
rlinoz authored Jan 10, 2025
2 parents 219e66d + 42be56a commit c95f9fa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ const ROUTES = {
},
WORKSPACE_PROFILE_DESCRIPTION: {
route: 'settings/workspaces/:policyID/profile/description',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/profile/description` as const,
getRoute: (policyID: string | undefined) => `settings/workspaces/${policyID}/profile/description` as const,
},
WORKSPACE_PROFILE_SHARE: {
route: 'settings/workspaces/:policyID/profile/share',
Expand Down
22 changes: 15 additions & 7 deletions src/pages/home/HeaderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
const {isSmallScreenWidth} = useResponsiveLayout();
const route = useRoute();
const [isDeleteTaskConfirmModalVisible, setIsDeleteTaskConfirmModalVisible] = React.useState(false);
const [invoiceReceiverPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : -1}`);
const [invoiceReceiverPolicy] = useOnyx(
`${ONYXKEYS.COLLECTION.POLICY}${report?.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : CONST.DEFAULT_NUMBER_ID}`,
);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID || report?.reportID || '-1'}`);
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID || report?.reportID || CONST.DEFAULT_NUMBER_ID}`);
const policy = usePolicy(report?.policyID);
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);

Expand Down Expand Up @@ -100,7 +102,7 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
const reportDescription = Parser.htmlToText(ReportUtils.getReportDescription(report));
const policyName = ReportUtils.getPolicyName(report, true);
const policyDescription = ReportUtils.getPolicyDescriptionText(policy);
const isPersonalExpenseChat = isPolicyExpenseChat && ReportUtils.isCurrentUserSubmitter(report?.reportID ?? '');
const isPersonalExpenseChat = isPolicyExpenseChat && ReportUtils.isCurrentUserSubmitter(report?.reportID);
const shouldShowSubtitle = () => {
if (!subtitle) {
return false;
Expand Down Expand Up @@ -142,7 +144,6 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
const defaultSubscriptSize = ReportUtils.isExpenseRequest(report) ? CONST.AVATAR_SIZE.SMALL_NORMAL : CONST.AVATAR_SIZE.DEFAULT;
const icons = ReportUtils.getIcons(reportHeaderData, personalDetails, null, '', -1, policy, invoiceReceiverPolicy);
const brickRoadIndicator = ReportUtils.hasReportNameError(report) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '';
const shouldShowBorderBottom = !isTaskReport || !shouldUseNarrowLayout;
const shouldDisableDetailPage = ReportUtils.shouldDisableDetailPage(report);
const shouldUseGroupTitle = isGroupChat && (!!report?.reportName || !isMultipleParticipant);
const isLoading = !report?.reportID || !title;
Expand All @@ -154,7 +155,7 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto

return (
<View
style={[shouldShowBorderBottom && styles.borderBottom]}
style={[styles.borderBottom]}
dataSet={{dragArea: true}}
>
<View style={[styles.appContentHeader, !shouldUseNarrowLayout && styles.headerBarDesktopHeight]}>
Expand Down Expand Up @@ -258,7 +259,7 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
<PressableWithoutFeedback
onPress={() => {
if (ReportUtils.canEditPolicyDescription(policy)) {
Navigation.navigate(ROUTES.WORKSPACE_PROFILE_DESCRIPTION.getRoute(report.policyID ?? '-1'));
Navigation.navigate(ROUTES.WORKSPACE_PROFILE_DESCRIPTION.getRoute(report.policyID));
return;
}
Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(reportID, Navigation.getReportRHPActiveRoute()));
Expand Down Expand Up @@ -286,7 +287,7 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
</PressableWithoutFeedback>
<View style={[styles.reportOptions, styles.flexRow, styles.alignItemsCenter]}>
{!shouldUseNarrowLayout && isChatUsedForOnboarding && <FreeTrial pressable />}
{isTaskReport && !shouldUseNarrowLayout && ReportUtils.isOpenTaskReport(report, parentReportAction) && <TaskHeaderActionButton report={report} />}
{!shouldUseNarrowLayout && ReportUtils.isOpenTaskReport(report, parentReportAction) && <TaskHeaderActionButton report={report} />}
{!isParentReportLoading && canJoin && !shouldUseNarrowLayout && joinButton}
</View>
{shouldDisplaySearchRouter && <SearchButton style={styles.ml2} />}
Expand Down Expand Up @@ -315,6 +316,13 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
addSpacing
/>
)}
{!!report && shouldUseNarrowLayout && ReportUtils.isOpenTaskReport(report, parentReportAction) && (
<View style={[styles.appBG, styles.pl0]}>
<View style={[styles.ph5, styles.pb3]}>
<TaskHeaderActionButton report={report} />
</View>
</View>
)}
</View>
);
}
Expand Down
10 changes: 0 additions & 10 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import MoneyRequestHeader from '@components/MoneyRequestHeader';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView';
import ScreenWrapper from '@components/ScreenWrapper';
import TaskHeaderActionButton from '@components/TaskHeaderActionButton';
import useActiveWorkspace from '@hooks/useActiveWorkspace';
import useAppFocusEvent from '@hooks/useAppFocusEvent';
import type {CurrentReportIDContextValue} from '@hooks/useCurrentReportID';
Expand Down Expand Up @@ -777,15 +776,6 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
needsOffscreenAlphaCompositing
>
{headerView}
{!!report && ReportUtils.isTaskReport(report) && shouldUseNarrowLayout && ReportUtils.isOpenTaskReport(report, parentReportAction) && (
<View style={[styles.borderBottom]}>
<View style={[styles.appBG, styles.pl0]}>
<View style={[styles.ph5, styles.pb3]}>
<TaskHeaderActionButton report={report} />
</View>
</View>
</View>
)}
</OfflineWithFeedback>
{!!accountManagerReportID && ReportUtils.isConciergeChatReport(report) && isBannerVisible && (
<Banner
Expand Down

0 comments on commit c95f9fa

Please sign in to comment.