feat: add task activity
This commit is contained in:
@ -182,7 +182,7 @@ const AdminRoute = () => {
|
||||
updateApolloCache<UsersQuery>(client, UsersDocument, cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.invitedUsers = cache.invitedUsers.filter(
|
||||
u => u.id !== response.data.deleteInvitedUserAccount.invitedUser.id,
|
||||
u => u.id !== response.data?.deleteInvitedUserAccount.invitedUser.id,
|
||||
);
|
||||
}),
|
||||
);
|
||||
@ -192,7 +192,7 @@ const AdminRoute = () => {
|
||||
update: (client, response) => {
|
||||
updateApolloCache<UsersQuery>(client, UsersDocument, cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.users = cache.users.filter(u => u.id !== response.data.deleteUserAccount.userAccount.id);
|
||||
draftCache.users = cache.users.filter(u => u.id !== response.data?.deleteUserAccount.userAccount.id);
|
||||
}),
|
||||
);
|
||||
},
|
||||
@ -203,7 +203,7 @@ const AdminRoute = () => {
|
||||
query: UsersDocument,
|
||||
});
|
||||
const newData = produce(cacheData, (draftState: any) => {
|
||||
draftState.users = [...draftState.users, { ...createData.data.createUserAccount }];
|
||||
draftState.users = [...draftState.users, { ...createData.data?.createUserAccount }];
|
||||
});
|
||||
|
||||
client.writeQuery({
|
||||
|
@ -25,6 +25,11 @@ const MainContent = styled.div`
|
||||
flex-grow: 1;
|
||||
`;
|
||||
|
||||
type RefreshTokenResponse = {
|
||||
accessToken: string;
|
||||
setup?: null | { confirmToken: string };
|
||||
};
|
||||
|
||||
const AuthorizedRoutes = () => {
|
||||
const history = useHistory();
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
@ -167,7 +167,7 @@ const ProjectFinder = () => {
|
||||
return <span>error</span>;
|
||||
};
|
||||
type ProjectPopupProps = {
|
||||
history: History<History.PoorMansUnknown>;
|
||||
history: any;
|
||||
name: string;
|
||||
projectID: string;
|
||||
};
|
||||
@ -182,7 +182,7 @@ export const ProjectPopup: React.FC<ProjectPopupProps> = ({ history, name, proje
|
||||
|
||||
const newData = produce(cacheData, (draftState: any) => {
|
||||
draftState.projects = draftState.projects.filter(
|
||||
(project: any) => project.id !== deleteData.data.deleteProject.project.id,
|
||||
(project: any) => project.id !== deleteData.data?.deleteProject.project.id,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -46,10 +46,6 @@ const StyledContainer = styled(ToastContainer).attrs({
|
||||
`;
|
||||
|
||||
const history = createBrowserHistory();
|
||||
type RefreshTokenResponse = {
|
||||
accessToken: string;
|
||||
isInstalled: boolean;
|
||||
};
|
||||
|
||||
const App = () => {
|
||||
const [user, setUser] = useState<CurrentUserRaw | null>(null);
|
||||
|
@ -280,7 +280,7 @@ const ProjectBoard: React.FC<ProjectBoardProps> = ({ projectID, onCardLabelClick
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findProject.taskGroups = draftCache.findProject.taskGroups.filter(
|
||||
(taskGroup: TaskGroup) => taskGroup.id !== deletedTaskGroupData.data.deleteTaskGroup.taskGroup.id,
|
||||
(taskGroup: TaskGroup) => taskGroup.id !== deletedTaskGroupData.data?.deleteTaskGroup.taskGroup.id,
|
||||
);
|
||||
}),
|
||||
{ projectID },
|
||||
@ -296,9 +296,11 @@ const ProjectBoard: React.FC<ProjectBoardProps> = ({ projectID, onCardLabelClick
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
const { taskGroups } = cache.findProject;
|
||||
const idx = taskGroups.findIndex(taskGroup => taskGroup.id === newTaskData.data.createTask.taskGroup.id);
|
||||
const idx = taskGroups.findIndex(taskGroup => taskGroup.id === newTaskData.data?.createTask.taskGroup.id);
|
||||
if (idx !== -1) {
|
||||
draftCache.findProject.taskGroups[idx].tasks.push({ ...newTaskData.data.createTask });
|
||||
if (newTaskData.data) {
|
||||
draftCache.findProject.taskGroups[idx].tasks.push({ ...newTaskData.data.createTask });
|
||||
}
|
||||
}
|
||||
}),
|
||||
{ projectID },
|
||||
@ -313,7 +315,9 @@ const ProjectBoard: React.FC<ProjectBoardProps> = ({ projectID, onCardLabelClick
|
||||
FindProjectDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findProject.taskGroups.push({ ...newTaskGroupData.data.createTaskGroup, tasks: [] });
|
||||
if (newTaskGroupData.data) {
|
||||
draftCache.findProject.taskGroups.push({ ...newTaskGroupData.data.createTaskGroup, tasks: [] });
|
||||
}
|
||||
}),
|
||||
{ projectID },
|
||||
);
|
||||
@ -332,7 +336,7 @@ const ProjectBoard: React.FC<ProjectBoardProps> = ({ projectID, onCardLabelClick
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
const idx = cache.findProject.taskGroups.findIndex(
|
||||
t => t.id === resp.data.deleteTaskGroupTasks.taskGroupID,
|
||||
t => t.id === resp.data?.deleteTaskGroupTasks.taskGroupID,
|
||||
);
|
||||
if (idx !== -1) {
|
||||
draftCache.findProject.taskGroups[idx].tasks = [];
|
||||
@ -348,7 +352,9 @@ const ProjectBoard: React.FC<ProjectBoardProps> = ({ projectID, onCardLabelClick
|
||||
FindProjectDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findProject.taskGroups.push(resp.data.duplicateTaskGroup.taskGroup);
|
||||
if (resp.data) {
|
||||
draftCache.findProject.taskGroups.push(resp.data.duplicateTaskGroup.taskGroup);
|
||||
}
|
||||
}),
|
||||
{ projectID },
|
||||
);
|
||||
@ -364,19 +370,24 @@ const ProjectBoard: React.FC<ProjectBoardProps> = ({ projectID, onCardLabelClick
|
||||
FindProjectDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
const { previousTaskGroupID, task } = newTask.data.updateTaskLocation;
|
||||
if (previousTaskGroupID !== task.taskGroup.id) {
|
||||
const { taskGroups } = cache.findProject;
|
||||
const oldTaskGroupIdx = taskGroups.findIndex((t: TaskGroup) => t.id === previousTaskGroupID);
|
||||
const newTaskGroupIdx = taskGroups.findIndex((t: TaskGroup) => t.id === task.taskGroup.id);
|
||||
if (oldTaskGroupIdx !== -1 && newTaskGroupIdx !== -1) {
|
||||
draftCache.findProject.taskGroups[oldTaskGroupIdx].tasks = taskGroups[oldTaskGroupIdx].tasks.filter(
|
||||
(t: Task) => t.id !== task.id,
|
||||
);
|
||||
draftCache.findProject.taskGroups[newTaskGroupIdx].tasks = [
|
||||
...taskGroups[newTaskGroupIdx].tasks,
|
||||
{ ...task },
|
||||
];
|
||||
if (newTask.data) {
|
||||
const { previousTaskGroupID, task } = newTask.data.updateTaskLocation;
|
||||
if (previousTaskGroupID !== task.taskGroup.id) {
|
||||
const { taskGroups } = cache.findProject;
|
||||
const oldTaskGroupIdx = taskGroups.findIndex((t: TaskGroup) => t.id === previousTaskGroupID);
|
||||
const newTaskGroupIdx = taskGroups.findIndex((t: TaskGroup) => t.id === task.taskGroup.id);
|
||||
if (oldTaskGroupIdx !== -1 && newTaskGroupIdx !== -1) {
|
||||
const previousTask = cache.findProject.taskGroups[oldTaskGroupIdx].tasks.find(t => t.id === task.id);
|
||||
draftCache.findProject.taskGroups[oldTaskGroupIdx].tasks = taskGroups[oldTaskGroupIdx].tasks.filter(
|
||||
(t: Task) => t.id !== task.id,
|
||||
);
|
||||
if (previousTask) {
|
||||
draftCache.findProject.taskGroups[newTaskGroupIdx].tasks = [
|
||||
...taskGroups[newTaskGroupIdx].tasks,
|
||||
{ ...previousTask },
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
@ -138,21 +138,23 @@ const Details: React.FC<DetailsProps> = ({
|
||||
FindTaskDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
const { prevChecklistID, checklistID, checklistItem } = response.data.updateTaskChecklistItemLocation;
|
||||
if (checklistID !== prevChecklistID) {
|
||||
const oldIdx = cache.findTask.checklists.findIndex(c => c.id === prevChecklistID);
|
||||
const newIdx = cache.findTask.checklists.findIndex(c => c.id === checklistID);
|
||||
if (oldIdx > -1 && newIdx > -1) {
|
||||
const item = cache.findTask.checklists[oldIdx].items.find(i => i.id === checklistItem.id);
|
||||
if (item) {
|
||||
draftCache.findTask.checklists[oldIdx].items = cache.findTask.checklists[oldIdx].items.filter(
|
||||
i => i.id !== checklistItem.id,
|
||||
);
|
||||
draftCache.findTask.checklists[newIdx].items.push({
|
||||
...item,
|
||||
position: checklistItem.position,
|
||||
taskChecklistID: checklistID,
|
||||
});
|
||||
if (response.data) {
|
||||
const { prevChecklistID, taskChecklistID, checklistItem } = response.data.updateTaskChecklistItemLocation;
|
||||
if (taskChecklistID !== prevChecklistID) {
|
||||
const oldIdx = cache.findTask.checklists.findIndex(c => c.id === prevChecklistID);
|
||||
const newIdx = cache.findTask.checklists.findIndex(c => c.id === taskChecklistID);
|
||||
if (oldIdx > -1 && newIdx > -1) {
|
||||
const item = cache.findTask.checklists[oldIdx].items.find(i => i.id === checklistItem.id);
|
||||
if (item) {
|
||||
draftCache.findTask.checklists[oldIdx].items = cache.findTask.checklists[oldIdx].items.filter(
|
||||
i => i.id !== checklistItem.id,
|
||||
);
|
||||
draftCache.findTask.checklists[newIdx].items.push({
|
||||
...item,
|
||||
position: checklistItem.position,
|
||||
taskChecklistID: taskChecklistID,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,7 +190,7 @@ const Details: React.FC<DetailsProps> = ({
|
||||
produce(cache, draftCache => {
|
||||
const { checklists } = cache.findTask;
|
||||
draftCache.findTask.checklists = checklists.filter(
|
||||
c => c.id !== deleteData.data.deleteTaskChecklist.taskChecklist.id,
|
||||
c => c.id !== deleteData.data?.deleteTaskChecklist.taskChecklist.id,
|
||||
);
|
||||
const { complete, total } = calculateChecklistBadge(draftCache.findTask.checklists);
|
||||
draftCache.findTask.badges.checklist = {
|
||||
@ -212,8 +214,10 @@ const Details: React.FC<DetailsProps> = ({
|
||||
FindTaskDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
const item = createData.data.createTaskChecklist;
|
||||
draftCache.findTask.checklists.push({ ...item });
|
||||
if (createData.data) {
|
||||
const item = createData.data.createTaskChecklist;
|
||||
draftCache.findTask.checklists.push({ ...item });
|
||||
}
|
||||
}),
|
||||
{ taskID },
|
||||
);
|
||||
@ -227,36 +231,14 @@ const Details: React.FC<DetailsProps> = ({
|
||||
FindTaskDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
const item = deleteData.data.deleteTaskChecklistItem.taskChecklistItem;
|
||||
const targetIdx = cache.findTask.checklists.findIndex(c => c.id === item.taskChecklistID);
|
||||
if (targetIdx > -1) {
|
||||
draftCache.findTask.checklists[targetIdx].items = cache.findTask.checklists[targetIdx].items.filter(
|
||||
c => item.id !== c.id,
|
||||
);
|
||||
}
|
||||
const { complete, total } = calculateChecklistBadge(draftCache.findTask.checklists);
|
||||
draftCache.findTask.badges.checklist = {
|
||||
__typename: 'ChecklistBadge',
|
||||
complete,
|
||||
total,
|
||||
};
|
||||
}),
|
||||
{ taskID },
|
||||
);
|
||||
},
|
||||
});
|
||||
const [createTaskChecklistItem] = useCreateTaskChecklistItemMutation({
|
||||
update: (client, newTaskItem) => {
|
||||
updateApolloCache<FindTaskQuery>(
|
||||
client,
|
||||
FindTaskDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
const item = newTaskItem.data.createTaskChecklistItem;
|
||||
const { checklists } = cache.findTask;
|
||||
const idx = checklists.findIndex(c => c.id === item.taskChecklistID);
|
||||
if (idx !== -1) {
|
||||
draftCache.findTask.checklists[idx].items.push({ ...item });
|
||||
if (deleteData.data) {
|
||||
const item = deleteData.data.deleteTaskChecklistItem.taskChecklistItem;
|
||||
const targetIdx = cache.findTask.checklists.findIndex(c => c.id === item.taskChecklistID);
|
||||
if (targetIdx > -1) {
|
||||
draftCache.findTask.checklists[targetIdx].items = cache.findTask.checklists[targetIdx].items.filter(
|
||||
c => item.id !== c.id,
|
||||
);
|
||||
}
|
||||
const { complete, total } = calculateChecklistBadge(draftCache.findTask.checklists);
|
||||
draftCache.findTask.badges.checklist = {
|
||||
__typename: 'ChecklistBadge',
|
||||
@ -269,7 +251,33 @@ const Details: React.FC<DetailsProps> = ({
|
||||
);
|
||||
},
|
||||
});
|
||||
const { loading, data, refetch } = useFindTaskQuery({ variables: { taskID } });
|
||||
const [createTaskChecklistItem] = useCreateTaskChecklistItemMutation({
|
||||
update: (client, newTaskItem) => {
|
||||
updateApolloCache<FindTaskQuery>(
|
||||
client,
|
||||
FindTaskDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
if (newTaskItem.data) {
|
||||
const item = newTaskItem.data.createTaskChecklistItem;
|
||||
const { checklists } = cache.findTask;
|
||||
const idx = checklists.findIndex(c => c.id === item.taskChecklistID);
|
||||
if (idx !== -1) {
|
||||
draftCache.findTask.checklists[idx].items.push({ ...item });
|
||||
const { complete, total } = calculateChecklistBadge(draftCache.findTask.checklists);
|
||||
draftCache.findTask.badges.checklist = {
|
||||
__typename: 'ChecklistBadge',
|
||||
complete,
|
||||
total,
|
||||
};
|
||||
}
|
||||
}
|
||||
}),
|
||||
{ taskID },
|
||||
);
|
||||
},
|
||||
});
|
||||
const { loading, data, refetch } = useFindTaskQuery({ variables: { taskID }, fetchPolicy: 'cache-and-network' });
|
||||
const [setTaskComplete] = useSetTaskCompleteMutation();
|
||||
const [updateTaskDueDate] = useUpdateTaskDueDateMutation({
|
||||
onCompleted: () => {
|
||||
|
@ -36,7 +36,9 @@ const LabelManagerEditor: React.FC<LabelManagerEditorProps> = ({
|
||||
FindProjectDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findProject.labels.push({ ...newLabelData.data.createProjectLabel });
|
||||
if (newLabelData.data) {
|
||||
draftCache.findProject.labels.push({ ...newLabelData.data.createProjectLabel });
|
||||
}
|
||||
}),
|
||||
{
|
||||
projectID,
|
||||
@ -53,7 +55,7 @@ const LabelManagerEditor: React.FC<LabelManagerEditorProps> = ({
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findProject.labels = cache.findProject.labels.filter(
|
||||
label => label.id !== newLabelData.data.deleteProjectLabel.id,
|
||||
label => label.id !== newLabelData.data?.deleteProjectLabel.id,
|
||||
);
|
||||
}),
|
||||
{ projectID },
|
||||
|
@ -32,7 +32,6 @@ import {
|
||||
FindProjectDocument,
|
||||
FindProjectQuery,
|
||||
} from 'shared/generated/graphql';
|
||||
|
||||
import produce from 'immer';
|
||||
import UserContext, { useCurrentUser } from 'App/context';
|
||||
import Input from 'shared/components/Input';
|
||||
@ -423,14 +422,16 @@ const Project = () => {
|
||||
FindProjectDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
const taskGroupIdx = draftCache.findProject.taskGroups.findIndex(
|
||||
tg => tg.tasks.findIndex(t => t.id === resp.data.deleteTask.taskID) !== -1,
|
||||
);
|
||||
if (resp.data) {
|
||||
const taskGroupIdx = draftCache.findProject.taskGroups.findIndex(
|
||||
tg => tg.tasks.findIndex(t => t.id === resp.data?.deleteTask.taskID) !== -1,
|
||||
);
|
||||
|
||||
if (taskGroupIdx !== -1) {
|
||||
draftCache.findProject.taskGroups[taskGroupIdx].tasks = cache.findProject.taskGroups[
|
||||
taskGroupIdx
|
||||
].tasks.filter(t => t.id !== resp.data.deleteTask.taskID);
|
||||
if (taskGroupIdx !== -1) {
|
||||
draftCache.findProject.taskGroups[taskGroupIdx].tasks = cache.findProject.taskGroups[
|
||||
taskGroupIdx
|
||||
].tasks.filter(t => t.id !== resp.data?.deleteTask.taskID);
|
||||
}
|
||||
}
|
||||
}),
|
||||
{ projectID },
|
||||
@ -450,7 +451,7 @@ const Project = () => {
|
||||
FindProjectDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findProject.name = newName.data.updateProjectName.name;
|
||||
draftCache.findProject.name = newName.data?.updateProjectName.name ?? '';
|
||||
}),
|
||||
{ projectID },
|
||||
);
|
||||
@ -464,14 +465,16 @@ const Project = () => {
|
||||
FindProjectDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findProject.members = [
|
||||
...cache.findProject.members,
|
||||
...response.data.inviteProjectMembers.members,
|
||||
];
|
||||
draftCache.findProject.invitedMembers = [
|
||||
...cache.findProject.invitedMembers,
|
||||
...response.data.inviteProjectMembers.invitedMembers,
|
||||
];
|
||||
if (response.data) {
|
||||
draftCache.findProject.members = [
|
||||
...cache.findProject.members,
|
||||
...response.data.inviteProjectMembers.members,
|
||||
];
|
||||
draftCache.findProject.invitedMembers = [
|
||||
...cache.findProject.invitedMembers,
|
||||
...response.data.inviteProjectMembers.invitedMembers,
|
||||
];
|
||||
}
|
||||
}),
|
||||
{ projectID },
|
||||
);
|
||||
@ -485,7 +488,7 @@ const Project = () => {
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findProject.invitedMembers = cache.findProject.invitedMembers.filter(
|
||||
m => m.email !== response.data.deleteInvitedProjectMember.invitedMember.email,
|
||||
m => m.email !== response.data?.deleteInvitedProjectMember.invitedMember.email ?? '',
|
||||
);
|
||||
}),
|
||||
{ projectID },
|
||||
@ -500,7 +503,7 @@ const Project = () => {
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findProject.members = cache.findProject.members.filter(
|
||||
m => m.id !== response.data.deleteProjectMember.member.id,
|
||||
m => m.id !== response.data?.deleteProjectMember.member.id,
|
||||
);
|
||||
}),
|
||||
{ projectID },
|
||||
|
@ -210,7 +210,9 @@ const Projects = () => {
|
||||
update: (client, newProject) => {
|
||||
updateApolloCache<GetProjectsQuery>(client, GetProjectsDocument, cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.projects.push({ ...newProject.data.createProject });
|
||||
if (newProject.data) {
|
||||
draftCache.projects.push({ ...newProject.data.createProject });
|
||||
}
|
||||
}),
|
||||
);
|
||||
},
|
||||
@ -222,7 +224,9 @@ const Projects = () => {
|
||||
update: (client, createData) => {
|
||||
updateApolloCache<GetProjectsQuery>(client, GetProjectsDocument, cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.teams.push({ ...createData.data.createTeam });
|
||||
if (createData.data) {
|
||||
draftCache.teams.push({ ...createData.data?.createTeam });
|
||||
}
|
||||
}),
|
||||
);
|
||||
},
|
||||
|
@ -430,11 +430,13 @@ const Members: React.FC<MembersProps> = ({ teamID }) => {
|
||||
GetTeamDocument,
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findTeam.members.push({
|
||||
...response.data.createTeamMember.teamMember,
|
||||
member: { __typename: 'MemberList', projects: [], teams: [] },
|
||||
owned: { __typename: 'OwnedList', projects: [], teams: [] },
|
||||
});
|
||||
if (response.data) {
|
||||
draftCache.findTeam.members.push({
|
||||
...response.data.createTeamMember.teamMember,
|
||||
member: { __typename: 'MemberList', projects: [], teams: [] },
|
||||
owned: { __typename: 'OwnedList', projects: [], teams: [] },
|
||||
});
|
||||
}
|
||||
}),
|
||||
{ teamID },
|
||||
);
|
||||
@ -459,7 +461,7 @@ const Members: React.FC<MembersProps> = ({ teamID }) => {
|
||||
cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.findTeam.members = cache.findTeam.members.filter(
|
||||
member => member.id !== response.data.deleteTeamMember.userID,
|
||||
member => member.id !== response.data?.deleteTeamMember.userID,
|
||||
);
|
||||
}),
|
||||
{ teamID },
|
||||
|
@ -33,7 +33,7 @@ const Wrapper = styled.div`
|
||||
`;
|
||||
|
||||
type TeamPopupProps = {
|
||||
history: History<History.PoorMansUnknown>;
|
||||
history: History<any>;
|
||||
name: string;
|
||||
teamID: string;
|
||||
};
|
||||
@ -44,9 +44,9 @@ export const TeamPopup: React.FC<TeamPopupProps> = ({ history, name, teamID }) =
|
||||
update: (client, deleteData) => {
|
||||
updateApolloCache<GetProjectsQuery>(client, GetProjectsDocument, cache =>
|
||||
produce(cache, draftCache => {
|
||||
draftCache.teams = cache.teams.filter((team: any) => team.id !== deleteData.data.deleteTeam.team.id);
|
||||
draftCache.teams = cache.teams.filter((team: any) => team.id !== deleteData.data?.deleteTeam.team.id);
|
||||
draftCache.projects = cache.projects.filter(
|
||||
(project: any) => project.team.id !== deleteData.data.deleteTeam.team.id,
|
||||
(project: any) => project.team.id !== deleteData.data?.deleteTeam.team.id,
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
@ -263,7 +263,7 @@ const NewProject: React.FC<NewProjectProps> = ({ initialTeamID, teams, onClose,
|
||||
onChange={(e: any) => {
|
||||
setTeam(e.value);
|
||||
}}
|
||||
value={options.filter(d => d.value === team)}
|
||||
value={options.find(d => d.value === team)}
|
||||
styles={colourStyles}
|
||||
classNamePrefix="teamSelect"
|
||||
options={options}
|
||||
|
@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { TaskActivityData, ActivityType } from 'shared/generated/graphql';
|
||||
|
||||
type ActivityMessageProps = {
|
||||
type: ActivityType;
|
||||
data: Array<TaskActivityData>;
|
||||
};
|
||||
|
||||
function getVariable(data: Array<TaskActivityData>, name: string) {
|
||||
const target = data.find(d => d.name === name);
|
||||
return target ? target.value : null;
|
||||
}
|
||||
|
||||
const ActivityMessage: React.FC<ActivityMessageProps> = ({ type, data }) => {
|
||||
switch (type) {
|
||||
case ActivityType.TaskAdded:
|
||||
return <>`added this task to ${getVariable(data, 'TaskGroup')}`</>;
|
||||
}
|
||||
return <h1>hello</h1>;
|
||||
};
|
||||
|
||||
export default ActivityMessage;
|
@ -537,25 +537,26 @@ export const ActivityItem = styled.div`
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
display: flex;
|
||||
`;
|
||||
|
||||
export const ActivityItemHeader = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 8px;
|
||||
`;
|
||||
export const ActivityItemHeaderUser = styled(TaskAssignee)`
|
||||
margin-right: 4px;
|
||||
`;
|
||||
export const ActivityItemHeaderUser = styled(TaskAssignee)``;
|
||||
|
||||
export const ActivityItemHeaderTitle = styled.div`
|
||||
margin-left: 4px;
|
||||
line-height: 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: ${props => props.theme.colors.text.primary};
|
||||
padding-bottom: 2px;
|
||||
`;
|
||||
|
||||
export const ActivityItemHeaderTitleName = styled.span`
|
||||
color: ${props => props.theme.colors.text.primary};
|
||||
font-weight: 500;
|
||||
padding-right: 2px;
|
||||
`;
|
||||
|
||||
export const ActivityItemTimestamp = styled.span<{ margin: number }>`
|
||||
|
@ -19,8 +19,12 @@ import styled from 'styled-components';
|
||||
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import ActivityMessage from './ActivityMessage';
|
||||
import Task from 'shared/icons/Task';
|
||||
import {
|
||||
ActivityItemHeader,
|
||||
ActivityItemTimestamp,
|
||||
ActivityItem,
|
||||
TaskDetailLabel,
|
||||
CommentContainer,
|
||||
MetaDetailContent,
|
||||
@ -67,9 +71,13 @@ import {
|
||||
CommentInnerWrapper,
|
||||
ActivitySection,
|
||||
TaskDetailsEditor,
|
||||
ActivityItemHeaderUser,
|
||||
ActivityItemHeaderTitle,
|
||||
ActivityItemHeaderTitleName,
|
||||
} from './Styles';
|
||||
import Checklist, { ChecklistItem, ChecklistItems } from '../Checklist';
|
||||
import onDragEnd from './onDragEnd';
|
||||
import TaskAssignee from 'shared/components/TaskAssignee';
|
||||
|
||||
const ChecklistContainer = styled.div``;
|
||||
|
||||
@ -425,7 +433,36 @@ const TaskDetails: React.FC<TaskDetailsProps> = ({
|
||||
<TabBarSection>
|
||||
<TabBarItem>Activity</TabBarItem>
|
||||
</TabBarSection>
|
||||
<ActivitySection />
|
||||
<ActivitySection>
|
||||
{task.activity &&
|
||||
task.activity.map(activity => (
|
||||
<ActivityItem>
|
||||
<ActivityItemHeaderUser
|
||||
size={32}
|
||||
member={{
|
||||
id: activity.causedBy.id,
|
||||
fullName: activity.causedBy.fullName,
|
||||
profileIcon: activity.causedBy.profileIcon
|
||||
? activity.causedBy.profileIcon
|
||||
: {
|
||||
url: null,
|
||||
initials: activity.causedBy.fullName.charAt(0),
|
||||
bgColor: '#fff',
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<ActivityItemHeader>
|
||||
<ActivityItemHeaderTitle>
|
||||
<ActivityItemHeaderTitleName>{activity.causedBy.fullName}</ActivityItemHeaderTitleName>
|
||||
<ActivityMessage type={activity.type} data={activity.data} />
|
||||
</ActivityItemHeaderTitle>
|
||||
<ActivityItemTimestamp margin={0}>
|
||||
{dayjs(activity.createdAt).format('MMM D [at] h:mm A')}
|
||||
</ActivityItemTimestamp>
|
||||
</ActivityItemHeader>
|
||||
</ActivityItem>
|
||||
))}
|
||||
</ActivitySection>
|
||||
</InnerContentContainer>
|
||||
<CommentContainer>
|
||||
{me && (
|
||||
|
@ -168,6 +168,41 @@ export type TaskBadges = {
|
||||
checklist?: Maybe<ChecklistBadge>;
|
||||
};
|
||||
|
||||
export type CausedBy = {
|
||||
__typename?: 'CausedBy';
|
||||
id: Scalars['ID'];
|
||||
fullName: Scalars['String'];
|
||||
profileIcon?: Maybe<ProfileIcon>;
|
||||
};
|
||||
|
||||
export type TaskActivityData = {
|
||||
__typename?: 'TaskActivityData';
|
||||
name: Scalars['String'];
|
||||
value: Scalars['String'];
|
||||
};
|
||||
|
||||
export enum ActivityType {
|
||||
TaskAdded = 'TASK_ADDED',
|
||||
TaskMoved = 'TASK_MOVED',
|
||||
TaskMarkedComplete = 'TASK_MARKED_COMPLETE',
|
||||
TaskMarkedIncomplete = 'TASK_MARKED_INCOMPLETE',
|
||||
TaskDueDateChanged = 'TASK_DUE_DATE_CHANGED',
|
||||
TaskDueDateAdded = 'TASK_DUE_DATE_ADDED',
|
||||
TaskDueDateRemoved = 'TASK_DUE_DATE_REMOVED',
|
||||
TaskChecklistChanged = 'TASK_CHECKLIST_CHANGED',
|
||||
TaskChecklistAdded = 'TASK_CHECKLIST_ADDED',
|
||||
TaskChecklistRemoved = 'TASK_CHECKLIST_REMOVED'
|
||||
}
|
||||
|
||||
export type TaskActivity = {
|
||||
__typename?: 'TaskActivity';
|
||||
id: Scalars['ID'];
|
||||
type: ActivityType;
|
||||
data: Array<TaskActivityData>;
|
||||
causedBy: CausedBy;
|
||||
createdAt: Scalars['Time'];
|
||||
};
|
||||
|
||||
export type Task = {
|
||||
__typename?: 'Task';
|
||||
id: Scalars['ID'];
|
||||
@ -183,6 +218,7 @@ export type Task = {
|
||||
labels: Array<TaskLabel>;
|
||||
checklists: Array<TaskChecklist>;
|
||||
badges: TaskBadges;
|
||||
activity: Array<TaskActivity>;
|
||||
};
|
||||
|
||||
export type Organization = {
|
||||
@ -209,6 +245,11 @@ export type TaskChecklist = {
|
||||
items: Array<TaskChecklistItem>;
|
||||
};
|
||||
|
||||
export enum ShareStatus {
|
||||
Invited = 'INVITED',
|
||||
Joined = 'JOINED'
|
||||
}
|
||||
|
||||
export enum RoleLevel {
|
||||
Admin = 'ADMIN',
|
||||
Member = 'MEMBER'
|
||||
@ -1050,17 +1091,16 @@ export type DeleteInvitedUserAccountPayload = {
|
||||
};
|
||||
|
||||
export type MemberSearchFilter = {
|
||||
SearchFilter: Scalars['String'];
|
||||
searchFilter: Scalars['String'];
|
||||
projectID?: Maybe<Scalars['UUID']>;
|
||||
};
|
||||
|
||||
export type MemberSearchResult = {
|
||||
__typename?: 'MemberSearchResult';
|
||||
similarity: Scalars['Int'];
|
||||
user: UserAccount;
|
||||
confirmed: Scalars['Boolean'];
|
||||
invited: Scalars['Boolean'];
|
||||
joined: Scalars['Boolean'];
|
||||
id: Scalars['String'];
|
||||
user?: Maybe<UserAccount>;
|
||||
status: ShareStatus;
|
||||
};
|
||||
|
||||
export type UpdateUserInfoPayload = {
|
||||
@ -1344,7 +1384,21 @@ export type FindTaskQuery = (
|
||||
& { taskGroup: (
|
||||
{ __typename?: 'TaskGroup' }
|
||||
& Pick<TaskGroup, 'id' | 'name'>
|
||||
), badges: (
|
||||
), activity: Array<(
|
||||
{ __typename?: 'TaskActivity' }
|
||||
& Pick<TaskActivity, 'id' | 'type' | 'createdAt'>
|
||||
& { causedBy: (
|
||||
{ __typename?: 'CausedBy' }
|
||||
& Pick<CausedBy, 'id' | 'fullName'>
|
||||
& { profileIcon?: Maybe<(
|
||||
{ __typename?: 'ProfileIcon' }
|
||||
& Pick<ProfileIcon, 'initials' | 'bgColor' | 'url'>
|
||||
)> }
|
||||
), data: Array<(
|
||||
{ __typename?: 'TaskActivityData' }
|
||||
& Pick<TaskActivityData, 'name' | 'value'>
|
||||
)> }
|
||||
)>, badges: (
|
||||
{ __typename?: 'TaskBadges' }
|
||||
& { checklist?: Maybe<(
|
||||
{ __typename?: 'ChecklistBadge' }
|
||||
@ -2825,6 +2879,24 @@ export const FindTaskDocument = gql`
|
||||
id
|
||||
name
|
||||
}
|
||||
activity {
|
||||
id
|
||||
type
|
||||
causedBy {
|
||||
id
|
||||
fullName
|
||||
profileIcon {
|
||||
initials
|
||||
bgColor
|
||||
url
|
||||
}
|
||||
}
|
||||
createdAt
|
||||
data {
|
||||
name
|
||||
value
|
||||
}
|
||||
}
|
||||
badges {
|
||||
checklist {
|
||||
total
|
||||
|
@ -10,6 +10,24 @@ query findTask($taskID: UUID!) {
|
||||
id
|
||||
name
|
||||
}
|
||||
activity {
|
||||
id
|
||||
type
|
||||
causedBy {
|
||||
id
|
||||
fullName
|
||||
profileIcon {
|
||||
initials
|
||||
bgColor
|
||||
url
|
||||
}
|
||||
}
|
||||
createdAt
|
||||
data {
|
||||
name
|
||||
value
|
||||
}
|
||||
}
|
||||
badges {
|
||||
checklist {
|
||||
total
|
||||
|
@ -9,7 +9,7 @@ export function updateApolloCache<T>(
|
||||
update: UpdateCacheFn<T>,
|
||||
variables?: object,
|
||||
) {
|
||||
let queryArgs: DataProxy.Query<any>;
|
||||
let queryArgs: DataProxy.Query<any, any>;
|
||||
if (variables) {
|
||||
queryArgs = {
|
||||
query: document,
|
||||
|
33
frontend/src/types.d.ts
vendored
33
frontend/src/types.d.ts
vendored
@ -1,3 +1,10 @@
|
||||
type ProjectLabel = {
|
||||
id: string;
|
||||
createdDate: string;
|
||||
name?: string | null;
|
||||
labelColor: LabelColor;
|
||||
};
|
||||
|
||||
type ProfileIcon = {
|
||||
url?: string | null;
|
||||
initials?: string | null;
|
||||
@ -56,6 +63,24 @@ type TaskBadges = {
|
||||
checklist?: ChecklistBadge | null;
|
||||
};
|
||||
|
||||
type TaskActivityData = {
|
||||
name: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
type CausedBy = {
|
||||
id: string;
|
||||
fullName: string;
|
||||
profileIcon?: null | ProfileIcon;
|
||||
};
|
||||
type TaskActivity = {
|
||||
id: string;
|
||||
type: any;
|
||||
data: Array<TaskActivityData>;
|
||||
causedBy: CausedBy;
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
type Task = {
|
||||
id: string;
|
||||
taskGroup: InnerTaskGroup;
|
||||
@ -69,6 +94,7 @@ type Task = {
|
||||
description?: string | null;
|
||||
assigned?: Array<TaskUser>;
|
||||
checklists?: Array<TaskChecklist> | null;
|
||||
activity?: Array<TaskActivity> | null;
|
||||
};
|
||||
|
||||
type Project = {
|
||||
@ -89,10 +115,3 @@ type Team = {
|
||||
name: string;
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
type ProjectLabel = {
|
||||
id: string;
|
||||
createdDate: string;
|
||||
name?: string | null;
|
||||
labelColor: LabelColor;
|
||||
};
|
||||
|
9102
frontend/yarn.lock
9102
frontend/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user