Skip to content

Commit

Permalink
Comment box remove duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
caleballdrin committed Oct 24, 2024
1 parent 426cdc7 commit 44471f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 33 deletions.
5 changes: 1 addition & 4 deletions src/components/Task/TaskRow/CommentTooltipText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ export const CommentTooltipText: React.FC<CommentTooltipTextProps> = ({
comments,
}) => {
const locale = useLocale();

const latestComment = !!comments.length
? comments[comments.length - 1]
: null;
const latestComment = comments.at(-1) ?? null;
return latestComment ? (
<>
<TooltipTypography>{latestComment.body}</TooltipTypography>
Expand Down
40 changes: 11 additions & 29 deletions src/components/Task/TaskRow/TaskRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,14 @@ export const TaskRow: React.FC<TaskRowProps> = ({
</Tooltip>
)}
</Hidden>
<Hidden mdDown>
<TaskDate isComplete={isComplete} taskDate={taskDate} />
<Box
sx={{ display: 'flex', flexDirection: isMedium ? 'column' : 'row' }}
>
<TaskDate
isComplete={isComplete}
taskDate={taskDate}
small={isMedium}
/>
<Tooltip
title={
comments.totalCount ? (
Expand All @@ -316,37 +322,13 @@ export const TaskRow: React.FC<TaskRowProps> = ({
numberOfComments={comments?.totalCount}
onClick={handleCommentButtonPressed}
onMouseEnter={() => preloadTaskModal(TaskModalEnum.Comments)}
small={isMedium}
detailsPage={isMedium}
/>
</Box>
</Tooltip>
</Hidden>
</Box>

<Hidden mdUp>
<Box>
<TaskDate isComplete={isComplete} taskDate={taskDate} small />
<Tooltip
title={
comments.totalCount ? (
<CommentTooltipText comments={comments.nodes} />
) : null
}
placement="top"
arrow
>
<Box>
<TaskCommentsButton
isComplete={isComplete}
numberOfComments={comments?.totalCount}
onClick={handleCommentButtonPressed}
onMouseEnter={() =>
preloadTaskModal(TaskModalEnum.Comments)
}
small
/>
</Box>
</Tooltip>
</Box>
</Hidden>
<Hidden smDown>
<Box onClick={(e) => e.stopPropagation()}>
<DeleteTaskIconButton
Expand Down

0 comments on commit 44471f0

Please sign in to comment.