This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from habralab/feat/manage-project-teams
feat/manage-project-teams
- Loading branch information
Showing
67 changed files
with
1,112 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
1 change: 1 addition & 0 deletions
1
common/client/entrypoints/renderer/src/pages/projects/[id]/teams/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from '@app/project-teams-page' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...n/client/fragments/project-profile-fragment/src/button-invite/button-invite.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react' | ||
import { FC } from 'react' | ||
import { FormattedMessage } from 'react-intl' | ||
import { useState } from 'react' | ||
|
||
import { ModalInviteToProject } from '@shared/modals-fragment' | ||
import { Button } from '@ui/button' | ||
import { Text } from '@ui/text' | ||
|
||
import { ButtonInviteProps } from './button-invite.interfaces' | ||
|
||
export const ButtonInvite: FC<ButtonInviteProps> = ({ project }) => { | ||
const [modalOpen, setModalOpen] = useState(false) | ||
|
||
const toggleModalOpen = () => setModalOpen(!modalOpen) | ||
|
||
return ( | ||
<> | ||
<Button variant='primary' size='normal' onClick={toggleModalOpen}> | ||
<Text fontSize='medium' color='currentColor'> | ||
<FormattedMessage id='profile.send_request' /> | ||
</Text> | ||
</Button> | ||
<ModalInviteToProject | ||
modalOpen={modalOpen} | ||
onClose={toggleModalOpen} | ||
invitedProjectId={project?.id} | ||
/> | ||
</> | ||
) | ||
} |
5 changes: 5 additions & 0 deletions
5
...n/client/fragments/project-profile-fragment/src/button-invite/button-invite.interfaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Project } from '@shared/data' | ||
|
||
export interface ButtonInviteProps { | ||
project?: Project | ||
} |
2 changes: 2 additions & 0 deletions
2
common/client/fragments/project-profile-fragment/src/button-invite/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './button-invite.component' | ||
export * from './button-invite.interfaces' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ export interface ProfileTeamsProps { | |
ownerUser?: User | ||
teams: Team[] | ||
isMyProject: boolean | ||
projectId: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
common/client/fragments/project-teams-fragment/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "@app/project-teams-fragment", | ||
"version": "0.0.1", | ||
"main": "src/index.ts", | ||
"dependencies": { | ||
"@shared/data": "workspace:0.0.1", | ||
"@shared/routes": "workspace:0.0.1", | ||
"@shared/utils": "workspace:0.0.1", | ||
"@ui/avatar": "workspace:0.0.1", | ||
"@ui/button": "workspace:0.0.1", | ||
"@ui/card": "workspace:0.0.1", | ||
"@ui/condition": "workspace:0.0.1", | ||
"@ui/layout": "workspace:0.0.1", | ||
"@ui/tag": "workspace:0.0.1", | ||
"@ui/text": "workspace:0.0.1", | ||
"@ui/title": "workspace:0.0.1", | ||
"@ui/wrapper": "workspace:0.0.1" | ||
}, | ||
"devDependencies": { | ||
"@apollo/client": "3.8.7", | ||
"@stores/session": "workspace:0.0.1", | ||
"@types/react": "18.2.28", | ||
"@types/react-dom": "18.2.15", | ||
"next": "12.3.4", | ||
"react-intl": "6.0.8" | ||
}, | ||
"peerDependencies": { | ||
"@emotion/css": "*", | ||
"@emotion/react": "*", | ||
"@emotion/styled": "*", | ||
"@stores/session": "workspace:*", | ||
"framer-motion": "*", | ||
"graphql": "*", | ||
"next": "*", | ||
"react": "*", | ||
"react-dom": "*", | ||
"react-intl": "*", | ||
"styled-system": "*", | ||
"styled-tools": "*" | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...nt/src/data/decide-project-team-join-request/decide-project-team-join-request.mutation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export const DECIDE_PROJECT_TEAM_JOIN_REQUEST = gql` | ||
mutation ProjectTeamJoinRequestDecide($id: String!, $approve: Boolean!) { | ||
projectTeamJoinRequestDecide(input: { projectTeamJoinRequestId: $id, isApproved: $approve }) { | ||
id | ||
teamId | ||
teamName | ||
projectId | ||
} | ||
} | ||
` |
1 change: 1 addition & 0 deletions
1
...lient/fragments/project-teams-fragment/src/data/decide-project-team-join-request/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './use-decide-project-team-join-request.hook' |
26 changes: 26 additions & 0 deletions
26
...nt/src/data/decide-project-team-join-request/use-decide-project-team-join-request.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { useMutation } from '@apollo/client' | ||
|
||
import { JoinRequest } from '@shared/data' | ||
|
||
import { DECIDE_PROJECT_TEAM_JOIN_REQUEST } from './decide-project-team-join-request.mutation' | ||
|
||
export interface DecideProjectTeamJoinRequestResponse { | ||
id?: string | ||
teamId?: string | ||
teamName?: string | ||
projectId?: string | ||
} | ||
|
||
export interface DecideProjectTeamJoinRequestInput { | ||
id: JoinRequest['id'] | ||
approve: boolean | ||
} | ||
|
||
export const useDecideProjectTeamJoinRequest = () => { | ||
const [decideProjectTeamJoinRequest, { data, loading }] = useMutation< | ||
DecideProjectTeamJoinRequestResponse, | ||
DecideProjectTeamJoinRequestInput | ||
>(DECIDE_PROJECT_TEAM_JOIN_REQUEST) | ||
|
||
return { decideProjectTeamJoinRequest, data, loading } | ||
} |
18 changes: 18 additions & 0 deletions
18
...nt/fragments/project-teams-fragment/src/data/get-join-requests/get-join-requests.query.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export const GET_JOIN_REQUESTS = gql` | ||
query ProjectTeamJoinRequestsByProjectId($id: String!) { | ||
projectTeamJoinRequestsByProjectId(input: { projectId: $id }) { | ||
projectTeamJoinRequest { | ||
id | ||
projectId | ||
teamId | ||
teamName | ||
teamDescription | ||
teamAvatarUrl | ||
projectCount | ||
teamUserParticipants | ||
} | ||
} | ||
} | ||
` |
1 change: 1 addition & 0 deletions
1
common/client/fragments/project-teams-fragment/src/data/get-join-requests/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './use-get-join-requests.hook' |
36 changes: 36 additions & 0 deletions
36
...fragments/project-teams-fragment/src/data/get-join-requests/use-get-join-requests.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { useQuery } from '@apollo/client' | ||
|
||
import { Project } from '@shared/data' | ||
|
||
import { GET_JOIN_REQUESTS } from './get-join-requests.query' | ||
|
||
export interface JoinRequest { | ||
id?: string | ||
projectId?: string | ||
teamId?: string | ||
teamName?: string | ||
teamDescription?: string | ||
teamAvatarUrl?: string | ||
projectCount?: number | ||
teamUserParticipants?: number | ||
} | ||
|
||
export interface GetJoinRequestsResponse { | ||
projectTeamJoinRequest: JoinRequest[] | ||
} | ||
|
||
export interface GetJoinRequestsInput { | ||
id: Project['id'] | ||
} | ||
|
||
export const useGetJoinRequests = (props: GetJoinRequestsInput) => { | ||
const { data, refetch } = useQuery<GetJoinRequestsResponse, GetJoinRequestsInput>( | ||
GET_JOIN_REQUESTS, | ||
{ variables: props } | ||
) | ||
|
||
return { | ||
joinRequests: data?.projectTeamJoinRequest || [], | ||
refetch, | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
common/client/fragments/project-teams-fragment/src/data/get-project/get-project.query.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export const GET_PROJECT = gql` | ||
query ProjectGet($id: String!) { | ||
projectGet(projectId: $id) { | ||
id | ||
projectName | ||
description | ||
avatarUrl | ||
tags | ||
ownerUserId | ||
} | ||
projectTeamParticipantsFilter(input: { projectId: $id }) { | ||
projectTeamParticipant { | ||
id | ||
} | ||
} | ||
} | ||
` |
1 change: 1 addition & 0 deletions
1
common/client/fragments/project-teams-fragment/src/data/get-project/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './use-get-project.hook' |
29 changes: 29 additions & 0 deletions
29
common/client/fragments/project-teams-fragment/src/data/get-project/use-get-project.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useQuery } from '@apollo/client' | ||
|
||
import { Team } from '@shared/data' | ||
import { Project } from '@shared/data' | ||
|
||
import { GET_PROJECT } from './get-project.query' | ||
|
||
export interface GetProjectResponse { | ||
projectGet: Project | ||
projectTeamParticipantsFilter: { | ||
projectTeamParticipant: Team[] | ||
} | ||
} | ||
|
||
export interface GetProjectInput { | ||
id: Project['id'] | ||
} | ||
|
||
export const useGetProject = (props: GetProjectInput) => { | ||
const { data, refetch } = useQuery<GetProjectResponse, GetProjectInput>(GET_PROJECT, { | ||
variables: props, | ||
}) | ||
|
||
return { | ||
project: data?.projectGet, | ||
projectTeams: data?.projectTeamParticipantsFilter.projectTeamParticipant || [], | ||
refetch, | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
common/client/fragments/project-teams-fragment/src/data/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './decide-project-team-join-request' | ||
export * from './get-join-requests' | ||
export * from './get-project' |
1 change: 1 addition & 0 deletions
1
common/client/fragments/project-teams-fragment/src/hooks/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './use-project-state.hook' |
Oops, something went wrong.