316f2ec38c
as discussed here https://github.com/twentyhq/twenty/issues/13292#issuecomment-3092215050 with @prastoin - [x] introduce optional message param to `copyToClipboard` method in `useCopyToClipboard` and refactor it across app, as in case if user has disallowed clipboard permission in BROWSER unprotected clipboard access breaks without catch. - [x] Email copied to clipboard - [x] run lingui extract
53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
import styled from '@emotion/styled';
|
|
|
|
import { TextInput } from '@/ui/input/components/TextInput';
|
|
import { useLingui } from '@lingui/react/macro';
|
|
import { IconLink } from 'twenty-ui/display';
|
|
import { Button } from 'twenty-ui/input';
|
|
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
|
|
|
|
const StyledContainer = styled.div`
|
|
align-items: center;
|
|
display: flex;
|
|
flex-direction: row;
|
|
`;
|
|
|
|
const StyledLinkContainer = styled.div`
|
|
flex: 1;
|
|
margin-right: ${({ theme }) => theme.spacing(2)};
|
|
`;
|
|
|
|
type WorkspaceInviteLinkProps = {
|
|
inviteLink: string;
|
|
};
|
|
|
|
export const WorkspaceInviteLink = ({
|
|
inviteLink,
|
|
}: WorkspaceInviteLinkProps) => {
|
|
const { t } = useLingui();
|
|
|
|
const { copyToClipboard } = useCopyToClipboard();
|
|
|
|
return (
|
|
<StyledContainer data-chromatic="ignore">
|
|
<StyledLinkContainer>
|
|
<TextInput
|
|
instanceId="workspace-invite-link"
|
|
value={inviteLink}
|
|
disabled
|
|
fullWidth
|
|
/>
|
|
</StyledLinkContainer>
|
|
<Button
|
|
Icon={IconLink}
|
|
variant="primary"
|
|
accent="blue"
|
|
title={t`Copy link`}
|
|
onClick={() => {
|
|
copyToClipboard(inviteLink, t`Link copied to clipboard`);
|
|
}}
|
|
/>
|
|
</StyledContainer>
|
|
);
|
|
};
|