Skip to content

Commit aaa8ec5

Browse files
#2133 added comments icon and count on notes tab (#2186)
* fix * #2133 added comments icon and count on notes tab * reverted changes in people-filters.tsx
1 parent c80eb5c commit aaa8ec5

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

front/src/generated/graphql.tsx

+16-1
Original file line numberDiff line numberDiff line change
@@ -3719,7 +3719,22 @@ export type GetActivitiesQueryVariables = Exact<{
37193719
}>;
37203720

37213721

3722-
export type GetActivitiesQuery = { __typename?: 'Query', findManyActivities: Array<{ __typename?: 'Activity', id: string, createdAt: string, title?: string | null, body?: string | null, type: ActivityType, completedAt?: string | null, dueAt?: string | null, assignee?: { __typename?: 'User', id: string, firstName?: string | null, lastName?: string | null, displayName: string, avatarUrl?: string | null } | null, author: { __typename?: 'User', id: string, firstName?: string | null, lastName?: string | null, displayName: string }, comments?: Array<{ __typename?: 'Comment', id: string, body: string, createdAt: string, updatedAt: string, author: { __typename?: 'User', id: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null } }> | null, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, companyId?: string | null, personId?: string | null, company?: { __typename?: 'Company', id: string, name: string, domainName: string } | null, person?: { __typename?: 'Person', id: string, displayName: string, avatarUrl?: string | null } | null }> | null }> };
3722+
export type GetActivitiesQuery = {
3723+
__typename?: 'Query',
3724+
findManyActivities: Array<{
3725+
__typename?: 'Activity';
3726+
id: string;
3727+
createdAt: string,
3728+
title?: string | null,
3729+
body?: string | null,
3730+
type: ActivityType,
3731+
completedAt?: string | null,
3732+
dueAt?: string | null,
3733+
assignee?: { __typename?: 'User', id: string, firstName?: string | null, lastName?: string | null, displayName: string, avatarUrl?: string | null } | null,
3734+
author: { __typename?: 'User', id: string, firstName?: string | null, lastName?: string | null, displayName: string },
3735+
comments?: Array<Comment>,
3736+
activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, companyId?: string | null, personId?: string | null, company?: { __typename?: 'Company', id: string, name: string, domainName: string } | null, person?: { __typename?: 'Person', id: string, displayName: string, avatarUrl?: string | null } | null }> | null
3737+
}> };
37233738

37243739
export type GetActivitiesByTargetsQueryVariables = Exact<{
37253740
activityTargetIds: Array<Scalars['String']> | Scalars['String'];

front/src/modules/activities/notes/components/NoteCard.tsx

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useMemo } from 'react';
2+
import { useTheme } from '@emotion/react';
23
import styled from '@emotion/styled';
34

45
import { ActivityRelationEditableField } from '@/activities/editable-fields/components/ActivityRelationEditableField';
@@ -7,6 +8,7 @@ import {
78
FieldContext,
89
GenericFieldContextType,
910
} from '@/ui/data/field/contexts/FieldContext';
11+
import { IconComment } from '@/ui/display/icon';
1012
import { Activity, ActivityTarget } from '~/generated/graphql';
1113

1214
const StyledCard = styled.div`
@@ -54,23 +56,32 @@ const StyledFooter = styled.div`
5456
border-top: 1px solid ${({ theme }) => theme.border.color.light};
5557
color: ${({ theme }) => theme.font.color.primary};
5658
display: flex;
57-
flex-direction: column;
59+
flex-direction: row;
5860
gap: ${({ theme }) => theme.spacing(1)};
5961
justify-content: center;
6062
padding: ${({ theme }) => theme.spacing(2)};
6163
width: calc(100% - ${({ theme }) => theme.spacing(4)});
6264
`;
6365

66+
const StyledCommentIcon = styled.div`
67+
align-items: center;
68+
color: ${({ theme }) => theme.font.color.light};
69+
display: flex;
70+
gap: ${({ theme }) => theme.spacing(1)};
71+
margin-left: ${({ theme }) => theme.spacing(2)};
72+
`;
73+
6474
export const NoteCard = ({
6575
note,
6676
}: {
6777
note: Pick<
6878
Activity,
69-
'id' | 'title' | 'body' | 'type' | 'completedAt' | 'dueAt'
79+
'id' | 'title' | 'body' | 'type' | 'completedAt' | 'dueAt' | 'comments'
7080
> & {
7181
activityTargets?: Array<Pick<ActivityTarget, 'id'>> | null;
7282
};
7383
}) => {
84+
const theme = useTheme();
7485
const openActivityRightDrawer = useOpenActivityRightDrawer();
7586
const body = JSON.parse(note.body ?? '{}')[0]
7687
?.content.map((x: any) => x.text)
@@ -92,6 +103,12 @@ export const NoteCard = ({
92103
</StyledCardDetailsContainer>
93104
<StyledFooter>
94105
<ActivityRelationEditableField activity={note} />
106+
{note.comments && note.comments.length > 0 && (
107+
<StyledCommentIcon>
108+
<IconComment size={theme.icon.size.md} />
109+
{note.comments.length}
110+
</StyledCommentIcon>
111+
)}
95112
</StyledFooter>
96113
</StyledCard>
97114
</FieldContext.Provider>

front/src/testing/mock-data/activities.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ type MockedActivity = Pick<
2929
User,
3030
'id' | 'firstName' | 'lastName' | 'displayName' | 'avatarUrl'
3131
>;
32-
comments: Array<
33-
Pick<Comment, 'body' | 'id' | 'createdAt' | 'updatedAt'> & {
34-
author: Pick<User, 'id' | 'displayName' | 'avatarUrl'>;
35-
}
36-
>;
32+
comments: Array<Comment>;
3733
activityTargets: Array<
3834
Pick<
3935
ActivityTarget,

0 commit comments

Comments
 (0)