From d37dae34f2ce176957d359cc9d00fa3ae319376d Mon Sep 17 00:00:00 2001 From: Peter Holmberg Date: Fri, 14 Dec 2018 13:49:14 +0100 Subject: [PATCH] fixing issue with copy invite link --- public/app/features/users/InviteeRow.tsx | 57 +++ .../app/features/users/InviteesTable.test.tsx | 1 - public/app/features/users/InviteesTable.tsx | 41 +- .../app/features/users/UsersListPage.test.tsx | 1 - public/app/features/users/UsersListPage.tsx | 10 +- .../app/features/users/__mocks__/userMocks.ts | 2 +- .../__snapshots__/InviteesTable.test.tsx.snap | 378 ++++++------------ 7 files changed, 184 insertions(+), 306 deletions(-) create mode 100644 public/app/features/users/InviteeRow.tsx diff --git a/public/app/features/users/InviteeRow.tsx b/public/app/features/users/InviteeRow.tsx new file mode 100644 index 00000000000..d75ffb790f3 --- /dev/null +++ b/public/app/features/users/InviteeRow.tsx @@ -0,0 +1,57 @@ +import React, { createRef, PureComponent } from 'react'; +import { connect } from 'react-redux'; +import { Invitee } from 'app/types'; +import { revokeInvite } from './state/actions'; + +export interface Props { + invitee: Invitee; + revokeInvite: typeof revokeInvite; +} + +class InviteeRow extends PureComponent { + private copyUrlRef = createRef(); + + copyToClipboard = () => { + const node = this.copyUrlRef.current; + + if (node) { + node.select(); + document.execCommand('copy'); + } + }; + + render() { + const { invitee, revokeInvite } = this.props; + return ( + + {invitee.email} + {invitee.name} + +