Selaa lähdekoodia

des trucs

feat/year-wrapped
Elias Sebbar 9 tuntia sitten
vanhempi
commit
68d355f37b

+ 30
- 16
million/analyze/filter/participants.py Näytä tiedosto

@@ -1,9 +1,10 @@
1 1
 
2 2
 
3
-from typing import List
3
+from enum import Enum
4
+from typing import List, Optional
4 5
 
5 6
 from pydantic import BaseModel
6
-from million.model.filter.MessageFilter import MessageFilter
7
+from million.model.filter.MessageFilter import MessageCountTrait, MessageFilter
7 8
 from million.model.filter.ParticipantFilter import OrderDirection, ParticipantFilter
8 9
 from million.model.message import Message
9 10
 from million.model.participant import Participant
@@ -15,22 +16,35 @@ class ParticipantCount(BaseModel):
15 16
     count: int
16 17
 
17 18
 
18
-def order_count(participants: List[Participant], messages: List[Message], criterias: MessageFilter = None, direction: OrderDirection = OrderDirection.desc) -> ParticipantCount:
19
-    result = [
20
-        ParticipantCount(
21
-            participant=participant,
22
-            count=len(
23
-                message_filter(
24
-                    messages,
25
-                    criterias=MessageFilter(**{
26
-                        **(criterias.model_dump() if criterias else dict()),
27
-                        "sender_name": participant.name
28
-                    })
29
-                )
19
+def order_count(
20
+        participants: List[Participant],
21
+        messages: List[Message],
22
+        criterias: ParticipantFilter = None,
23
+        direction: OrderDirection = OrderDirection.desc,
24
+        on_trait: Optional[MessageCountTrait] = None
25
+) -> ParticipantCount:
26
+    result = []
27
+    for participant in participants:
28
+        sent_messages = message_filter(
29
+
30
+            messages,
31
+            criterias=MessageFilter(**{
32
+                **(criterias.model_dump() if criterias else dict()),
33
+                "sender_name": participant.name
34
+            },
35
+            )
36
+        )
37
+        if criterias.on_message_trait == MessageCountTrait.total_reactions:
38
+            count = sum([len(message.reactions if message.reactions else []) for message in sent_messages])
39
+        else:
40
+            count = len(sent_messages)
41
+
42
+        result.append(
43
+            ParticipantCount(
44
+                participant=participant,
45
+                count=count
30 46
             ))
31 47
 
32
-        for participant in participants
33
-    ]
34 48
     result.sort(key=lambda p: p.count, reverse=True)
35 49
     return [result for result in result]
36 50
 

+ 4
- 0
million/model/filter/MessageFilter.py Näytä tiedosto

@@ -3,6 +3,10 @@ from enum import Enum
3 3
 from pydantic import BaseModel
4 4
 
5 5
 
6
+class MessageCountTrait(str, Enum):
7
+    total_reactions = "total_reactions"
8
+
9
+
6 10
 class MessageOrder(str, Enum):
7 11
     date = "date"
8 12
     reactions = "reactions"

+ 2
- 2
million/model/filter/ParticipantFilter.py Näytä tiedosto

@@ -2,7 +2,7 @@ from datetime import datetime
2 2
 from pydantic import BaseModel
3 3
 from enum import Enum
4 4
 
5
-from million.model.filter.MessageFilter import MessageFilter
5
+from million.model.filter.MessageFilter import MessageCountTrait, MessageFilter
6 6
 
7 7
 
8 8
 class OrderBy(str, Enum):
@@ -15,7 +15,7 @@ class OrderDirection(str, Enum):
15 15
 
16 16
 
17 17
 class ParticipantFilter(MessageFilter):
18
-
18
+    on_message_trait: MessageCountTrait | None = None
19 19
     order_by: OrderBy | None = OrderBy.count
20 20
     order_dir: OrderDirection | None = OrderDirection.desc
21 21
 

+ 1
- 0
vite-wrapped/deno.json Näytä tiedosto

@@ -22,6 +22,7 @@
22 22
         "@types/react-dom": "npm:@types/react-dom@^18.3.1",
23 23
         "@vitejs/plugin-react-swc": "npm:@vitejs/plugin-react-swc@^3.7.1",
24 24
         "framer-motion": "npm:framer-motion@^11.15.0",
25
+        "motion": "npm:motion@^12.0.6",
25 26
         "react": "npm:react@^18.3.1",
26 27
         "react-dom": "npm:react-dom@^18.3.1",
27 28
         "vite": "npm:vite@^6.0.1"

+ 32
- 2
vite-wrapped/deno.lock Näytä tiedosto

@@ -7,6 +7,7 @@
7 7
     "npm:@types/react@^18.3.12": "18.3.18",
8 8
     "npm:@vitejs/plugin-react-swc@^3.7.1": "3.7.2_vite@6.0.6",
9 9
     "npm:framer-motion@^11.15.0": "11.15.0_react@18.3.1_react-dom@18.3.1__react@18.3.1",
10
+    "npm:motion@^12.0.6": "12.0.6_react@18.3.1_react-dom@18.3.1__react@18.3.1",
10 11
     "npm:react-dom@^18.3.1": "18.3.1_react@18.3.1",
11 12
     "npm:react@^18.3.1": "18.3.1",
12 13
     "npm:vite@*": "6.0.6",
@@ -275,8 +276,18 @@
275 276
     "framer-motion@11.15.0_react@18.3.1_react-dom@18.3.1__react@18.3.1": {
276 277
       "integrity": "sha512-MLk8IvZntxOMg7lDBLw2qgTHHv664bYoYmnFTmE0Gm/FW67aOJk0WM3ctMcG+Xhcv+vh5uyyXwxvxhSeJzSe+w==",
277 278
       "dependencies": [
278
-        "motion-dom",
279
-        "motion-utils",
279
+        "motion-dom@11.14.3",
280
+        "motion-utils@11.14.3",
281
+        "react",
282
+        "react-dom",
283
+        "tslib"
284
+      ]
285
+    },
286
+    "framer-motion@12.0.6_react@18.3.1_react-dom@18.3.1__react@18.3.1": {
287
+      "integrity": "sha512-LmrXbXF6Vv5WCNmb+O/zn891VPZrH7XbsZgRLBROw6kFiP+iTK49gxTv2Ur3F0Tbw6+sy9BVtSqnWfMUpH+6nA==",
288
+      "dependencies": [
289
+        "motion-dom@12.0.0",
290
+        "motion-utils@12.0.0",
280 291
         "react",
281 292
         "react-dom",
282 293
         "tslib"
@@ -297,9 +308,27 @@
297 308
     "motion-dom@11.14.3": {
298 309
       "integrity": "sha512-lW+D2wBy5vxLJi6aCP0xyxTxlTfiu+b+zcpVbGVFUxotwThqhdpPRSmX8xztAgtZMPMeU0WGVn/k1w4I+TbPqA=="
299 310
     },
311
+    "motion-dom@12.0.0": {
312
+      "integrity": "sha512-CvYd15OeIR6kHgMdonCc1ihsaUG4MYh/wrkz8gZ3hBX/uamyZCXN9S9qJoYF03GqfTt7thTV/dxnHYX4+55vDg==",
313
+      "dependencies": [
314
+        "motion-utils@12.0.0"
315
+      ]
316
+    },
300 317
     "motion-utils@11.14.3": {
301 318
       "integrity": "sha512-Xg+8xnqIJTpr0L/cidfTTBFkvRw26ZtGGuIhA94J9PQ2p4mEa06Xx7QVYZH0BP+EpMSaDlu+q0I0mmvwADPsaQ=="
302 319
     },
320
+    "motion-utils@12.0.0": {
321
+      "integrity": "sha512-MNFiBKbbqnmvOjkPyOKgHUp3Q6oiokLkI1bEwm5QA28cxMZrv0CbbBGDNmhF6DIXsi1pCQBSs0dX8xjeER1tmA=="
322
+    },
323
+    "motion@12.0.6_react@18.3.1_react-dom@18.3.1__react@18.3.1": {
324
+      "integrity": "sha512-AzCEO0+//mPlcGiL9JaVwjddHY1cbbnvz5upHL0toqQwsPCs+hiKJ0XG5jfG0XwDtBbiSXdEqW/UTmGLwkVQ6A==",
325
+      "dependencies": [
326
+        "framer-motion@12.0.6_react@18.3.1_react-dom@18.3.1__react@18.3.1",
327
+        "react",
328
+        "react-dom",
329
+        "tslib"
330
+      ]
331
+    },
303 332
     "nanoid@3.3.8": {
304 333
       "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w=="
305 334
     },
@@ -386,6 +415,7 @@
386 415
       "npm:@types/react@^18.3.12",
387 416
       "npm:@vitejs/plugin-react-swc@^3.7.1",
388 417
       "npm:framer-motion@^11.15.0",
418
+      "npm:motion@^12.0.6",
389 419
       "npm:react-dom@^18.3.1",
390 420
       "npm:react@^18.3.1",
391 421
       "npm:vite@^6.0.1"

+ 3
- 1
vite-wrapped/src/App.tsx Näytä tiedosto

@@ -10,6 +10,7 @@ import {
10 10
 import { useAnimationFrame } from "framer-motion";
11 11
 import Welcome from "./steps/welcome.tsx";
12 12
 import GlobalTop from "./steps/GlobalTop.tsx";
13
+import MostLikedMessage from "./steps/MostLikedMessage.tsx";
13 14
 
14 15
 const steps = [
15 16
   {
@@ -22,7 +23,7 @@ const steps = [
22 23
   },
23 24
   {
24 25
     title: "Step 3",
25
-    content: "Content of step 3",
26
+    content: MostLikedMessage,
26 27
   },
27 28
 ];
28 29
 
@@ -92,6 +93,7 @@ function App() {
92 93
           <h1>Step selector (current = {currentStep})</h1>
93 94
           <button onClick={() => setCurrentStep(0)}>Step 1</button>
94 95
           <button onClick={() => setCurrentStep(1)}>Step 2</button>
96
+          <button onClick={() => setCurrentStep(2)}>Step 2</button>
95 97
         </div>
96 98
       </div>
97 99
     </>

+ 3402
- 0
vite-wrapped/src/data/contributors_contributions_with_reaction.ts
File diff suppressed because it is too large
Näytä tiedosto


+ 654
- 0
vite-wrapped/src/data/most_reacted_contributors.ts Näytä tiedosto

@@ -0,0 +1,654 @@
1
+type ParticipantStats = {
2
+  participant: {
3
+    name: string;
4
+  };
5
+  count: number;
6
+};
7
+
8
+const MostReactedParticipants: ParticipantStats[] = [
9
+  {
10
+    participant: {
11
+      name: "Elias Cheddar",
12
+    },
13
+    count: 52,
14
+  },
15
+  {
16
+    participant: {
17
+      name: "Maël Delanoë",
18
+    },
19
+    count: 42,
20
+  },
21
+  {
22
+    participant: {
23
+      name: "Amalia Arnaud",
24
+    },
25
+    count: 37,
26
+  },
27
+  {
28
+    participant: {
29
+      name: "Maël Drarig",
30
+    },
31
+    count: 35,
32
+  },
33
+  {
34
+    participant: {
35
+      name: "Victor Mélou",
36
+    },
37
+    count: 34,
38
+  },
39
+  {
40
+    participant: {
41
+      name: "Clervie Guillemot",
42
+    },
43
+    count: 18,
44
+  },
45
+  {
46
+    participant: {
47
+      name: "Léonard D'Aqr",
48
+    },
49
+    count: 15,
50
+  },
51
+  {
52
+    participant: {
53
+      name: "Jules Chanoine",
54
+    },
55
+    count: 12,
56
+  },
57
+  {
58
+    participant: {
59
+      name: "Thomas Guerit",
60
+    },
61
+    count: 7,
62
+  },
63
+  {
64
+    participant: {
65
+      name: "Ambre Salomé Ltr",
66
+    },
67
+    count: 7,
68
+  },
69
+  {
70
+    participant: {
71
+      name: "Djem Dean",
72
+    },
73
+    count: 6,
74
+  },
75
+  {
76
+    participant: {
77
+      name: "Alicia Charron",
78
+    },
79
+    count: 6,
80
+  },
81
+  {
82
+    participant: {
83
+      name: "Pierre Brlt",
84
+    },
85
+    count: 5,
86
+  },
87
+  {
88
+    participant: {
89
+      name: "Arthur Salaün",
90
+    },
91
+    count: 4,
92
+  },
93
+  {
94
+    participant: {
95
+      name: "Augustin Lhotelier Ivey",
96
+    },
97
+    count: 4,
98
+  },
99
+  {
100
+    participant: {
101
+      name: "Lucas Despres",
102
+    },
103
+    count: 4,
104
+  },
105
+  {
106
+    participant: {
107
+      name: "Léa Rivron",
108
+    },
109
+    count: 3,
110
+  },
111
+  {
112
+    participant: {
113
+      name: "Serban Suciu",
114
+    },
115
+    count: 3,
116
+  },
117
+  {
118
+    participant: {
119
+      name: "Hugo Mhl",
120
+    },
121
+    count: 3,
122
+  },
123
+  {
124
+    participant: {
125
+      name: "Mael Pl",
126
+    },
127
+    count: 3,
128
+  },
129
+  {
130
+    participant: {
131
+      name: "Lucien Lhotelier",
132
+    },
133
+    count: 3,
134
+  },
135
+  {
136
+    participant: {
137
+      name: "Antoine Bertho",
138
+    },
139
+    count: 2,
140
+  },
141
+  {
142
+    participant: {
143
+      name: "Ema Karena",
144
+    },
145
+    count: 2,
146
+  },
147
+  {
148
+    participant: {
149
+      name: "Luca D'aquaro",
150
+    },
151
+    count: 2,
152
+  },
153
+  {
154
+    participant: {
155
+      name: "Mikaël Royet",
156
+    },
157
+    count: 2,
158
+  },
159
+  {
160
+    participant: {
161
+      name: "Lea-maria Laurent",
162
+    },
163
+    count: 2,
164
+  },
165
+  {
166
+    participant: {
167
+      name: "Valentin Moisan",
168
+    },
169
+    count: 2,
170
+  },
171
+  {
172
+    participant: {
173
+      name: "Astrid Batt",
174
+    },
175
+    count: 2,
176
+  },
177
+  {
178
+    participant: {
179
+      name: "Noémie Le Maréchal",
180
+    },
181
+    count: 1,
182
+  },
183
+  {
184
+    participant: {
185
+      name: "Vincent Dammann",
186
+    },
187
+    count: 1,
188
+  },
189
+  {
190
+    participant: {
191
+      name: "François Ycq",
192
+    },
193
+    count: 1,
194
+  },
195
+  {
196
+    participant: {
197
+      name: "Suniva Tessier",
198
+    },
199
+    count: 1,
200
+  },
201
+  {
202
+    participant: {
203
+      name: "Laetitia Doudet",
204
+    },
205
+    count: 1,
206
+  },
207
+  {
208
+    participant: {
209
+      name: "Eliott Richard",
210
+    },
211
+    count: 1,
212
+  },
213
+  {
214
+    participant: {
215
+      name: "Sami Zaiter",
216
+    },
217
+    count: 1,
218
+  },
219
+  {
220
+    participant: {
221
+      name: "Pauk Brunstein-Compard",
222
+    },
223
+    count: 1,
224
+  },
225
+  {
226
+    participant: {
227
+      name: "Theophile Pere",
228
+    },
229
+    count: 1,
230
+  },
231
+  {
232
+    participant: {
233
+      name: "Anne-Lise Le Guyadec",
234
+    },
235
+    count: 1,
236
+  },
237
+  {
238
+    participant: {
239
+      name: "Vivien Motte",
240
+    },
241
+    count: 1,
242
+  },
243
+  {
244
+    participant: {
245
+      name: "Gaëtan Martin",
246
+    },
247
+    count: 1,
248
+  },
249
+  {
250
+    participant: {
251
+      name: "Victor Dibou Ivey",
252
+    },
253
+    count: 1,
254
+  },
255
+  {
256
+    participant: {
257
+      name: "Tom Dardilhac",
258
+    },
259
+    count: 0,
260
+  },
261
+  {
262
+    participant: {
263
+      name: "Léonard Hamroun II",
264
+    },
265
+    count: 0,
266
+  },
267
+  {
268
+    participant: {
269
+      name: "Pierre Cosson",
270
+    },
271
+    count: 0,
272
+  },
273
+  {
274
+    participant: {
275
+      name: "Alice Ruellan",
276
+    },
277
+    count: 0,
278
+  },
279
+  {
280
+    participant: {
281
+      name: "Bout Antho",
282
+    },
283
+    count: 0,
284
+  },
285
+  {
286
+    participant: {
287
+      name: "Citlali Souloumiac",
288
+    },
289
+    count: 0,
290
+  },
291
+  {
292
+    participant: {
293
+      name: "Martin Moré",
294
+    },
295
+    count: 0,
296
+  },
297
+  {
298
+    participant: {
299
+      name: "Matteo Söze",
300
+    },
301
+    count: 0,
302
+  },
303
+  {
304
+    participant: {
305
+      name: "Alice Guillemot",
306
+    },
307
+    count: 0,
308
+  },
309
+  {
310
+    participant: {
311
+      name: "Miriam Lang",
312
+    },
313
+    count: 0,
314
+  },
315
+  {
316
+    participant: {
317
+      name: "Jules Borderie",
318
+    },
319
+    count: 0,
320
+  },
321
+  {
322
+    participant: {
323
+      name: "Antoine Carrere",
324
+    },
325
+    count: 0,
326
+  },
327
+  {
328
+    participant: {
329
+      name: "Gireg Bouillon",
330
+    },
331
+    count: 0,
332
+  },
333
+  {
334
+    participant: {
335
+      name: "Antoine Neveu",
336
+    },
337
+    count: 0,
338
+  },
339
+  {
340
+    participant: {
341
+      name: "Soizic Thiébaud",
342
+    },
343
+    count: 0,
344
+  },
345
+  {
346
+    participant: {
347
+      name: "Baptiste Lhotelier LeMée Jeannès",
348
+    },
349
+    count: 0,
350
+  },
351
+  {
352
+    participant: {
353
+      name: "Pierre Houdant",
354
+    },
355
+    count: 0,
356
+  },
357
+  {
358
+    participant: {
359
+      name: "Brieuc Pidoux",
360
+    },
361
+    count: 0,
362
+  },
363
+  {
364
+    participant: {
365
+      name: "Alice Delanoe",
366
+    },
367
+    count: 0,
368
+  },
369
+  {
370
+    participant: {
371
+      name: "Bilel Choutri",
372
+    },
373
+    count: 0,
374
+  },
375
+  {
376
+    participant: {
377
+      name: "Mathys Allain",
378
+    },
379
+    count: 0,
380
+  },
381
+  {
382
+    participant: {
383
+      name: "Lucas Roulin",
384
+    },
385
+    count: 0,
386
+  },
387
+  {
388
+    participant: {
389
+      name: "Félix Fléau",
390
+    },
391
+    count: 0,
392
+  },
393
+  {
394
+    participant: {
395
+      name: "Tom Cousin",
396
+    },
397
+    count: 0,
398
+  },
399
+  {
400
+    participant: {
401
+      name: "Axel Polano",
402
+    },
403
+    count: 0,
404
+  },
405
+  {
406
+    participant: {
407
+      name: "Victor Zwahlen",
408
+    },
409
+    count: 0,
410
+  },
411
+  {
412
+    participant: {
413
+      name: "Glenn Cadoret",
414
+    },
415
+    count: 0,
416
+  },
417
+  {
418
+    participant: {
419
+      name: "Sébastien Palud",
420
+    },
421
+    count: 0,
422
+  },
423
+  {
424
+    participant: {
425
+      name: "Maï Thrvl",
426
+    },
427
+    count: 0,
428
+  },
429
+  {
430
+    participant: {
431
+      name: "Marie Delanoe",
432
+    },
433
+    count: 0,
434
+  },
435
+  {
436
+    participant: {
437
+      name: "Léo-Maxio Pereira",
438
+    },
439
+    count: 0,
440
+  },
441
+  {
442
+    participant: {
443
+      name: "Alice Bayle",
444
+    },
445
+    count: 0,
446
+  },
447
+  {
448
+    participant: {
449
+      name: "Pauline Lailvaux",
450
+    },
451
+    count: 0,
452
+  },
453
+  {
454
+    participant: {
455
+      name: "William Milcent",
456
+    },
457
+    count: 0,
458
+  },
459
+  {
460
+    participant: {
461
+      name: "Oscar Gerard",
462
+    },
463
+    count: 0,
464
+  },
465
+  {
466
+    participant: {
467
+      name: "Thaïs Moncalvo",
468
+    },
469
+    count: 0,
470
+  },
471
+  {
472
+    participant: {
473
+      name: "Gabriel Cmmlt",
474
+    },
475
+    count: 0,
476
+  },
477
+  {
478
+    participant: {
479
+      name: "Hana Amzai",
480
+    },
481
+    count: 0,
482
+  },
483
+  {
484
+    participant: {
485
+      name: "Léa Vo",
486
+    },
487
+    count: 0,
488
+  },
489
+  {
490
+    participant: {
491
+      name: "Alexis Moreau",
492
+    },
493
+    count: 0,
494
+  },
495
+  {
496
+    participant: {
497
+      name: "Camille Bouvais",
498
+    },
499
+    count: 0,
500
+  },
501
+  {
502
+    participant: {
503
+      name: "Kevin Monfort",
504
+    },
505
+    count: 0,
506
+  },
507
+  {
508
+    participant: {
509
+      name: "Gabriel Reboux",
510
+    },
511
+    count: 0,
512
+  },
513
+  {
514
+    participant: {
515
+      name: "Pierre EM",
516
+    },
517
+    count: 0,
518
+  },
519
+  {
520
+    participant: {
521
+      name: "Thomas Bergamin",
522
+    },
523
+    count: 0,
524
+  },
525
+  {
526
+    participant: {
527
+      name: "Juliette Lbb",
528
+    },
529
+    count: 0,
530
+  },
531
+  {
532
+    participant: {
533
+      name: "Mancino Mancini",
534
+    },
535
+    count: 0,
536
+  },
537
+  {
538
+    participant: {
539
+      name: "Claire Jouannigot",
540
+    },
541
+    count: 0,
542
+  },
543
+  {
544
+    participant: {
545
+      name: "Jérémie Arnaud",
546
+    },
547
+    count: 0,
548
+  },
549
+  {
550
+    participant: {
551
+      name: "No Lcmt",
552
+    },
553
+    count: 0,
554
+  },
555
+  {
556
+    participant: {
557
+      name: "Eilaroc Nitpor",
558
+    },
559
+    count: 0,
560
+  },
561
+  {
562
+    participant: {
563
+      name: "Tiphaine Yaddaden",
564
+    },
565
+    count: 0,
566
+  },
567
+  {
568
+    participant: {
569
+      name: "Thys Mah",
570
+    },
571
+    count: 0,
572
+  },
573
+  {
574
+    participant: {
575
+      name: "Lou Chamnn",
576
+    },
577
+    count: 0,
578
+  },
579
+  {
580
+    participant: {
581
+      name: "Julien Chanteloup",
582
+    },
583
+    count: 0,
584
+  },
585
+  {
586
+    participant: {
587
+      name: "Lise Mammeri Bachatène",
588
+    },
589
+    count: 0,
590
+  },
591
+  {
592
+    participant: {
593
+      name: "Manon Hrln",
594
+    },
595
+    count: 0,
596
+  },
597
+  {
598
+    participant: {
599
+      name: "Charles Darras",
600
+    },
601
+    count: 0,
602
+  },
603
+  {
604
+    participant: {
605
+      name: "Hugo Massot",
606
+    },
607
+    count: 0,
608
+  },
609
+  {
610
+    participant: {
611
+      name: "Jules de Senneville",
612
+    },
613
+    count: 0,
614
+  },
615
+  {
616
+    participant: {
617
+      name: "Lorea Etchegoin Lasnier",
618
+    },
619
+    count: 0,
620
+  },
621
+  {
622
+    participant: {
623
+      name: "Louison l'Espadon",
624
+    },
625
+    count: 0,
626
+  },
627
+  {
628
+    participant: {
629
+      name: "Adèle Bras",
630
+    },
631
+    count: 0,
632
+  },
633
+  {
634
+    participant: {
635
+      name: "Théo Phile",
636
+    },
637
+    count: 0,
638
+  },
639
+  {
640
+    participant: {
641
+      name: "Emile Cste",
642
+    },
643
+    count: 0,
644
+  },
645
+  {
646
+    participant: {
647
+      name: "Léo Carême",
648
+    },
649
+    count: 0,
650
+  },
651
+].slice(0, 10);
652
+
653
+export default MostReactedParticipants;
654
+export type { ParticipantStats };

+ 473
- 0
vite-wrapped/src/data/most_reacted_messages.ts Näytä tiedosto

@@ -0,0 +1,473 @@
1
+type Reaction = {
2
+  reaction: string;
3
+  actor: string;
4
+};
5
+
6
+type Message = {
7
+  sender_name: string;
8
+  timestamp_ms: number;
9
+  content: string;
10
+  sticker: any;
11
+  share: any;
12
+  photos: any;
13
+  videos: any;
14
+  gifs: any;
15
+  audio_files: any;
16
+  call_duration: any;
17
+  reactions: Reaction[];
18
+  is_unsent: any;
19
+  is_geoblocked_for_viewer: boolean;
20
+};
21
+
22
+const MostReactedMessages = [
23
+  {
24
+    sender_name: "Maël Drarig",
25
+    timestamp_ms: 1728318687795,
26
+    content: "94000",
27
+    sticker: null,
28
+    share: null,
29
+    photos: null,
30
+    videos: null,
31
+    gifs: null,
32
+    audio_files: null,
33
+    call_duration: null,
34
+    reactions: [
35
+      {
36
+        reaction: "❤",
37
+        actor: "Mael Pl",
38
+      },
39
+      {
40
+        reaction: "😮",
41
+        actor: "Mikaël Royet",
42
+      },
43
+      {
44
+        reaction: "👍",
45
+        actor: "Valentin Moisan",
46
+      },
47
+      {
48
+        reaction: "❤",
49
+        actor: "Ema Karena",
50
+      },
51
+      {
52
+        reaction: "❤",
53
+        actor: "Maël Delanoë",
54
+      },
55
+      {
56
+        reaction: "❤",
57
+        actor: "Alicia Charron",
58
+      },
59
+      {
60
+        reaction: "❤",
61
+        actor: "Amalia Arnaud",
62
+      },
63
+      {
64
+        reaction: "😮",
65
+        actor: "Bout Antho",
66
+      },
67
+      {
68
+        reaction: "❤",
69
+        actor: "Antoine Ltllc",
70
+      },
71
+      {
72
+        reaction: "❤",
73
+        actor: "Victor Mélou",
74
+      },
75
+    ],
76
+    is_unsent: null,
77
+    is_geoblocked_for_viewer: false,
78
+  },
79
+  {
80
+    sender_name: "Elias Cheddar",
81
+    timestamp_ms: 1722342573496,
82
+    content:
83
+      "Salut les comptos 📈\nBienvenue à tou(te)s les nouveaux collaborateurices 🎉 Gros gros merci à toutes les personnes qui recrutent 🤝! Je vois que vous tapez dans le mille 🎯 et que vous nous apportez des éléments qui ont l’air 👏 au 👏 top 👏\nIci c’est pas compliqué, on compte un max 🧮et on kiffe 👈😎👉\nça fait longtemps qu’on a pas fait le point avec nos data analysts ! \nOn commence par les sujets qui fâchent 😱 \n➡️ Les trous 🕳 🫢\nNos algorithmes d’assurance qualité détectent 462 trous, pour un total de 4363 valeurs oubliées 🙊 🙊\nC’est pas grave on rattrapera ça en temps voulu, la route est encore longue 🧘\n➡️Une petite analyse de nos meilleurs compteurs ça vous dit ? \nLe trio de tête bouge pas, toujours solide 🏋️‍♀️ sur les appuis : \n🏆 Maël Delanoë: 9348\n🥈 Victor Mélou: 8588\n🥉 Augustin Lhotelier Ivey: 4981\n🚨🚨🚨Maël chaparde la première place à Victor 😳😳\nMention spéciale au reste du top 🐥🐥 : \n3: Augustin Lhotelier Ivey: 4981\n4: Elias Cheddar: 4664\n5: Jules Chanoine: 4023\n6: Gabriel Cmmlt: 3482\n7: William Btl: 3056\n8: Clervie Guillemot: 2937\n9: Arthur Salaün: 2932\n10: Maï Thrvl: 2914\n11: Lucas Roulin: 2807\n12: Pauk Brunstein-Compard: 2549\n13: Louis Chanoine: 2486\n14: Léo-Maxio Pereira: 2469\n15: Sami Zaiter: 2349\n16: Gabriel Reboux: 1551\n17: Thomas Guerit: 1213\n18: Juliette Lbb: 1143\n19: Hugo Mhl: 1013\n20: Laetitia Doudet: 951\nOn remarque vos efforts 👷👷et on kiffe 🥰 🥰\nGros poutous, mettez de la crème solaire 😘",
84
+    sticker: null,
85
+    share: null,
86
+    photos: null,
87
+    videos: null,
88
+    gifs: null,
89
+    audio_files: null,
90
+    call_duration: null,
91
+    reactions: [
92
+      {
93
+        reaction: "❤",
94
+        actor: "Mikaël Royet",
95
+      },
96
+      {
97
+        reaction: "❤",
98
+        actor: "Laetitia Doudet",
99
+      },
100
+      {
101
+        reaction: "❤",
102
+        actor: "Clervie Guillemot",
103
+      },
104
+      {
105
+        reaction: "❤",
106
+        actor: "Emile Cste",
107
+      },
108
+      {
109
+        reaction: "❤",
110
+        actor: "Thomas Guerit",
111
+      },
112
+      {
113
+        reaction: "❤",
114
+        actor: "Augustin Lhotelier Ivey",
115
+      },
116
+      {
117
+        reaction: "❤",
118
+        actor: "Hugo Mhl",
119
+      },
120
+      {
121
+        reaction: "❤",
122
+        actor: "Bout Antho",
123
+      },
124
+      {
125
+        reaction: "❤",
126
+        actor: "Victor Mélou",
127
+      },
128
+    ],
129
+    is_unsent: null,
130
+    is_geoblocked_for_viewer: false,
131
+  },
132
+  {
133
+    sender_name: "Amalia Arnaud",
134
+    timestamp_ms: 1728915547165,
135
+    content: "95000",
136
+    sticker: null,
137
+    share: null,
138
+    photos: null,
139
+    videos: null,
140
+    gifs: null,
141
+    audio_files: null,
142
+    call_duration: null,
143
+    reactions: [
144
+      {
145
+        reaction: "😮",
146
+        actor: "Mikaël Royet",
147
+      },
148
+      {
149
+        reaction: "❤",
150
+        actor: "Ema Karena",
151
+      },
152
+      {
153
+        reaction: "😮",
154
+        actor: "Maël Delanoë",
155
+      },
156
+      {
157
+        reaction: "❤",
158
+        actor: "Hugo Mhl",
159
+      },
160
+      {
161
+        reaction: "😮",
162
+        actor: "Bout Antho",
163
+      },
164
+      {
165
+        reaction: "❤",
166
+        actor: "Antoine Ltllc",
167
+      },
168
+      {
169
+        reaction: "❤",
170
+        actor: "Victor Mélou",
171
+      },
172
+      {
173
+        reaction: "❤",
174
+        actor: "Maël Drarig",
175
+      },
176
+    ],
177
+    is_unsent: null,
178
+    is_geoblocked_for_viewer: false,
179
+  },
180
+  {
181
+    sender_name: "Antoine Ltllc",
182
+    timestamp_ms: 1725724976744,
183
+    content: "90000",
184
+    sticker: null,
185
+    share: null,
186
+    photos: null,
187
+    videos: null,
188
+    gifs: null,
189
+    audio_files: null,
190
+    call_duration: null,
191
+    reactions: [
192
+      {
193
+        reaction: "❤",
194
+        actor: "Jules Chanoine",
195
+      },
196
+      {
197
+        reaction: "❤",
198
+        actor: "Ema Karena",
199
+      },
200
+      {
201
+        reaction: "❤",
202
+        actor: "Alicia Charron",
203
+      },
204
+      {
205
+        reaction: "❤",
206
+        actor: "Hugo Mhl",
207
+      },
208
+      {
209
+        reaction: "❤",
210
+        actor: "Theophile Pere",
211
+      },
212
+      {
213
+        reaction: "❤",
214
+        actor: "Maël Drarig",
215
+      },
216
+      {
217
+        reaction: "❤",
218
+        actor: "Lucien Lhotelier",
219
+      },
220
+    ],
221
+    is_unsent: null,
222
+    is_geoblocked_for_viewer: false,
223
+  },
224
+  {
225
+    sender_name: "Elias Cheddar",
226
+    timestamp_ms: 1730924456650,
227
+    content: "Pas mal celui là en vrai",
228
+    sticker: null,
229
+    share: null,
230
+    photos: null,
231
+    videos: null,
232
+    gifs: null,
233
+    audio_files: null,
234
+    call_duration: null,
235
+    reactions: [
236
+      {
237
+        reaction: "😆",
238
+        actor: "Mikaël Royet",
239
+      },
240
+      {
241
+        reaction: "❤",
242
+        actor: "Sami Zaiter",
243
+      },
244
+      {
245
+        reaction: "😆",
246
+        actor: "Ema Karena",
247
+      },
248
+      {
249
+        reaction: "❤",
250
+        actor: "Alicia Charron",
251
+      },
252
+      {
253
+        reaction: "❤",
254
+        actor: "Amalia Arnaud",
255
+      },
256
+      {
257
+        reaction: "❤",
258
+        actor: "Arthur Salaün",
259
+      },
260
+      {
261
+        reaction: "❤",
262
+        actor: "Djem Dean",
263
+      },
264
+    ],
265
+    is_unsent: null,
266
+    is_geoblocked_for_viewer: false,
267
+  },
268
+  {
269
+    sender_name: "Clervie Guillemot",
270
+    timestamp_ms: 1708536294155,
271
+    content:
272
+      "Punaiz c’est les premiers comptages de 2024 bonne année les potes",
273
+    sticker: null,
274
+    share: null,
275
+    photos: null,
276
+    videos: null,
277
+    gifs: null,
278
+    audio_files: null,
279
+    call_duration: null,
280
+    reactions: [
281
+      {
282
+        reaction: "❤",
283
+        actor: "Vivien Motte",
284
+      },
285
+      {
286
+        reaction: "🥰",
287
+        actor: "Pauk Brunstein-Compard",
288
+      },
289
+      {
290
+        reaction: "❤",
291
+        actor: "Augustin Lhotelier Ivey",
292
+      },
293
+      {
294
+        reaction: "🥳",
295
+        actor: "Elias Cheddar",
296
+      },
297
+      {
298
+        reaction: "🎊",
299
+        actor: "Victor Mélou",
300
+      },
301
+      {
302
+        reaction: "❤",
303
+        actor: "Jules Chanoine",
304
+      },
305
+    ],
306
+    is_unsent: null,
307
+    is_geoblocked_for_viewer: false,
308
+  },
309
+  {
310
+    sender_name: "Elias Cheddar",
311
+    timestamp_ms: 1708910034369,
312
+    content:
313
+      "Bonjour à tous ! \nDans une démarche d'amélioration continue 📈 du comptage que nous réalisons tous ensemble main dans la main 👫👫, j'ai entrepris d'analyser les comptages réalisés jusqu'ici afin d'identifier des oublis 🙀\nJe ne vous laisse pas mariner 👨‍🍳 trop longtemps, le total s'élève à 3381 😳😳. Ça représente 4.5% des 74127 que nous avons atteint aujourd'hui.\n4.5% d'erreur ❌? D'inattention 🙈? Peut-être en partie, mais je pense qu'il s'agit surtout de 4.5% d'envie d'avancer 🏃, d'atteindre nos objectifs, d'ivresse de la passion 🤩 !\nQui serions nous pour juger une telle qui, grisée par la sensation de voir les chiffres 🔢 défiler, ne s'est pas vue sauter 5 valeurs, ou encore untel qui, peu formé à l'exercice🤸‍♂, confond un 6 et un 8 🔍? \n\nBon j'ai la flemme de continuer ce discours, toujours est-il que les données sont disponibles dans ce google docs : https://docs.google.com/spreadsheets/d/1peCrGqlTw2XaJYHjCvFc7XI_DKfrCP2fMxYPY8Z7Ty8/edit?usp=sharing",
314
+    sticker: null,
315
+    share: {
316
+      link: "https://docs.google.com/spreadsheets/d/1peCrGqlTw2XaJYHjCvFc7XI_DKfrCP2fMxYPY8Z7Ty8/edit?usp=sharing",
317
+      share_text:
318
+        "holes début,fin,taille,responsable,date1,date2,justification,résolu 299,301,2,Victor Mélou,15/06/2020 18:23:31,15/06/2020 19:09:59,Je crois qu'il avait envoyé l'affiche du film 300,ok 306,310,4,Victor Mélou,15/06/2020 19:10:13,15/06/2020 19:11:41 473,475,2,Elias Cheddar,15/06/2020 19:49:42,15/0...",
319
+    },
320
+    photos: null,
321
+    videos: null,
322
+    gifs: null,
323
+    audio_files: null,
324
+    call_duration: null,
325
+    reactions: [
326
+      {
327
+        reaction: "❤",
328
+        actor: "Mikaël Royet",
329
+      },
330
+      {
331
+        reaction: "❤",
332
+        actor: "Maï Thrvl",
333
+      },
334
+      {
335
+        reaction: "😮",
336
+        actor: "Clervie Guillemot",
337
+      },
338
+      {
339
+        reaction: "😆",
340
+        actor: "Gabriel Reboux",
341
+      },
342
+      {
343
+        reaction: "😆",
344
+        actor: "Victor Mélou",
345
+      },
346
+      {
347
+        reaction: "😆",
348
+        actor: "Jules Chanoine",
349
+      },
350
+    ],
351
+    is_unsent: null,
352
+    is_geoblocked_for_viewer: false,
353
+  },
354
+  {
355
+    sender_name: "Léonard D'Aqr",
356
+    timestamp_ms: 1722434371354,
357
+    content: "80000",
358
+    sticker: null,
359
+    share: null,
360
+    photos: null,
361
+    videos: null,
362
+    gifs: null,
363
+    audio_files: null,
364
+    call_duration: null,
365
+    reactions: [
366
+      {
367
+        reaction: "❤",
368
+        actor: "Mikaël Royet",
369
+      },
370
+      {
371
+        reaction: "❤",
372
+        actor: "Jules Borderie",
373
+      },
374
+      {
375
+        reaction: "😮",
376
+        actor: "Maël Delanoë",
377
+      },
378
+      {
379
+        reaction: "❤",
380
+        actor: "Elias Cheddar",
381
+      },
382
+      {
383
+        reaction: "❤",
384
+        actor: "Victor Mélou",
385
+      },
386
+      {
387
+        reaction: "❤",
388
+        actor: "Jules Chanoine",
389
+      },
390
+    ],
391
+    is_unsent: null,
392
+    is_geoblocked_for_viewer: false,
393
+  },
394
+  {
395
+    sender_name: "Antoine Ltllc",
396
+    timestamp_ms: 1726075192889,
397
+    content: "92000",
398
+    sticker: null,
399
+    share: null,
400
+    photos: null,
401
+    videos: null,
402
+    gifs: null,
403
+    audio_files: null,
404
+    call_duration: null,
405
+    reactions: [
406
+      {
407
+        reaction: "😮",
408
+        actor: "Mikaël Royet",
409
+      },
410
+      {
411
+        reaction: "❤",
412
+        actor: "Ema Karena",
413
+      },
414
+      {
415
+        reaction: "👍",
416
+        actor: "Maël Delanoë",
417
+      },
418
+      {
419
+        reaction: "❤",
420
+        actor: "Alicia Charron",
421
+      },
422
+      {
423
+        reaction: "❤",
424
+        actor: "Victor Mélou",
425
+      },
426
+      {
427
+        reaction: "❤",
428
+        actor: "Maël Drarig",
429
+      },
430
+    ],
431
+    is_unsent: null,
432
+    is_geoblocked_for_viewer: false,
433
+  },
434
+  {
435
+    sender_name: "Maël Drarig",
436
+    timestamp_ms: 1709119466755,
437
+    content: "Vous pouvez compter sur moi et moi je compterai pour vous",
438
+    sticker: null,
439
+    share: null,
440
+    photos: null,
441
+    videos: null,
442
+    gifs: null,
443
+    audio_files: null,
444
+    call_duration: null,
445
+    reactions: [
446
+      {
447
+        reaction: "😆",
448
+        actor: "Mikaël Royet",
449
+      },
450
+      {
451
+        reaction: "😮",
452
+        actor: "Clervie Guillemot",
453
+      },
454
+      {
455
+        reaction: "📠",
456
+        actor: "Maël Delanoë",
457
+      },
458
+      {
459
+        reaction: "😮",
460
+        actor: "Elias Cheddar",
461
+      },
462
+      {
463
+        reaction: "🤯",
464
+        actor: "Victor Mélou",
465
+      },
466
+    ],
467
+    is_unsent: null,
468
+    is_geoblocked_for_viewer: false,
469
+  },
470
+];
471
+
472
+export default MostReactedMessages;
473
+export type { Message };

+ 181
- 0
vite-wrapped/src/steps/MostLikedMessage.tsx Näytä tiedosto

@@ -0,0 +1,181 @@
1
+import { motion, Variants } from "framer-motion";
2
+import { StepProps } from "./stepProps.ts";
3
+import React, { useEffect, useRef, useState } from "react";
4
+import MostReactedParticipants from "../data/most_reacted_contributors.ts";
5
+import ContributorsContributionsWithReactions from "../data/contributors_contributions_with_reaction.ts";
6
+import { Message } from "../data/most_reacted_messages.ts";
7
+
8
+type VariantProps = {
9
+  delay: number;
10
+};
11
+
12
+type RunningAnimations = {
13
+  [key: string]: number;
14
+};
15
+
16
+type ReactionCount = { reaction: string; count: number };
17
+
18
+const getParticipantReactionCounts = (participant: string): [ReactionCount] => {
19
+  return ContributorsContributionsWithReactions[participant]
20
+    .filter((contribution: Message) => contribution.sender_name === participant)
21
+    .reduce((acc: [ReactionCount], contribution: Message) => {
22
+      contribution.reactions.forEach((reaction) => {
23
+        const existingReaction: undefined | ReactionCount = acc.find(
24
+          (existingReaction: ReactionCount) =>
25
+            existingReaction.reaction === reaction.reaction
26
+        );
27
+        if (existingReaction) {
28
+          existingReaction.count++;
29
+        } else {
30
+          acc.push({ reaction: reaction.reaction, count: 1 });
31
+        }
32
+      });
33
+      return acc;
34
+    }, [])
35
+    .sort((a, b) => b.count - a.count);
36
+};
37
+
38
+const getReactionString = (counts: [ReactionCount]) => {
39
+    return counts.map((reactionCount) => {
40
+        return `${reactionCount.reaction.repeat(reactionCount.count)}`;
41
+    });
42
+}
43
+
44
+function usePrevious(value: any) {
45
+  const ref = useRef();
46
+  useEffect(() => {
47
+    ref.current = value;
48
+  }, [value]);
49
+  return ref.current;
50
+}
51
+
52
+const TextAreaVariants: Variants = {
53
+  "1": (props: VariantProps) => ({
54
+    rotateY: 1,
55
+    z: 0.2,
56
+    transition: {
57
+      duration: 1.5,
58
+      delay: 1 + props.delay,
59
+    },
60
+  }),
61
+};
62
+
63
+const TextAreaStyle = {
64
+  rotateY: 90,
65
+};
66
+
67
+function MostLikedMessage({ progress }: StepProps) {
68
+  const [currentVariant, setCurrentVariant] = useState("1");
69
+  const [runningAnimations, setRunningAnimations] = useState<RunningAnimations>(
70
+    {}
71
+  );
72
+  const previousRunningAnimations = usePrevious(runningAnimations);
73
+
74
+  useEffect(() => {
75
+    for (const variant in runningAnimations) {
76
+      if (
77
+        runningAnimations[variant] === 0 &&
78
+        previousRunningAnimations[variant] !== 0
79
+      ) {
80
+        if (variant === "1") {
81
+          setCurrentVariant("1");
82
+        } else if (variant === "2") {
83
+          setCurrentVariant("1");
84
+        }
85
+      }
86
+    }
87
+  }, [runningAnimations]);
88
+
89
+  const animationComplete = (variant: string) => {
90
+    console.log("animationComplete", variant);
91
+    decrementAnimation(variant);
92
+  };
93
+
94
+  const animationStarted = (variant: string) => {
95
+    console.log("animationStarted", variant);
96
+    incrementAnimation(variant);
97
+  };
98
+
99
+  const incrementAnimation = (animation: string) => {
100
+    setRunningAnimations((prev: RunningAnimations) => {
101
+      const newRunningAnimations = { ...prev };
102
+      if (!newRunningAnimations[animation]) {
103
+        newRunningAnimations[animation] = 1;
104
+      } else {
105
+        newRunningAnimations[animation]++;
106
+      }
107
+      return newRunningAnimations;
108
+    });
109
+  };
110
+
111
+  const decrementAnimation = (animation: string) => {
112
+    setRunningAnimations((prev: RunningAnimations) => {
113
+      const newRunningAnimations = { ...prev };
114
+      if (newRunningAnimations[animation] > 0) {
115
+        newRunningAnimations[animation]--;
116
+      }
117
+      return newRunningAnimations;
118
+    });
119
+  };
120
+
121
+  // A text area that starts facing back, not visible, and
122
+  // then rotates to face the user, making it visible
123
+  return (
124
+    <div
125
+      style={{
126
+        position: "absolute",
127
+        display: "flex",
128
+        justifyContent: "center",
129
+        alignItems: "center",
130
+        width: "100%",
131
+        height: "100%",
132
+        backgroundColor: "rgba(0,0,0,0.5)",
133
+        color: "white",
134
+      }}
135
+    >
136
+      <motion.div
137
+        initial={TextAreaStyle}
138
+        variants={TextAreaVariants}
139
+        animate={currentVariant}
140
+        custom={{ delay: 0 }}
141
+        onAnimationStart={() => animationStarted(currentVariant)}
142
+        onAnimationComplete={() => animationComplete(currentVariant)}
143
+      >
144
+        <table>
145
+          {MostReactedParticipants.slice(0, 6).map((participant, index) => (
146
+            <tr
147
+              style={{
148
+                display: "flex",
149
+                flexDirection: "row",
150
+                alignItems: "start",
151
+                justifyContent: "start",
152
+                padding: "1rem",
153
+                width: "30em"
154
+              }}
155
+              key={index}
156
+            >
157
+              <td style={{ paddingRight: "1em", verticalAlign: "top" }}>{participant.participant.name}</td>
158
+              <td
159
+                style={{
160
+                  display: "flex",
161
+                  gridTemplateColumns: "repeat(2, 1fr)",
162
+                  flexDirection: "row",
163
+                  flexWrap: "wrap",
164
+                  marginLeft: "1rem",
165
+                  verticalAlign: "top",
166
+                  gap: "0.5em",
167
+                  //width: "10%",
168
+                  wordBreak: "break-all",
169
+                }}
170
+              >
171
+                {getReactionString(getParticipantReactionCounts(participant.participant.name))}
172
+              </td>
173
+            </tr>
174
+          ))}
175
+        </table>
176
+      </motion.div>
177
+    </div>
178
+  );
179
+}
180
+
181
+export default MostLikedMessage;

Loading…
Peruuta
Tallenna