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

pavanswaroop-added-role-icons-reduced-header-searcheditor-tablecolumn-widths #3276

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
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
23 changes: 22 additions & 1 deletion src/components/UserManagement/UserTableData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import { boxStyle } from '../../styles';
import { formatDateLocal } from '../../utils/formatDate';
import { cantUpdateDevAdminDetails } from '../../utils/permissions';
import { formatDate, formatDateYYYYMMDD } from '../../utils/formatDate';

import { faUser, faUsers, faShieldAlt, faBriefcase, faUserTie, faCrown, faChalkboardTeacher, faBug, faGlobe, faStar } from '@fortawesome/free-solid-svg-icons';
import { UncontrolledTooltip } from 'reactstrap';
/**
* The body row of the user table
*/
Expand Down Expand Up @@ -67,6 +70,18 @@ const UserTableData = React.memo(props => {
const togglePauseTooltip = () => setTooltipPause(!tooltipPauseOpen);
const toggleFinalDayTooltip = () => setTooltipFinalDay(!tooltipFinalDayOpen);
const toggleReportsTooltip = () => setTooltipReports(!tooltipReportsOpen);
const roleIcons = {
Volunteer: faUser,
'Core Team': faUsers,
Administrator: faShieldAlt,
'Assistant Manager': faUserTie,
Owner: faCrown,
Mentor: faChalkboardTeacher,
Manager: faBriefcase,
TestRole: faBug,
General: faGlobe,
Creator: faStar,
};

/**
* reset the changing state upon rerender with new isActive status
Expand Down Expand Up @@ -229,10 +244,16 @@ const UserTableData = React.memo(props => {
</td>
<td id="usermanagement_role">
{editUser?.role && roles !== undefined ? (
formData.role
<>
<FontAwesomeIcon id={`role-icon-${props.index}`} icon={roleIcons[formData.role] || faUser} />
<UncontrolledTooltip placement="top" target={`role-icon-${props.index}`}>
{formData.role}
</UncontrolledTooltip>
</>
) : (
<select
id=""
style={{ width: '100px'}}
value={formData.role}
onChange={e => {
updateFormData({ ...formData, role: e.target.value });
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserManagement/UserTableSearchHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const UserTableSearchHeader = React.memo(props => {
/>
</td>
<td id="user_role">
<DropDownSearchBox className={darkMode ? 'bg-darkmode-liblack border-0 text-light' : ''} id="role_search" items={props.roles} searchCallback={onRoleSearch} />
<DropDownSearchBox width= "100px" className={darkMode ? 'bg-darkmode-liblack border-0 text-light' : ''} id="role_search" items={props.roles} searchCallback={onRoleSearch} />
</td>
<td id="user_title">
<div>
Expand Down
11 changes: 8 additions & 3 deletions src/components/UserManagement/usermanagement.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,18 @@ thead {
#usermanagement_role,
#user_role,
td#usermanagement_role {
width: 100px;
max-width: 180px;
width: 125px !important;
max-width: 125px !important;
min-width:125px !important;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
white-space: nowrap;
}

td#usermanagement_role svg {
font-size: 14px; /* Ensures icon fits within 20px */
}

#user_role{
max-width: initial;
}
Expand Down