Skip to content

Commit

Permalink
Merge pull request #20746 from esh-g/split-bill-show-tooltip
Browse files Browse the repository at this point in the history
Add tooltips and nav to bill details
  • Loading branch information
cristipaval authored Jun 15, 2023
2 parents 9797fa4 + b100ee4 commit ab3886b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import MenuItemWithTopDescription from './MenuItemWithTopDescription';
import Navigation from '../libs/Navigation/Navigation';
import optionPropTypes from './optionPropTypes';
import * as CurrencyUtils from '../libs/CurrencyUtils';
import * as ReportUtils from '../libs/ReportUtils';

const propTypes = {
/** Callback to inform parent modal of success */
Expand Down Expand Up @@ -228,6 +229,17 @@ function MoneyRequestConfirmationList(props) {
[props.session.email],
);

/**
* Navigate to profile of selected user
* @param {Object} option
*/
const navigateToUserDetail = (option) => {
if (!option.login) {
return;
}
Navigation.navigate(ROUTES.getProfileRoute(ReportUtils.getAccountIDForLogin(option.login)));
};

/**
* @param {String} paymentMethod
*/
Expand Down Expand Up @@ -290,12 +302,13 @@ function MoneyRequestConfirmationList(props) {
<OptionsSelector
sections={optionSelectorSections}
value=""
onSelectRow={canModifyParticipants ? toggleOption : undefined}
onSelectRow={canModifyParticipants ? toggleOption : navigateToUserDetail}
onConfirmSelection={confirm}
selectedOptions={selectedOptions}
canSelectMultipleOptions={canModifyParticipants}
disableArrowKeysActions={!canModifyParticipants}
boldStyle
showTitleTooltip
shouldTextInputAppearBelowOptions
shouldShowTextInput={false}
shouldUseStyleForChildren={false}
Expand Down
5 changes: 4 additions & 1 deletion src/components/OptionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ class OptionRow extends Component {
const isMultipleParticipant = lodashGet(this.props.option, 'participantsList.length', 0) > 1;

// We only create tooltips for the first 10 users or so since some reports have hundreds of users, causing performance to degrade.
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips((this.props.option.participantsList || []).slice(0, 10), isMultipleParticipant);
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(
(this.props.option.participantsList || this.props.option.login ? [this.props.option] : []).slice(0, 10),
isMultipleParticipant,
);
let subscriptColor = themeColors.appBG;
if (this.props.optionIsFocused) {
subscriptColor = focusedBackgroundColor;
Expand Down

0 comments on commit ab3886b

Please sign in to comment.