feature: add team creation & project deletion

This commit is contained in:
Jordan Knott
2020-06-20 17:49:11 -05:00
parent 5c3afaba7c
commit fd7c006b73
27 changed files with 1590 additions and 98 deletions

View File

@ -1,22 +1,47 @@
import React, { useState, useContext } from 'react';
import TopNavbar from 'shared/components/TopNavbar';
import DropdownMenu, { ProfileMenu } from 'shared/components/DropdownMenu';
import ProjectSettings from 'shared/components/ProjectSettings';
import ProjectSettings, { DeleteProject } from 'shared/components/ProjectSettings';
import { useHistory } from 'react-router';
import UserIDContext from 'App/context';
import { useMeQuery } from 'shared/generated/graphql';
import { useMeQuery, useDeleteProjectMutation, GetProjectsDocument } from 'shared/generated/graphql';
import { usePopup, Popup } from 'shared/components/PopupMenu';
import produce from 'immer';
type GlobalTopNavbarProps = {
projectID: string | null;
name: string | null;
projectMembers?: null | Array<TaskUser>;
onSaveProjectName?: (projectName: string) => void;
};
const GlobalTopNavbar: React.FC<GlobalTopNavbarProps> = ({ name, projectMembers, onSaveProjectName }) => {
const GlobalTopNavbar: React.FC<GlobalTopNavbarProps> = ({ projectID, name, projectMembers, onSaveProjectName }) => {
const { loading, data } = useMeQuery();
const { showPopup, hidePopup } = usePopup();
const { showPopup, hidePopup, setTab } = usePopup();
const history = useHistory();
const { userID, setUserID } = useContext(UserIDContext);
const [deleteProject] = useDeleteProjectMutation({
update: (client, deleteData) => {
const cacheData: any = client.readQuery({
query: GetProjectsDocument,
});
console.log(cacheData);
console.log(deleteData);
const newData = produce(cacheData, (draftState: any) => {
draftState.projects = draftState.projects.filter(
(project: any) => project.id !== deleteData.data.deleteProject.project.id,
);
});
client.writeQuery({
query: GetProjectsDocument,
data: {
...newData,
},
});
},
});
const onLogout = () => {
fetch('http://localhost:3333/auth/logout', {
method: 'POST',
@ -49,9 +74,27 @@ const GlobalTopNavbar: React.FC<GlobalTopNavbarProps> = ({ name, projectMembers,
const onOpenSettings = ($target: React.RefObject<HTMLElement>) => {
showPopup(
$target,
<Popup title={null} tab={0}>
<ProjectSettings />
</Popup>,
<>
<Popup title={null} tab={0}>
<ProjectSettings
onDeleteProject={() => {
setTab(1, 325);
}}
/>
</Popup>
<Popup title={`Delete the "${name}" project?`} tab={1}>
<DeleteProject
name={name ?? ''}
onDeleteProject={() => {
if (projectID) {
deleteProject({ variables: { projectID } });
hidePopup();
history.push('/projects');
}
}}
/>
</Popup>
</>,
185,
);
};

View File

@ -50,7 +50,7 @@ const Projects = () => {
}
}}
/>
<GlobalTopNavbar onSaveProjectName={() => {}} name={null} />
<GlobalTopNavbar projectID={null} onSaveProjectName={() => {}} name={null} />
{!loading && data && (
<Settings
profile={data.me.profileIcon}

View File

@ -472,7 +472,7 @@ const Project = () => {
if (loading) {
return (
<>
<GlobalTopNavbar onSaveProjectName={projectName => {}} name="" />
<GlobalTopNavbar onSaveProjectName={projectName => {}} name="" projectID={null} />
</>
);
}
@ -510,6 +510,7 @@ const Project = () => {
updateProjectName({ variables: { projectID, name: projectName } });
}}
projectMembers={data.findProject.members}
projectID={projectID}
name={data.findProject.name}
/>
<ProjectBar>

View File

@ -1,32 +1,183 @@
import React, { useState, useContext, useEffect } from 'react';
import styled from 'styled-components/macro';
import GlobalTopNavbar from 'App/TopNavbar';
import { useGetProjectsQuery, useCreateProjectMutation, GetProjectsDocument } from 'shared/generated/graphql';
import {
useCreateTeamMutation,
useGetProjectsQuery,
useCreateProjectMutation,
GetProjectsDocument,
} from 'shared/generated/graphql';
import ProjectGridItem, { AddProjectItem } from 'shared/components/ProjectGridItem';
import { Link } from 'react-router-dom';
import Navbar from 'App/Navbar';
import NewProject from 'shared/components/NewProject';
import UserIDContext from 'App/context';
import Button from 'shared/components/Button';
import { usePopup, Popup } from 'shared/components/PopupMenu';
import { useForm } from 'react-hook-form';
import Input from 'shared/components/Input';
const MainContent = styled.div`
padding: 0 0 50px 80px;
height: 100%;
background: #262c49;
const CreateTeamButton = styled(Button)`
width: 100%;
`;
type CreateTeamData = { teamName: string };
type CreateTeamFormProps = {
onCreateTeam: (teamName: string) => void;
};
const CreateTeamFormContainer = styled.form``;
const CreateTeamForm: React.FC<CreateTeamFormProps> = ({ onCreateTeam }) => {
const { register, handleSubmit, errors } = useForm<CreateTeamData>();
const createTeam = (data: CreateTeamData) => {
onCreateTeam(data.teamName);
};
return (
<CreateTeamFormContainer onSubmit={handleSubmit(createTeam)}>
<Input
width="100%"
label="Team name"
id="teamName"
name="teamName"
variant="alternate"
ref={register({ required: 'Team name is required' })}
/>
<CreateTeamButton type="submit">Create</CreateTeamButton>
</CreateTeamFormContainer>
);
};
const ProjectAddTile = styled.div`
background-color: rgba(${props => props.theme.colors.bg.primary}, 0.4);
background-size: cover;
background-position: 50%;
color: #fff;
line-height: 20px;
padding: 8px;
position: relative;
text-decoration: none;
border-radius: 3px;
display: block;
`;
const ProjectTile = styled(Link)<{ color: string }>`
background-color: ${props => props.color};
background-size: cover;
background-position: 50%;
color: #fff;
line-height: 20px;
padding: 8px;
position: relative;
text-decoration: none;
border-radius: 3px;
display: block;
`;
const ProjectTileFade = styled.div`
background-color: rgba(0, 0, 0, 0.15);
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
`;
const ProjectListItem = styled.li`
width: 23.5%;
padding: 0;
margin: 0 2% 2% 0;
box-sizing: border-box;
position: relative;
cursor: pointer;
&:hover ${ProjectTileFade} {
background-color: rgba(0, 0, 0, 0.25);
}
`;
const ProjectList = styled.ul`
display: flex;
flex-wrap: wrap;
& ${ProjectListItem}:nth-of-type(4n) {
margin-right: 0;
}
`;
const ProjectTileDetails = styled.div`
display: flex;
height: 80px;
position: relative;
flex-direction: column;
justify-content: space-between;
`;
const ProjectAddTileDetails = styled.div`
display: flex;
height: 80px;
position: relative;
flex-direction: column;
align-items: center;
justify-content: center;
`;
const ProjectTileName = styled.div<{ centered?: boolean }>`
flex: 0 0 auto;
font-size: 16px;
font-weight: 700;
display: inline-block;
overflow: hidden;
max-height: 40px;
width: 100%;
word-wrap: break-word;
${props => props.centered && 'text-align: center;'}
`;
const Wrapper = styled.div`
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: center;
`;
const ProjectSectionTitleWrapper = styled.div`
align-items: center;
display: flex;
height: 32px;
margin-bottom: 24px;
padding: 8px 0;
position: relative;
`;
const ProjectSectionTitle = styled.h3`
font-size: 16px;
color: rgba(${props => props.theme.colors.text.primary});
`;
const ProjectsContainer = styled.div`
margin: 40px 16px 0;
width: 100%;
max-width: 825px;
min-width: 288px;
`;
const ProjectGrid = styled.div`
width: 60%;
max-width: 780px;
margin: 25px auto;
display: grid;
grid-template-columns: 240px 240px 240px;
gap: 20px 10px;
`;
const AddTeamButton = styled(Button)`
padding: 6px 12px;
float: right;
`;
const ProjectLink = styled(Link)``;
const Projects = () => {
const { showPopup } = usePopup();
const { loading, data } = useGetProjectsQuery();
useEffect(() => {
document.title = 'Citadel';
@ -53,6 +204,7 @@ const Projects = () => {
});
const [showNewProject, setShowNewProject] = useState(false);
const { userID, setUserID } = useContext(UserIDContext);
const [createTeam] = useCreateTeamMutation();
if (loading) {
return (
<>
@ -60,39 +212,91 @@ const Projects = () => {
</>
);
}
const colors = ['#e362e3', '#7a6ff0', '#37c5ab', '#aa62e3', '#e8384f'];
if (data) {
const { projects, teams } = data;
const { projects, teams, organizations } = data;
const organizationID = organizations[0].id ?? null;
const projectTeams = teams.map(team => {
return {
id: team.id,
name: team.name,
projects: projects.filter(project => project.team.id === team.id),
};
});
return (
<>
<GlobalTopNavbar onSaveProjectName={() => {}} name={null} />
<ProjectGrid>
{projects.map(project => (
<ProjectLink key={project.id} to={`/projects/${project.id}`}>
<ProjectGridItem
project={{ ...project, projectID: project.id, teamTitle: project.team.name, taskGroups: [] }}
<GlobalTopNavbar onSaveProjectName={() => {}} projectID={null} name={null} />
<Wrapper>
<ProjectsContainer>
<AddTeamButton
variant="outline"
onClick={$target => {
showPopup(
$target,
<Popup title="Create team" tab={0}>
<CreateTeamForm
onCreateTeam={teamName => {
if (organizationID) {
createTeam({ variables: { name: teamName, organizationID } });
}
}}
/>
</Popup>,
);
}}
>
Add Team
</AddTeamButton>
{projectTeams.map(team => {
return (
<div key={team.id}>
<ProjectSectionTitleWrapper>
<ProjectSectionTitle>{team.name}</ProjectSectionTitle>
</ProjectSectionTitleWrapper>
<ProjectList>
{team.projects.map((project, idx) => (
<ProjectListItem key={project.id}>
<ProjectTile color={colors[idx % 5]} to={`/projects/${project.id}`}>
<ProjectTileFade />
<ProjectTileDetails>
<ProjectTileName>{project.name}</ProjectTileName>
</ProjectTileDetails>
</ProjectTile>
</ProjectListItem>
))}
<ProjectListItem>
<ProjectAddTile
onClick={() => {
setShowNewProject(true);
}}
>
<ProjectTileFade />
<ProjectAddTileDetails>
<ProjectTileName centered>Create new project</ProjectTileName>
</ProjectAddTileDetails>
</ProjectAddTile>
</ProjectListItem>
</ProjectList>
</div>
);
})}
{showNewProject && (
<NewProject
onCreateProject={(name, teamID) => {
if (userID) {
createProject({ variables: { teamID, name, userID } });
setShowNewProject(false);
}
}}
onClose={() => {
setShowNewProject(false);
}}
teams={teams}
/>
</ProjectLink>
))}
<AddProjectItem
onAddProject={() => {
setShowNewProject(true);
}}
/>
</ProjectGrid>
{showNewProject && (
<NewProject
onCreateProject={(name, teamID) => {
if (userID) {
createProject({ variables: { teamID, name, userID } });
setShowNewProject(false);
}
}}
onClose={() => {
setShowNewProject(false);
}}
teams={teams}
/>
)}
)}
</ProjectsContainer>
</Wrapper>
</>
);
}

View File

@ -11,7 +11,7 @@ const InputWrapper = styled.div<{ width: string }>`
justify-content: center;
margin-bottom: 2.2rem;
margin-top: 17px;
margin-top: 24px;
`;
const InputLabel = styled.span<{ width: string }>`

View File

@ -1,4 +1,5 @@
import styled from 'styled-components';
import Button from 'shared/components/Button';
export const Wrapper = styled.div`
background: #eff2f7;
@ -70,21 +71,7 @@ export const FormError = styled.span`
color: rgb(234, 84, 85);
`;
export const LoginButton = styled.input`
padding: 0.75rem 2rem;
font-size: 1rem;
border-radius: 6px;
background: var(--color-button-background);
outline: none;
border: none;
cursor: pointer;
color: var(--color-button-text-hover);
&:disabled {
opacity: 0.5;
cursor: default;
pointer-events: none;
}
`;
export const LoginButton = styled(Button)``;
export const ActionButtons = styled.div`
margin-top: 17.5px;
@ -92,15 +79,7 @@ export const ActionButtons = styled.div`
justify-content: space-between;
`;
export const RegisterButton = styled.button`
padding: 0.679rem 2rem;
border-radius: 6px;
border: 1px solid rgb(115, 103, 240);
background: transparent;
font-size: 1rem;
color: var(--color-primary);
cursor: pointer;
`;
export const RegisterButton = styled(Button)``;
export const LogoTitle = styled.div`
font-size: 24px;

View File

@ -72,8 +72,10 @@ const Login = ({ onSubmit }: LoginProps) => {
{errors.password && <FormError>{errors.password.message}</FormError>}
<ActionButtons>
<RegisterButton>Register</RegisterButton>
<LoginButton type="submit" value="Login" disabled={!isComplete} />
<RegisterButton variant="outline">Register</RegisterButton>
<LoginButton type="submit" disabled={!isComplete}>
Login
</LoginButton>
</ActionButtons>
</Form>
</LoginFormContainer>

View File

@ -16,7 +16,7 @@ import {
type PopupContextState = {
show: (target: RefObject<HTMLElement>, content: JSX.Element, width?: string | number) => void;
setTab: (newTab: number) => void;
setTab: (newTab: number, width?: number | string) => void;
getCurrentTab: () => number;
hide: () => void;
};
@ -139,12 +139,14 @@ export const PopupProvider: React.FC = ({ children }) => {
};
const portalTarget = canUseDOM ? document.body : null; // appease flow
const setTab = (newTab: number) => {
const setTab = (newTab: number, width?: number | string) => {
let newWidth = width ?? currentState.width;
setState((prevState: PopupState) => {
return {
...prevState,
previousTab: currentState.currentTab,
currentTab: newTab,
width: newWidth,
};
});
};

View File

@ -1,6 +1,7 @@
import React from 'react';
import styled from 'styled-components';
import Button from 'shared/components/Button';
export const ListActionsWrapper = styled.ul`
list-style-type: none;
@ -36,16 +37,64 @@ export const ListSeparator = styled.hr`
width: 100%;
`;
type Props = {};
const ProjectSettings: React.FC<Props> = () => {
type Props = {
onDeleteProject: () => void;
};
const ProjectSettings: React.FC<Props> = ({ onDeleteProject }) => {
return (
<>
<ListActionsWrapper>
<ListActionItemWrapper onClick={() => {}}>
<ListActionItemWrapper onClick={() => onDeleteProject()}>
<ListActionItem>Delete Project</ListActionItem>
</ListActionItemWrapper>
</ListActionsWrapper>
</>
);
};
const ConfirmWrapper = styled.div``;
const ConfirmSubTitle = styled.h3`
font-size: 14px;
`;
const ConfirmDescription = styled.div`
font-size: 14px;
`;
const DeleteList = styled.ul`
margin-bottom: 12px;
`;
const DeleteListItem = styled.li`
padding: 6px 0;
list-style: disc;
margin-left: 12px;
`;
const ConfirmDeleteButton = styled(Button)`
width: 100%;
padding: 6px 12px;
`;
type DeleteProjectProps = {
name: string;
onDeleteProject: () => void;
};
const DeleteProject: React.FC<DeleteProjectProps> = ({ name, onDeleteProject }) => {
return (
<ConfirmWrapper>
<ConfirmDescription>
Deleting the project will also delete the following:
<DeleteList>
<DeleteListItem>Task groups and tasks</DeleteListItem>
</DeleteList>
</ConfirmDescription>
<ConfirmDeleteButton onClick={() => onDeleteProject()} color="danger">
Delete
</ConfirmDeleteButton>
</ConfirmWrapper>
);
};
export { DeleteProject };
export default ProjectSettings;

View File

@ -78,6 +78,7 @@ export type Team = {
id: Scalars['ID'];
createdAt: Scalars['Time'];
name: Scalars['String'];
members: Array<ProjectMember>;
};
export type Project = {
@ -145,8 +146,15 @@ export type FindTask = {
taskID: Scalars['UUID'];
};
export type Organization = {
__typename?: 'Organization';
id: Scalars['ID'];
name: Scalars['String'];
};
export type Query = {
__typename?: 'Query';
organizations: Array<Organization>;
users: Array<UserAccount>;
findUser: UserAccount;
findProject: Project;
@ -192,7 +200,7 @@ export type NewUserAccount = {
export type NewTeam = {
name: Scalars['String'];
organizationID: Scalars['String'];
organizationID: Scalars['UUID'];
};
export type NewProject = {
@ -390,13 +398,36 @@ export type UpdateTaskChecklistItemName = {
name: Scalars['String'];
};
export type CreateTeamMember = {
userID: Scalars['UUID'];
teamID: Scalars['UUID'];
};
export type CreateTeamMemberPayload = {
__typename?: 'CreateTeamMemberPayload';
team: Team;
teamMember: ProjectMember;
};
export type DeleteProject = {
projectID: Scalars['UUID'];
};
export type DeleteProjectPayload = {
__typename?: 'DeleteProjectPayload';
ok: Scalars['Boolean'];
project: Project;
};
export type Mutation = {
__typename?: 'Mutation';
createRefreshToken: RefreshToken;
createUserAccount: UserAccount;
createTeam: Team;
clearProfileAvatar: UserAccount;
createTeamMember: CreateTeamMemberPayload;
createProject: Project;
deleteProject: DeleteProjectPayload;
updateProjectName: Project;
createProjectLabel: ProjectLabel;
deleteProjectLabel: ProjectLabel;
@ -443,11 +474,21 @@ export type MutationCreateTeamArgs = {
};
export type MutationCreateTeamMemberArgs = {
input: CreateTeamMember;
};
export type MutationCreateProjectArgs = {
input: NewProject;
};
export type MutationDeleteProjectArgs = {
input: DeleteProject;
};
export type MutationUpdateProjectNameArgs = {
input?: Maybe<UpdateProjectName>;
};
@ -869,7 +910,10 @@ export type GetProjectsQueryVariables = {};
export type GetProjectsQuery = (
{ __typename?: 'Query' }
& { teams: Array<(
& { organizations: Array<(
{ __typename?: 'Organization' }
& Pick<Organization, 'id' | 'name'>
)>, teams: Array<(
{ __typename?: 'Team' }
& Pick<Team, 'id' | 'name' | 'createdAt'>
)>, projects: Array<(
@ -897,6 +941,23 @@ export type MeQuery = (
) }
);
export type DeleteProjectMutationVariables = {
projectID: Scalars['UUID'];
};
export type DeleteProjectMutation = (
{ __typename?: 'Mutation' }
& { deleteProject: (
{ __typename?: 'DeleteProjectPayload' }
& Pick<DeleteProjectPayload, 'ok'>
& { project: (
{ __typename?: 'Project' }
& Pick<Project, 'id'>
) }
) }
);
export type CreateTaskChecklistItemMutationVariables = {
taskChecklistID: Scalars['UUID'];
name: Scalars['String'];
@ -985,6 +1046,20 @@ export type UpdateTaskGroupNameMutation = (
) }
);
export type CreateTeamMutationVariables = {
name: Scalars['String'];
organizationID: Scalars['UUID'];
};
export type CreateTeamMutation = (
{ __typename?: 'Mutation' }
& { createTeam: (
{ __typename?: 'Team' }
& Pick<Team, 'id' | 'createdAt' | 'name'>
) }
);
export type ToggleTaskLabelMutationVariables = {
taskID: Scalars['UUID'];
projectLabelID: Scalars['UUID'];
@ -1690,6 +1765,10 @@ export type FindTaskLazyQueryHookResult = ReturnType<typeof useFindTaskLazyQuery
export type FindTaskQueryResult = ApolloReactCommon.QueryResult<FindTaskQuery, FindTaskQueryVariables>;
export const GetProjectsDocument = gql`
query getProjects {
organizations {
id
name
}
teams {
id
name
@ -1768,6 +1847,41 @@ export function useMeLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptio
export type MeQueryHookResult = ReturnType<typeof useMeQuery>;
export type MeLazyQueryHookResult = ReturnType<typeof useMeLazyQuery>;
export type MeQueryResult = ApolloReactCommon.QueryResult<MeQuery, MeQueryVariables>;
export const DeleteProjectDocument = gql`
mutation deleteProject($projectID: UUID!) {
deleteProject(input: {projectID: $projectID}) {
ok
project {
id
}
}
}
`;
export type DeleteProjectMutationFn = ApolloReactCommon.MutationFunction<DeleteProjectMutation, DeleteProjectMutationVariables>;
/**
* __useDeleteProjectMutation__
*
* To run a mutation, you first call `useDeleteProjectMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useDeleteProjectMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [deleteProjectMutation, { data, loading, error }] = useDeleteProjectMutation({
* variables: {
* projectID: // value for 'projectID'
* },
* });
*/
export function useDeleteProjectMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<DeleteProjectMutation, DeleteProjectMutationVariables>) {
return ApolloReactHooks.useMutation<DeleteProjectMutation, DeleteProjectMutationVariables>(DeleteProjectDocument, baseOptions);
}
export type DeleteProjectMutationHookResult = ReturnType<typeof useDeleteProjectMutation>;
export type DeleteProjectMutationResult = ApolloReactCommon.MutationResult<DeleteProjectMutation>;
export type DeleteProjectMutationOptions = ApolloReactCommon.BaseMutationOptions<DeleteProjectMutation, DeleteProjectMutationVariables>;
export const CreateTaskChecklistItemDocument = gql`
mutation createTaskChecklistItem($taskChecklistID: UUID!, $name: String!, $position: Float!) {
createTaskChecklistItem(input: {taskChecklistID: $taskChecklistID, name: $name, position: $position}) {
@ -1980,6 +2094,41 @@ export function useUpdateTaskGroupNameMutation(baseOptions?: ApolloReactHooks.Mu
export type UpdateTaskGroupNameMutationHookResult = ReturnType<typeof useUpdateTaskGroupNameMutation>;
export type UpdateTaskGroupNameMutationResult = ApolloReactCommon.MutationResult<UpdateTaskGroupNameMutation>;
export type UpdateTaskGroupNameMutationOptions = ApolloReactCommon.BaseMutationOptions<UpdateTaskGroupNameMutation, UpdateTaskGroupNameMutationVariables>;
export const CreateTeamDocument = gql`
mutation createTeam($name: String!, $organizationID: UUID!) {
createTeam(input: {name: $name, organizationID: $organizationID}) {
id
createdAt
name
}
}
`;
export type CreateTeamMutationFn = ApolloReactCommon.MutationFunction<CreateTeamMutation, CreateTeamMutationVariables>;
/**
* __useCreateTeamMutation__
*
* To run a mutation, you first call `useCreateTeamMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useCreateTeamMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [createTeamMutation, { data, loading, error }] = useCreateTeamMutation({
* variables: {
* name: // value for 'name'
* organizationID: // value for 'organizationID'
* },
* });
*/
export function useCreateTeamMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<CreateTeamMutation, CreateTeamMutationVariables>) {
return ApolloReactHooks.useMutation<CreateTeamMutation, CreateTeamMutationVariables>(CreateTeamDocument, baseOptions);
}
export type CreateTeamMutationHookResult = ReturnType<typeof useCreateTeamMutation>;
export type CreateTeamMutationResult = ApolloReactCommon.MutationResult<CreateTeamMutation>;
export type CreateTeamMutationOptions = ApolloReactCommon.BaseMutationOptions<CreateTeamMutation, CreateTeamMutationVariables>;
export const ToggleTaskLabelDocument = gql`
mutation toggleTaskLabel($taskID: UUID!, $projectLabelID: UUID!) {
toggleTaskLabel(input: {taskID: $taskID, projectLabelID: $projectLabelID}) {

View File

@ -1,4 +1,8 @@
query getProjects {
organizations {
id
name
}
teams {
id
name

View File

@ -0,0 +1,14 @@
import gql from 'graphql-tag';
export const DELETE_PROJECT_MUTATION = gql`
mutation deleteProject($projectID: UUID!) {
deleteProject(input: { projectID: $projectID }) {
ok
project {
id
}
}
}
`;
export default DELETE_PROJECT_MUTATION;

View File

@ -0,0 +1,13 @@
import gql from 'graphql-tag';
export const CREATE_TEAM_MUTATION = gql`
mutation createTeam($name: String!, $organizationID: UUID!) {
createTeam(input: { name: $name, organizationID: $organizationID }) {
id
createdAt
name
}
}
`;
export default CREATE_TEAM_MUTATION;