|
|
@@ -6,7 +6,6 @@ import { Popover, PopoverBody } from 'reactstrap';
|
|
|
import styles from './EditingUserList.module.scss';
|
|
|
|
|
|
const userListPopoverClass = styles['user-list-popover'] ?? '';
|
|
|
-const avatarWrapperClass = styles['avatar-wrapper'] ?? '';
|
|
|
|
|
|
type Props = {
|
|
|
clientList: EditingClient[];
|
|
|
@@ -18,15 +17,16 @@ const AvatarWrapper: FC<{
|
|
|
onUserClick?: (clientId: number) => void;
|
|
|
}> = ({ client, onUserClick }) => {
|
|
|
return (
|
|
|
- <button
|
|
|
- type="button"
|
|
|
- data-testid={`avatar-wrapper-${client.clientId}`}
|
|
|
- className={`${avatarWrapperClass} d-inline-flex align-items-center justify-content-center p-0 bg-transparent rounded-circle`}
|
|
|
- style={{ border: `2px solid ${client.color}` }}
|
|
|
- onClick={() => onUserClick?.(client.clientId)}
|
|
|
- >
|
|
|
- <UserPicture user={client} noLink />
|
|
|
- </button>
|
|
|
+ <UserPicture
|
|
|
+ user={client}
|
|
|
+ noLink
|
|
|
+ testId={`avatar-wrapper-${client.clientId}`}
|
|
|
+ rootClassName="d-flex rounded-circle"
|
|
|
+ rootStyle={{ border: `2px solid ${client.color}` }}
|
|
|
+ onClick={
|
|
|
+ onUserClick != null ? () => onUserClick(client.clientId) : undefined
|
|
|
+ }
|
|
|
+ />
|
|
|
);
|
|
|
};
|
|
|
|
|
|
@@ -44,48 +44,46 @@ export const EditingUserList: FC<Props> = ({ clientList, onUserClick }) => {
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
- <div className="d-flex flex-column justify-content-start justify-content-sm-end">
|
|
|
- <div className="d-flex justify-content-start justify-content-sm-end">
|
|
|
- {firstFourUsers.map((editingClient) => (
|
|
|
- <div key={editingClient.clientId} className="ms-1">
|
|
|
- <AvatarWrapper client={editingClient} onUserClick={onUserClick} />
|
|
|
- </div>
|
|
|
- ))}
|
|
|
+ <div className="d-flex">
|
|
|
+ {firstFourUsers.map((editingClient) => (
|
|
|
+ <div key={editingClient.clientId} className="ms-1">
|
|
|
+ <AvatarWrapper client={editingClient} onUserClick={onUserClick} />
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
|
|
|
- {remainingUsers.length > 0 && (
|
|
|
- <div className="ms-1">
|
|
|
- <button
|
|
|
- type="button"
|
|
|
- ref={popoverTargetRef}
|
|
|
- className="btn border-0 bg-info-subtle rounded-pill p-0"
|
|
|
- onClick={togglePopover}
|
|
|
- >
|
|
|
- <span className="fw-bold text-info p-1">
|
|
|
- +{remainingUsers.length}
|
|
|
- </span>
|
|
|
- </button>
|
|
|
- <Popover
|
|
|
- placement="bottom"
|
|
|
- isOpen={isPopoverOpen}
|
|
|
- target={popoverTargetRef}
|
|
|
- toggle={togglePopover}
|
|
|
- trigger="legacy"
|
|
|
- >
|
|
|
- <PopoverBody className={userListPopoverClass}>
|
|
|
- <div className="d-flex flex-wrap gap-1">
|
|
|
- {remainingUsers.map((editingClient) => (
|
|
|
- <AvatarWrapper
|
|
|
- key={editingClient.clientId}
|
|
|
- client={editingClient}
|
|
|
- onUserClick={onUserClick}
|
|
|
- />
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- </PopoverBody>
|
|
|
- </Popover>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </div>
|
|
|
+ {remainingUsers.length > 0 && (
|
|
|
+ <div className="ms-1">
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ ref={popoverTargetRef}
|
|
|
+ className="btn border-0 bg-info-subtle rounded-pill p-0"
|
|
|
+ onClick={togglePopover}
|
|
|
+ >
|
|
|
+ <span className="fw-bold text-info p-1">
|
|
|
+ +{remainingUsers.length}
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ <Popover
|
|
|
+ placement="bottom"
|
|
|
+ isOpen={isPopoverOpen}
|
|
|
+ target={popoverTargetRef}
|
|
|
+ toggle={togglePopover}
|
|
|
+ trigger="legacy"
|
|
|
+ >
|
|
|
+ <PopoverBody className={userListPopoverClass}>
|
|
|
+ <div className="d-flex flex-wrap gap-1">
|
|
|
+ {remainingUsers.map((editingClient) => (
|
|
|
+ <AvatarWrapper
|
|
|
+ key={editingClient.clientId}
|
|
|
+ client={editingClient}
|
|
|
+ onUserClick={onUserClick}
|
|
|
+ />
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </PopoverBody>
|
|
|
+ </Popover>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
</div>
|
|
|
);
|
|
|
};
|