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

Only bold user display name when it's unread in search page #37306

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/components/SelectionList/UserListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function UserListItem({
textStyles={[
styles.optionDisplayName,
isFocused ? styles.sidebarLinkActiveText : styles.sidebarLinkText,
styles.sidebarLinkTextBold,
item.isBold !== false && styles.sidebarLinkTextBold,
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB: Why do we need !== false if it's a boolean?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we fix that with a default prop maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could be undefined. item is an object, I'm not sure if we can set a default value for an object attribute.

styles.pre,
item.alternateText ? styles.mb1 : null,
]}
Expand Down
3 changes: 3 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ type ListItem = {
/** Whether this option is disabled for selection */
isDisabled?: boolean;

/** List title is bold by default. Use this props to customize it */
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB: Use this props to customize it => Use this prop to customize it

isBold?: boolean;

/** User accountID */
accountID?: number | null;

Expand Down
3 changes: 2 additions & 1 deletion src/pages/SearchPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
import React, {useEffect, useMemo, useState} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import {usePersonalDetails} from '@components/OnyxProvider';
import ScreenWrapper from '@components/ScreenWrapper';
Expand Down Expand Up @@ -93,7 +94,7 @@ function SearchPage({betas, reports, isSearchingForReports}) {

if (recentReports.length > 0) {
newSections.push({
data: recentReports,
data: _.map(recentReports, (report) => ({...report, isBold: report.isUnread})),
Copy link
Contributor

Choose a reason for hiding this comment

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

This caused inconsistency with LHN where the bold style was applied based on other factors too (the notification preference of the report)

const textUnreadStyle = optionItem?.isUnread && optionItem.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE ? [textStyle, styles.sidebarLinkTextBold] : [textStyle];

shouldShow: true,
indexOffset,
});
Expand Down
Loading