Skip to content

Commit

Permalink
achieve same height with margin
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Sep 26, 2024
1 parent c3a7357 commit 7087eaa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/components/ReportActionItem/TaskPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,19 @@ function TaskPreview({taskReportID, action, contextMenuAnchor, chatReportID, che
: action?.childStateNum === CONST.REPORT.STATE_NUM.APPROVED && action?.childStatusNum === CONST.REPORT.STATUS_NUM.APPROVED;
const taskTitle = Str.htmlEncode(TaskUtils.getTaskTitle(taskReportID, action?.childReportName ?? ''));
const taskAssigneeAccountID = Task.getTaskAssigneeAccountID(taskReport) ?? action?.childManagerAccountID ?? -1;
const hasAssignee = taskAssigneeAccountID > 0;
const personalDetails = usePersonalDetails();
const avatar = personalDetails?.[taskAssigneeAccountID]?.avatar ?? Expensicons.FallbackAvatar;
const avatarSize = CONST.AVATAR_SIZE.SMALL;
const isDeletedParentAction = ReportUtils.isCanceledTaskReport(taskReport, action);
const iconWrapperStyle = StyleUtils.getTaskPreviewIconWrapper(avatarSize);
const iconWrapperStyle = StyleUtils.getTaskPreviewIconWrapper(hasAssignee ? avatarSize : undefined);

if (isDeletedParentAction) {
return <RenderHTML html={`<comment>${translate('parentReportAction.deletedTask')}</comment>`} />;
}

return (
<View style={[styles.chatItemMessage]}>
<View style={[styles.chatItemMessage, !hasAssignee && styles.mv1]}>
<PressableWithoutFeedback
onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(taskReportID))}
onPressIn={() => DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()}
Expand All @@ -110,7 +111,7 @@ function TaskPreview({taskReportID, action, contextMenuAnchor, chatReportID, che
accessibilityLabel={translate('task.task')}
/>
</View>
{taskAssigneeAccountID > 0 && (
{hasAssignee && (
<Avatar
containerStyles={[styles.mr2, isTaskCompleted ? styles.opacitySemiTransparent : undefined]}
source={avatar}
Expand Down
4 changes: 2 additions & 2 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1669,9 +1669,9 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
justifyContent: 'center',
}),

getTaskPreviewIconWrapper: (avatarSize: AvatarSizeName) => {
getTaskPreviewIconWrapper: (avatarSize?: AvatarSizeName) => {
return {
height: getAvatarSize(avatarSize),
height: avatarSize ? getAvatarSize(avatarSize) : variables.fontSizeNormalHeight,
...styles.justifyContentCenter,
};
},
Expand Down

0 comments on commit 7087eaa

Please sign in to comment.