Skip to content

Commit 7ecab5d

Browse files
committed
Copying user external IDs into clipboard on click.
1 parent 871290d commit 7ecab5d

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/components/Users/UsersName/UsersName.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
33
import { Link } from 'react-router-dom';
44
import { OverlayTrigger, Popover, Tooltip } from 'react-bootstrap';
55
import { FormattedMessage } from 'react-intl';
6+
import { CopyToClipboard } from 'react-copy-to-clipboard';
67
import { defaultMemoize } from 'reselect';
78

89
import AvatarContainer from '../../../containers/AvatarContainer/AvatarContainer';
@@ -129,10 +130,34 @@ const UsersName = ({
129130
))}
130131
</tbody>
131132
</table>
133+
<small className="text-muted">
134+
(
135+
<FormattedMessage
136+
id="app.userName.externalIdsClickInfo"
137+
defaultMessage="click to copy the ID(s) to clipboard"
138+
/>
139+
)
140+
</small>
132141
</Popover.Content>
133142
</Popover>
134143
}>
135-
<Icon icon={['far', 'id-card']} gapLeft className="text-muted half-opaque" />
144+
<CopyToClipboard
145+
text={Object.values(externalIds)
146+
.map(id => (Array.isArray(id) ? id.join(', ') : id))
147+
.join(', ')}>
148+
<Icon
149+
icon={['far', 'id-card']}
150+
gapLeft
151+
className="text-muted half-opaque clickable"
152+
style={{ '--fa-beat-scale': 1.5, '--fa-animation-duration': '0.3s' }}
153+
onClick={ev => {
154+
const style = 'fa-beat';
155+
const icon = ev.currentTarget;
156+
icon.classList.add(style);
157+
window.setTimeout(() => icon.classList.remove(style), 300);
158+
}}
159+
/>
160+
</CopyToClipboard>
136161
</OverlayTrigger>
137162
)}
138163
{privateData && privateData.email && showEmail === 'icon' && (

src/locales/cs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,6 +1940,7 @@
19401940
"app.user.title": "Uživatelův profil",
19411941
"app.userList.noUsers": "Žádní uživatelé nevyhovují zvoleným filtrům.",
19421942
"app.userName.externalIds": "Externí identifikátory",
1943+
"app.userName.externalIdsClickInfo": "klikutím zkopírujete ID do schránky",
19431944
"app.userName.userDeactivated": "Uživatelský účet byl deaktivován. Uživatel se nemůže přihlásit.",
19441945
"app.userSwitching.loginAs": "Přihlásit jako",
19451946
"app.users.createUser": "Vytvořit uživatele",

src/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,6 +1940,7 @@
19401940
"app.user.title": "User's profile",
19411941
"app.userList.noUsers": "No users match selected filters.",
19421942
"app.userName.externalIds": "External identifiers",
1943+
"app.userName.externalIdsClickInfo": "click to copy the ID(s) to clipboard",
19431944
"app.userName.userDeactivated": "The user account was deactivated. The user may not sign in.",
19441945
"app.userSwitching.loginAs": "Login as",
19451946
"app.users.createUser": "Create User",

0 commit comments

Comments
 (0)