Skip to content

Commit 5f0db0d

Browse files
authored
Merge pull request #2127 from JoinColony/feature/314-task-comment-count
Add task comment count
2 parents 673c48e + 4bf3960 commit 5f0db0d

File tree

13 files changed

+180
-24
lines changed

13 files changed

+180
-24
lines changed

src/data/fragments.graphql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,16 @@ fragment CreateTaskFields on Task {
4444
nativeTokenAddress
4545
}
4646
colonyAddress
47+
commentCount @client
4748
createdAt
4849
creatorAddress
4950
dueDate
5051
ethDomainId
5152
ethSkillId
53+
events {
54+
id
55+
type
56+
}
5257
finalizedAt
5358
title
5459
workRequestAddresses

src/data/generated.ts

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,7 @@ export type Task = {
12251225
events: Array<Event>,
12261226
payouts: Array<TaskPayout>,
12271227
txHash?: Maybe<Scalars['String']>,
1228+
commentCount: Scalars['Int'],
12281229
finalizedPayment?: Maybe<TaskFinalizedPayment>,
12291230
};
12301231

@@ -1369,11 +1370,11 @@ export type PersistentTaskPayoutsFragment = { payouts: Array<(
13691370
)> };
13701371

13711372
export type CreateTaskFieldsFragment = (
1372-
Pick<Task, 'id' | 'assignedWorkerAddress' | 'cancelledAt' | 'colonyAddress' | 'createdAt' | 'creatorAddress' | 'dueDate' | 'ethDomainId' | 'ethSkillId' | 'finalizedAt' | 'title' | 'workRequestAddresses' | 'txHash'>
1373+
Pick<Task, 'id' | 'assignedWorkerAddress' | 'cancelledAt' | 'colonyAddress' | 'commentCount' | 'createdAt' | 'creatorAddress' | 'dueDate' | 'ethDomainId' | 'ethSkillId' | 'finalizedAt' | 'title' | 'workRequestAddresses' | 'txHash'>
13731374
& { assignedWorker: Maybe<(
13741375
Pick<User, 'id'>
13751376
& { profile: Pick<UserProfile, 'avatarHash'> }
1376-
)>, colony: Pick<Colony, 'id' | 'colonyName' | 'displayName' | 'nativeTokenAddress'> }
1377+
)>, colony: Pick<Colony, 'id' | 'colonyName' | 'displayName' | 'nativeTokenAddress'>, events: Array<Pick<Event, 'id' | 'type'>> }
13771378
& PayoutsFragment
13781379
);
13791380

