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 tooltip extra space when status text is empty #33332

Merged
merged 2 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
const statusText = lodashGet(optionItem, 'status.text', '');
const statusClearAfterDate = lodashGet(optionItem, 'status.clearAfter', '');
const formattedDate = DateUtils.getStatusUntilDate(statusClearAfterDate);
const statusContent = formattedDate ? `${statusText} (${formattedDate})` : statusText;
const statusContent = formattedDate ? (statusText ? `${statusText} (${formattedDate})` : `(${formattedDate})`) : statusText;

Check failure on line 153 in src/components/LHNOptionsList/OptionRowLHN.js

View workflow job for this annotation

GitHub Actions / lint

Do not nest ternary expressions
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const statusContent = formattedDate ? (statusText ? `${statusText} (${formattedDate})` : `(${formattedDate})`) : statusText;
const statusContent = formattedDate ? `${statusText ? `${statusText} ` : ''}(${formattedDate})` : statusText;

as lint complains: Do not nest ternary expressions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for reviewing @mkhutornyi

const isStatusVisible = !!emojiCode && ReportUtils.isOneOnOneChat(ReportUtils.getReport(optionItem.reportID));

const isGroupChat =
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItemSingle.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
const hasEmojiStatus = !displayAllActors && status && status.emojiCode;
const formattedDate = DateUtils.getStatusUntilDate(lodashGet(status, 'clearAfter'));
const statusText = lodashGet(status, 'text', '');
const statusTooltipText = formattedDate ? `${statusText} (${formattedDate})` : statusText;
const statusTooltipText = formattedDate ? (statusText ? `${statusText} (${formattedDate})` : `(${formattedDate})`) : statusText;

Check failure on line 209 in src/pages/home/report/ReportActionItemSingle.js

View workflow job for this annotation

GitHub Actions / lint

Do not nest ternary expressions
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here:

Suggested change
const statusTooltipText = formattedDate ? (statusText ? `${statusText} (${formattedDate})` : `(${formattedDate})`) : statusText;
const statusTooltipText = formattedDate ? `${statusText ? `${statusText} ` : ''}(${formattedDate})` : statusText;


return (
<View style={[styles.chatItem, props.wrapperStyle]}>
Expand Down
Loading