11import React , { useContext , useEffect , useState } from 'react'
2- import { HiTicket } from 'react-icons/hi' ;
3- import CardComponent from "../components/CardComponent" ;
4- import ListComponent from "../components/ListComponent" ;
2+ import CardComponent from '../components/CardComponent'
3+ import ListComponent from '../components/ListComponent'
54import confstechApi from '../services/confstech'
6- import { MdAccessTime } from " react-icons/md"
7- import { flag } from 'country-emoji' ;
8- import { IoIosPin } from " react-icons/io"
9- import { RiCalendarEventFill } from " react-icons/ri" ;
5+ import { MdAccessTime } from ' react-icons/md'
6+ import { flag } from 'country-emoji'
7+ import { IoIosPin } from ' react-icons/io'
8+ import { RiCalendarEventFill } from ' react-icons/ri'
109import PreferencesContext from '../preferences/PreferencesContext'
11- import CardLink from " ../components/CardLink" ;
10+ import CardLink from ' ../components/CardLink'
1211import CardItemWithActions from '../components/CardItemWithActions'
13- import ColoredLanguagesBadge from "../components/ColoredLanguagesBadge"
12+ import ColoredLanguagesBadge from '../components/ColoredLanguagesBadge'
13+ import { Attributes } from 'src/lib/analytics'
1414
15-
16- const ConferenceItem = ( { conf, index, analyticsTag } ) => {
17-
15+ const ConferenceItem = ( { conf, index } ) => {
1816 const { listingMode } = useContext ( PreferencesContext )
1917
2018 const formatConfsDate = ( date ) => {
21- const monthNames = [ "January" , "February" , "March" , "April" , "May" , "June" ,
22- "July" , "August" , "September" , "October" , "November" , "December"
23- ] ;
24-
25- return `${ monthNames [ date . getMonth ( ) ] } ${ ( "0" + date . getDate ( ) ) . slice ( - 2 ) } `
19+ const monthNames = [
20+ 'January' ,
21+ 'February' ,
22+ 'March' ,
23+ 'April' ,
24+ 'May' ,
25+ 'June' ,
26+ 'July' ,
27+ 'August' ,
28+ 'September' ,
29+ 'October' ,
30+ 'November' ,
31+ 'December' ,
32+ ]
2633
34+ return `${ monthNames [ date . getMonth ( ) ] } ${ ( '0' + date . getDate ( ) ) . slice ( - 2 ) } `
2735 }
2836
2937 const ConferenceLocation = ( ) => {
30- return (
31- conf . online ?
32- "🌐 Online" :
33- `${ flag ( conf . country . replace ( / [ ^ a - z A - Z ] / g, "" ) ) } ${ conf . city } `
34- )
38+ return conf . online
39+ ? '🌐 Online'
40+ : `${ flag ( conf . country . replace ( / [ ^ a - z A - Z ] / g, '' ) ) } ${ conf . city } `
3541 }
3642
3743 const ConferenceDate = ( ) => {
38- let value = ""
44+ let value = ''
3945 if ( conf . startDate ) {
4046 value = `${ formatConfsDate ( conf . startDate ) } `
4147 }
4248 if ( conf . endDate && conf . endDate > conf . startDate ) {
4349 value = `${ value } - ${
44- conf . endDate . getMonth ( ) === conf . startDate . getMonth ( ) ?
45- ( "0" + conf . endDate . getDate ( ) ) . slice ( - 2 )
50+ conf . endDate . getMonth ( ) === conf . startDate . getMonth ( )
51+ ? ( '0' + conf . endDate . getDate ( ) ) . slice ( - 2 )
4652 : formatConfsDate ( conf . endDate )
47- } `
53+ } `
4854 }
4955 return value
5056 }
@@ -54,36 +60,47 @@ const ConferenceItem = ({ conf, index, analyticsTag }) => {
5460 index = { index }
5561 key = { index }
5662 item = { { ...conf , title : conf . name } }
57- cardItem = { (
63+ cardItem = {
5864 < >
59- < CardLink link = { conf . url } analyticsSource = { analyticsTag } >
60- < RiCalendarEventFill className = { "rowTitleIcon" } />
65+ < CardLink
66+ link = { conf . url }
67+ analyticsAttributes = { {
68+ [ Attributes . TRIGERED_FROM ] : 'card' ,
69+ [ Attributes . TITLE ] : conf . name ,
70+ [ Attributes . LINK ] : conf . url ,
71+ [ Attributes . SOURCE ] : 'conferences' ,
72+ } } >
73+ < RiCalendarEventFill className = { 'rowTitleIcon' } />
6174 { conf . name }
6275 </ CardLink >
63- {
64- listingMode === "normal" ?
76+ { listingMode === 'normal' ? (
6577 < >
6678 < div className = "rowDescription" >
67- < span className = "rowItem" > < IoIosPin className = "rowItemIcon" /> { ConferenceLocation ( ) } </ span >
68- < span className = "rowItem" > < MdAccessTime className = "rowItemIcon" /> { ConferenceDate ( ) } </ span >
79+ < span className = "rowItem" >
80+ < IoIosPin className = "rowItemIcon" /> { ConferenceLocation ( ) }
81+ </ span >
82+ < span className = "rowItem" >
83+ < MdAccessTime className = "rowItemIcon" /> { ConferenceDate ( ) }
84+ </ span >
6985 </ div >
7086 < div className = "rowDetails" >
7187 < ColoredLanguagesBadge languages = { [ conf . tag . value ] } />
7288 </ div >
73- </ > :
89+ </ >
90+ ) : (
7491 < div className = "rowDescription" >
75- < span className = "rowItem" > < MdAccessTime className = "rowItemIcon" /> { ConferenceDate ( ) } </ span >
92+ < span className = "rowItem" >
93+ < MdAccessTime className = "rowItemIcon" /> { ConferenceDate ( ) }
94+ </ span >
7695 </ div >
77- }
78-
96+ ) }
7997 </ >
80- ) }
98+ }
8199 />
82100 )
83101}
84102
85-
86- function ConferencesCard ( { label, icon, analyticsTag, withAds } ) {
103+ function ConferencesCard ( { label, icon, withAds } ) {
87104 const preferences = useContext ( PreferencesContext )
88105 const { userSelectedTags = [ ] } = preferences
89106 const [ refresh , setRefresh ] = useState ( true )
@@ -120,7 +137,7 @@ function ConferencesCard({ label, icon, analyticsTag, withAds }) {
120137 }
121138
122139 const renderItem = ( item , index ) => (
123- < ConferenceItem conf = { item } key = { `cf-${ index } ` } index = { index } analyticsTag = { analyticsTag } />
140+ < ConferenceItem conf = { item } key = { `cf-${ index } ` } index = { index } />
124141 )
125142
126143 return (
@@ -138,4 +155,4 @@ function ConferencesCard({ label, icon, analyticsTag, withAds }) {
138155 )
139156}
140157
141- export default ConferencesCard
158+ export default ConferencesCard
0 commit comments