From 14caaf298ae02ce6304a04d9d0717c97c9e203e0 Mon Sep 17 00:00:00 2001 From: Emilien Chauvet Date: Tue, 11 Jul 2023 13:35:43 -0700 Subject: [PATCH] Feat/add invite link (#603) * Add UI for invite link * Use invite link * Isolate link component * Improve UX --- front/src/generated/graphql.tsx | 3 +- front/src/modules/users/queries/index.ts | 1 + .../components/WorkspaceInviteLink.tsx | 49 +++++++++++++++++++ .../settings/SettingsWorkspaceMembers.tsx | 17 ++++++- 4 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 front/src/modules/workspace/components/WorkspaceInviteLink.tsx diff --git a/front/src/generated/graphql.tsx b/front/src/generated/graphql.tsx index fc6a5fbcb..2a3f1d5fe 100644 --- a/front/src/generated/graphql.tsx +++ b/front/src/generated/graphql.tsx @@ -3397,7 +3397,7 @@ export type SearchCompanyQuery = { __typename?: 'Query', searchResults: Array<{ export type GetCurrentUserQueryVariables = Exact<{ [key: string]: never; }>; -export type GetCurrentUserQuery = { __typename?: 'Query', currentUser: { __typename?: 'User', id: string, email: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, workspace: { __typename?: 'Workspace', id: string, domainName?: string | null, displayName?: string | null, logo?: string | null } } | null } }; +export type GetCurrentUserQuery = { __typename?: 'Query', currentUser: { __typename?: 'User', id: string, email: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, workspace: { __typename?: 'Workspace', id: string, domainName?: string | null, displayName?: string | null, logo?: string | null, inviteHash?: string | null } } | null } }; export type GetUsersQueryVariables = Exact<{ [key: string]: never; }>; @@ -5051,6 +5051,7 @@ export const GetCurrentUserDocument = gql` domainName displayName logo + inviteHash } } } diff --git a/front/src/modules/users/queries/index.ts b/front/src/modules/users/queries/index.ts index d0d8e2c85..a237ff582 100644 --- a/front/src/modules/users/queries/index.ts +++ b/front/src/modules/users/queries/index.ts @@ -17,6 +17,7 @@ export const GET_CURRENT_USER = gql` domainName displayName logo + inviteHash } } } diff --git a/front/src/modules/workspace/components/WorkspaceInviteLink.tsx b/front/src/modules/workspace/components/WorkspaceInviteLink.tsx new file mode 100644 index 000000000..dc094b354 --- /dev/null +++ b/front/src/modules/workspace/components/WorkspaceInviteLink.tsx @@ -0,0 +1,49 @@ +import { useState } from 'react'; +import { useTheme } from '@emotion/react'; +import styled from '@emotion/styled'; + +import { Button } from '@/ui/components/buttons/Button'; +import { TextInput } from '@/ui/components/inputs/TextInput'; +import { IconCheck, IconLink } from '@/ui/icons'; + +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 OwnProps = { + inviteLink: string; +}; + +export function WorkspaceInviteLink({ inviteLink }: OwnProps) { + const theme = useTheme(); + const [isCopied, setIsCopied] = useState(false); + return ( + + + + +