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

Fix report preview style #19230

Merged
merged 9 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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
8 changes: 5 additions & 3 deletions src/components/ReportActionItem/ReportPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const ReportPreview = (props) => {
const managerName = ReportUtils.isPolicyExpenseChat(props.chatReport) ? ReportUtils.getPolicyName(props.chatReport) : ReportUtils.getDisplayNameForParticipant(managerEmail, true);
const isCurrentUserManager = managerEmail === lodashGet(props.session, 'email', null);
return (
<View style={[styles.chatItemMessage, styles.mt4]}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi ✋ Coming from #22797

We must maintain the top margin when previewing with the user details avatar. Instead of removing this style, we should pass a new props style 8px margin from ReportActionItem based on the message not grouped with the previous message.

<View style={[styles.chatItemMessage]}>
{_.map(props.action.message, (message, index) => (
<Pressable
key={`ReportPreview-${props.action.reportActionID}-${index}`}
Expand All @@ -114,12 +114,14 @@ const ReportPreview = (props) => {
>
<View style={[styles.flexShrink1]}>
{props.iouReport.hasOutstandingIOU ? (
<Text style={[styles.chatItemMessage, styles.cursorPointer]}>
<Text style={[styles.chatItemMessage, styles.cursorPointer, styles.colorMuted]}>
{lodashGet(message, 'html', props.translate('iou.payerOwesAmount', {payer: managerName, amount: reportAmount}))}
</Text>
) : (
<View style={[styles.flexRow]}>
<Text style={[styles.chatItemMessage, styles.cursorPointer]}>{lodashGet(message, 'html', props.translate('iou.payerSettled', {amount: reportAmount}))}</Text>
<Text style={[styles.chatItemMessage, styles.cursorPointer, styles.colorMuted]}>
{lodashGet(message, 'html', props.translate('iou.payerSettled', {amount: reportAmount}))}
</Text>
{!props.iouReport.hasOutstandingIOU && (
<Icon
style={[styles.ml10]}
Expand Down
5 changes: 4 additions & 1 deletion src/pages/home/report/ReportActionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ const ReportActionsList = (props) => {
action={reportAction}
displayAsGroup={ReportActionsUtils.isConsecutiveActionMadeByPreviousActor(sortedReportActions, index)}
shouldDisplayNewMarker={shouldDisplayNewMarker}
shouldShowSubscriptAvatar={ReportUtils.isPolicyExpenseChat(report) && reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU}
shouldShowSubscriptAvatar={
(ReportUtils.isPolicyExpenseChat(report) || ReportUtils.isExpenseReport(report)) &&
_.contains([CONST.REPORT.ACTIONS.TYPE.IOU, CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW], reportAction.actionName)
}
isMostRecentIOUReportAction={reportAction.reportActionID === mostRecentIOUReportActionID}
hasOutstandingIOU={hasOutstandingIOU}
index={index}
Expand Down