Skip to content

Commit

Permalink
Merge pull request #2870 from the-deep/feature/bulk-assignments-graphql
Browse files Browse the repository at this point in the history
Implement graphql node to list and update assignment status
  • Loading branch information
shreeyash07 authored Apr 10, 2024
2 parents 1897d51 + ec823dc commit 7b232f3
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 107 deletions.
25 changes: 0 additions & 25 deletions app/types/user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ interface AccessibleFeature {
featureType: 'general_access' | 'experimental' | 'early_access';
}

interface ProjectElement {
id: number;
title: string;
isPrivate: boolean;
}

export interface User {
userId: number;
username: string;
Expand All @@ -26,22 +20,3 @@ export interface UserMini {
email: string;
displayName: string;
}

export interface Assignment {
id: number;
createdAt: string;
projectDetails: ProjectElement;
createdByDetails: {
id: number;
displayName: string;
email: string;
};
contentObjectDetails?: {
id: number;
title: string;
lead?: string;
entry?: string;
} | undefined;
isDone: boolean;
contentObjectType: 'lead' | 'entryreviewcomment' | 'entrycomment';
}
47 changes: 24 additions & 23 deletions app/views/Home/Assignment/AssignmentItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {
DateOutput,
} from '@the-deep/deep-ui';

import { Assignment } from '#types';
import generateString from '#utils/string';
import routes from '#base/configs/routes';

import { Assignment } from '..';
import styles from './styles.css';

interface AssignmentItemProps extends Assignment {
handleClick: (id: number) => void;
handleClick: (id: string) => void;
markAsDonePending: boolean;
}

Expand All @@ -24,10 +24,11 @@ function AssignmentItem(props: AssignmentItemProps) {
id,
handleClick: handleClickFromProps,
markAsDonePending,
createdByDetails,
contentObjectDetails,
contentObjectType,
projectDetails,
createdBy,
leadType,
entryType,
contentType,
project,
createdAt,
} = props;

Expand All @@ -36,26 +37,26 @@ function AssignmentItem(props: AssignmentItemProps) {
}, [id, handleClickFromProps]);

const contentLink = useMemo(() => {
if (contentObjectType === 'lead') {
if (contentType === 'lead') {
return (generateString(
'source {link}',
{
link: (contentObjectDetails?.id && projectDetails?.id && (
link: (leadType?.id && project?.id && (
<Link
to={generatePath(routes.entryEdit.path, {
projectId: projectDetails.id,
leadId: contentObjectDetails.id,
projectId: project?.id,
leadId: leadType?.id,
})}
className={styles.link}
>
{contentObjectDetails.title}
{leadType?.title}
</Link>
)),
},
));
}
if (contentObjectType === 'entryreviewcomment' || contentObjectType === 'entrycomment') {
if (!contentObjectDetails || !projectDetails?.id || !contentObjectDetails?.lead) {
if (contentType === 'entryreviewcomment' || contentType === 'entrycomment') {
if (!leadType || !project?.id || !leadType?.id) {
return (
<span>
an entry
Expand All @@ -64,12 +65,11 @@ function AssignmentItem(props: AssignmentItemProps) {
}
const editEntryLink = {
pathname: (generatePath(routes.entryEdit.path, {
projectId: projectDetails.id,
leadId: contentObjectDetails.lead,
projectId: project.id,
leadId: leadType?.id,
})),
state: {
// NOTE: Replace this later to clientId
entryServerId: contentObjectDetails.entry,
entryServerId: entryType?.id,
activePage: 'primary',
},
hash: '#/primary-tagging',
Expand All @@ -85,9 +85,10 @@ function AssignmentItem(props: AssignmentItemProps) {
}
return null;
}, [
contentObjectType,
contentObjectDetails,
projectDetails,
contentType,
leadType,
entryType,
project,
]);

return (
Expand All @@ -111,17 +112,17 @@ function AssignmentItem(props: AssignmentItemProps) {
{generateString(
'{createdByName} assigned you to {linkToItem} in {project}.',
{
createdByName: createdByDetails.displayName,
createdByName: createdBy?.displayName,
linkToItem: contentLink,
project: (
<Link
to={generatePath(
routes.tagging.path,
{ projectId: projectDetails?.id },
{ projectId: project?.id },
)}
className={styles.link}
>
{projectDetails?.title}
{project?.title}
</Link>
),
},
Expand Down
Loading

0 comments on commit 7b232f3

Please sign in to comment.