@@ -1885,14 +1886,14 @@ export type TaskQueryVariables = {
18851886

18861887

18871888
export type TaskQuery = { task: (
1888-
Pick<Task, 'id' | 'assignedWorkerAddress' | 'cancelledAt' | 'colonyAddress' | 'createdAt' | 'creatorAddress' | 'description' | 'dueDate' | 'ethDomainId' | 'ethSkillId' | 'ethPotId' | 'finalizedAt' | 'title' | 'workInviteAddresses' | 'workRequestAddresses' | 'txHash'>
1889+
Pick<Task, 'id' | 'assignedWorkerAddress' | 'cancelledAt' | 'colonyAddress' | 'commentCount' | 'createdAt' | 'creatorAddress' | 'description' | 'dueDate' | 'ethDomainId' | 'ethSkillId' | 'ethPotId' | 'finalizedAt' | 'title' | 'workInviteAddresses' | 'workRequestAddresses' | 'txHash'>
18891890
& { assignedWorker: Maybe<(
18901891
Pick<User, 'id'>
18911892
& { profile: Pick<UserProfile, 'avatarHash' | 'displayName' | 'username' | 'walletAddress'> }
18921893
)>, colony: Pick<Colony, 'id' | 'colonyAddress' | 'colonyName' | 'avatarHash' | 'displayName' | 'nativeTokenAddress'>, creator: (
18931894
Pick<User, 'id'>
18941895
& { profile: Pick<UserProfile, 'avatarHash' | 'displayName' | 'username' | 'walletAddress'> }
1895-
), workInvites: Array<(
1896+
), events: Array<Pick<Event, 'id' | 'type'>>, workInvites: Array<(
18961897
Pick<User, 'id'>
18971898
& { profile: Pick<UserProfile, 'avatarHash' | 'displayName' | 'username' | 'walletAddress'> }
18981899
)>, workRequests: Array<(
@@ -1980,11 +1981,11 @@ export type UserTasksQueryVariables = {
19801981
export type UserTasksQuery = { user: (
19811982
Pick<User, 'id'>
19821983
& { tasks: Array<(
1983-
Pick<Task, 'id' | 'assignedWorkerAddress' | 'cancelledAt' | 'colonyAddress' | 'createdAt' | 'creatorAddress' | 'dueDate' | 'ethDomainId' | 'ethSkillId' | 'finalizedAt' | 'title' | 'workRequestAddresses' | 'txHash'>
1984+
Pick<Task, 'id' | 'assignedWorkerAddress' | 'cancelledAt' | 'colonyAddress' | 'commentCount' | 'createdAt' | 'creatorAddress' | 'dueDate' | 'ethDomainId' | 'ethSkillId' | 'finalizedAt' | 'title' | 'workRequestAddresses' | 'txHash'>
19841985
& { assignedWorker: Maybe<(
19851986
Pick<User, 'id'>
19861987
& { profile: Pick<UserProfile, 'avatarHash'> }
1987-
)>, colony: Pick<Colony, 'id' | 'colonyName' | 'displayName' | 'nativeTokenAddress'> }
1988+
)>, colony: Pick<Colony, 'id' | 'colonyName' | 'displayName' | 'nativeTokenAddress'>, events: Array<Pick<Event, 'id' | 'type'>> }
19881989
& PayoutsFragment
19891990
)> }
19901991
) };
@@ -2096,11 +2097,11 @@ export type ColonyTasksQueryVariables = {
20962097
export type ColonyTasksQuery = { colony: (
20972098
Pick<Colony, 'id'>
20982099
& { tasks: Array<(
2099-
Pick<Task, 'id' | 'assignedWorkerAddress' | 'cancelledAt' | 'colonyAddress' | 'createdAt' | 'creatorAddress' | 'dueDate' | 'ethDomainId' | 'ethSkillId' | 'finalizedAt' | 'title' | 'workRequestAddresses' | 'txHash'>
2100+
Pick<Task, 'id' | 'assignedWorkerAddress' | 'cancelledAt' | 'colonyAddress' | 'commentCount' | 'createdAt' | 'creatorAddress' | 'dueDate' | 'ethDomainId' | 'ethSkillId' | 'finalizedAt' | 'title' | 'workRequestAddresses' | 'txHash'>
21002101
& { assignedWorker: Maybe<(
21012102
Pick<User, 'id'>
21022103
& { profile: Pick<UserProfile, 'avatarHash'> }
2103-
)>, colony: Pick<Colony, 'id' | 'colonyName' | 'displayName' | 'nativeTokenAddress'> }
2104+
)>, colony: Pick<Colony, 'id' | 'colonyName' | 'displayName' | 'nativeTokenAddress'>, events: Array<Pick<Event, 'id' | 'type'>> }
21042105
& PayoutsFragment
21052106
)> }
21062107
) };
@@ -2289,11 +2290,16 @@ export const CreateTaskFieldsFragmentDoc = gql`
22892290
nativeTokenAddress
22902291
}
22912292
colonyAddress
2293+
commentCount @client
22922294
createdAt
22932295
creatorAddress
22942296
dueDate
22952297
ethDomainId
22962298
ethSkillId
2299+
events {
2300+
id
2301+
type
2302+
}
22972303
finalizedAt
22982304
title
22992305
workRequestAddresses
@@ -4471,6 +4477,7 @@ export const TaskDocument = gql`
44714477
nativeTokenAddress
44724478
}
44734479
colonyAddress
4480+
commentCount @client
44744481
createdAt
44754482
creator {
44764483
id
@@ -4487,6 +4494,10 @@ export const TaskDocument = gql`
44874494
ethDomainId
44884495
ethSkillId
44894496
ethPotId
4497+
events {
4498+
id
4499+
type
4500+
}
44904501
finalizedAt
44914502
title
44924503
workInvites {
@@ -4836,11 +4847,16 @@ export const UserTasksDocument = gql`
48364847
nativeTokenAddress
48374848
}
48384849
colonyAddress
4850+
commentCount @client
48394851
createdAt
48404852
creatorAddress
48414853
dueDate
48424854
ethDomainId
48434855
ethSkillId
4856+
events {
4857+
id
4858+
type
4859+
}
48444860
finalizedAt
48454861
title
48464862
workRequestAddresses
@@ -5311,11 +5327,16 @@ export const ColonyTasksDocument = gql`
53115327
nativeTokenAddress
53125328
}
53135329
colonyAddress
5330+
commentCount @client
53145331
createdAt
53155332
creatorAddress
53165333
dueDate
53175334
ethDomainId
53185335
ethSkillId
5336+
events {
5337+
id
5338+
type
5339+
}
53195340
finalizedAt
53205341
title
53215342
workRequestAddresses

src/data/queries.graphql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ query Task($id: String!) {
2424
nativeTokenAddress
2525
}
2626
colonyAddress
27+
commentCount @client
2728
createdAt
2829
creator {
2930
id
@@ -40,6 +41,10 @@ query Task($id: String!) {
4041
ethDomainId
4142
ethSkillId
4243
ethPotId
44+
events {
45+
id
46+
type
47+
}
4348
finalizedAt
4449
title
4550
workInvites {
@@ -199,11 +204,16 @@ query UserTasks($address: String!) {
199204
nativeTokenAddress
200205
}
201206
colonyAddress
207+
commentCount @client
202208
createdAt
203209
creatorAddress
204210
dueDate
205211
ethDomainId
206212
ethSkillId
213+
events {
214+
id
215+
type
216+
}
207217
finalizedAt
208218
title
209219
workRequestAddresses
@@ -320,11 +330,16 @@ query ColonyTasks($address: String!) {
320330
nativeTokenAddress
321331
}
322332
colonyAddress
333+
commentCount @client
323334
createdAt
324335
creatorAddress
325336
dueDate
326337
ethDomainId
327338
ethSkillId
339+
events {
340+
id
341+
type
342+
}
328343
finalizedAt
329344
title
330345
workRequestAddresses

src/data/task.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ import { ContextType } from '~context/index';
55
import { createAddress } from '~utils/web3';
66

77
import { getToken } from './token';
8+
import { EventType } from './index';
89

910
export const taskResolvers = ({ colonyManager }: ContextType): Resolvers => ({
1011
Task: {
12+
commentCount({ events }): number {
13+
return events.filter(({ type }) => type === EventType.TaskMessage).length;
14+
},
1115
async finalizedPayment({ colonyAddress, finalizedAt, ethPotId }) {
1216
if (!finalizedAt || !ethPotId) return null;
1317
const colonyClient = await colonyManager.getColonyClient(colonyAddress);

src/data/typeDefs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export default gql`
5454
}
5555
5656
extend type Task {
57+
commentCount: Int!
5758
finalizedPayment: TaskFinalizedPayment
5859
}
5960

src/img/icons.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"circle-person",
2424
"circle-plus",
2525
"close",
26+
"comment",
2627
"cup",
2728
"drag-handle",
2829
"empty-task",

src/img/icons/comment.svg

Lines changed: 13 additions & 0 deletions
Loading

src/modules/core/components/Icon/Icon.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
* Next set of classes will define the icons's size
3434
*/
3535

36+
.extraTiny {
37+
height: 12px;
38+
width: 12px;
39+
}
40+
3641
.sizeTiny {
3742
height: 14px;
3843
width: 14px;

src/modules/core/components/Icon/Icon.css.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export const main: string;
2+
export const extraTiny: string;
23
export const sizeTiny: string;
34
export const sizeSmall: string;
45
export const sizeNormal: string;

src/modules/core/components/Icon/Icon.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ const displayName = 'Icon';
1414

1515
type Appearance = {
1616
theme?: 'primary' | 'invert';
17-
size?: 'tiny' | 'small' | 'normal' | 'medium' | 'large' | 'huge';
17+
size?:
18+
| 'extraTiny'
19+
| 'tiny'
20+
| 'small'
21+
| 'normal'
22+
| 'medium'
23+
| 'large'
24+
| 'huge';
1825
};
1926

2027
interface Props extends Omit<HTMLAttributes<HTMLElement>, 'title'> {

0 commit comments

Comments
 (0)