@@ -3,14 +3,15 @@ import React from 'react'
3
3
import { Attendees } from './elements'
4
4
import shuffle from '../../helpers/shuffle'
5
5
6
- const dedupeAttendees = ( attendeesArray ) => {
7
- const list = [ ] ;
6
+ const dedupeAttendees = attendeesArray => {
7
+ const list = [ ]
8
8
const deduped = attendeesArray . reduce ( ( acc , current ) => {
9
- const cleanGhLink = current . ghLink . startsWith ( '@' ) ? current . ghLink . slice ( 1 ) : current . ghLink
10
-
9
+ const cleanGhLink = current . data . ghLink . startsWith ( '@' )
10
+ ? current . data . ghLink . slice ( 1 )
11
+ : current . data . ghLink
11
12
12
13
if ( list . includes ( cleanGhLink ) ) {
13
- return acc ;
14
+ return acc
14
15
}
15
16
16
17
list . push ( cleanGhLink )
@@ -23,31 +24,23 @@ const dedupeAttendees = (attendeesArray) => {
23
24
}
24
25
25
26
export default ( { attendees } ) => {
26
-
27
27
const dedupedAttendees = dedupeAttendees ( attendees )
28
28
29
29
return (
30
30
< Attendees >
31
- { shuffle ( dedupedAttendees ) . map ( a => {
31
+ { shuffle ( dedupedAttendees ) . map ( ( { data : a } ) => {
32
32
// Pretty ugly but this way we do not get duplicate https://github.com urls
33
33
34
34
const cleanGhLink = a . ghLink . startsWith ( '@' ) ? a . ghLink . slice ( 1 ) : a . ghLink
35
35
36
- const ghLink = `https://github.com/${ cleanGhLink . trim ( ) . replace ( 'https://github.com/' , '' ) } ` ;
37
- return ( < li key = { a . id } >
38
- < a
39
- href = { ghLink }
40
- target = "_blank"
41
- title = { a . name }
42
- rel = "noopener noreferrer"
43
- >
44
- < img
45
- src = { `${ ghLink } .png?size=50` }
46
- alt = { a . name }
47
- width = "50"
48
- />
49
- </ a >
50
- </ li > ) ;
36
+ const ghLink = `https://github.com/${ cleanGhLink . trim ( ) . replace ( 'https://github.com/' , '' ) } `
37
+ return (
38
+ < li key = { a . id } >
39
+ < a href = { ghLink } target = "_blank" title = { a . name } rel = "noopener noreferrer" >
40
+ < img src = { `${ ghLink } .png?size=50` } alt = { a . name } width = "50" />
41
+ </ a >
42
+ </ li >
43
+ )
51
44
} ) }
52
45
</ Attendees >
53
46
)
0 commit comments