Skip to content

Commit

Permalink
#10753: Improve the way group names are visualized in user settings b…
Browse files Browse the repository at this point in the history
…y showing tooltip for selected items (#10757)

* #10753: Improve the way group names are visualized in user settings by showing tooltip for selected items

* #10753: add helpful comment for valueRenderer prop in Select of react-select

* #10753: Improve the way group names are visualized in user settings by showing tooltip for selected items (resolve review comments)
- remove unused comment for import + edit a typo mistake in a comment in UserGroups.jsx
  • Loading branch information
mahmoudadel54 authored Jan 21, 2025
1 parent e2c5528 commit e54232d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions web/client/components/manager/users/UserGroups.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ import PropTypes from 'prop-types';

import React from 'react';

// const Message = require('../I18N/Message').default;
import Select from 'react-select';

import Message from '../../I18N/Message';
import { findIndex } from 'lodash';
import SecurityUtils from '../../../utils/SecurityUtils';

// const ConfirmModal = require('./modals/ConfirmModal');
// const GroupManager = require('./GroupManager');

import { OverlayTrigger, Tooltip } from 'react-bootstrap';
class UserCard extends React.Component {
static propTypes = {
// props
Expand Down Expand Up @@ -55,7 +51,13 @@ class UserCard extends React.Component {
clearableValue: group.groupName !== SecurityUtils.USER_GROUP_ALL
}));
};

customValueRenderer = (option) => {
return ( <OverlayTrigger
placement="top"
overlay={<Tooltip id={`tooltip-${option.value}`}>{option.label}</Tooltip>}
><div className="Select-value-label" data-tip={option.label}> {option.label}</div>
</OverlayTrigger>);
};
renderGroupsSelector = () => {
return (<Select key="groupSelector"
clearable={false}
Expand All @@ -66,6 +68,8 @@ class UserCard extends React.Component {
options={this.getOptions()}
onChange={this.onChange}
style={{marginTop: "10px"}}
// * NOTE: valueRenderer: is responsible for custom rendering for shown selected values in react-select version 1.3.0
valueRenderer={this.customValueRenderer}
/>);
};

Expand Down

0 comments on commit e54232d

Please sign in to comment.