tf-checkout-react 1.0.99 → 1.0.100-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +278 -1
  2. package/dist/api/index.d.ts +31 -26
  3. package/dist/components/account-settings/index.d.ts +3 -0
  4. package/dist/components/billing-info-container/index.d.ts +5 -5
  5. package/dist/components/billing-info-container/utils.d.ts +1 -0
  6. package/dist/components/common/CustomField.d.ts +1 -1
  7. package/dist/components/common/DatePickerField.d.ts +14 -0
  8. package/dist/components/common/RedirectModal.d.ts +7 -0
  9. package/dist/components/common/SnackbarAlert.d.ts +13 -0
  10. package/dist/components/confirmationContainer/index.d.ts +2 -1
  11. package/dist/components/countdown/index.d.ts +4 -1
  12. package/dist/components/myTicketsContainer/tableConfig.d.ts +0 -1
  13. package/dist/components/orderDetailsContainer/index.d.ts +5 -1
  14. package/dist/components/orderDetailsContainer/ticketsTable.d.ts +4 -1
  15. package/dist/components/paymentContainer/index.d.ts +3 -1
  16. package/dist/components/rsvpContainer/index.d.ts +7 -0
  17. package/dist/components/stripePayment/index.d.ts +2 -1
  18. package/dist/components/ticketResale/index.d.ts +5 -3
  19. package/dist/components/ticketsContainer/AccessCodeSection.d.ts +7 -0
  20. package/dist/components/ticketsContainer/PromoCodeSection.d.ts +6 -9
  21. package/dist/components/ticketsContainer/TicketsSection.d.ts +5 -3
  22. package/dist/components/ticketsContainer/index.d.ts +13 -2
  23. package/dist/components/timerWidget/index.d.ts +3 -3
  24. package/dist/env.d.ts +1 -0
  25. package/dist/images/cross.svg +44 -0
  26. package/dist/images/done.svg +3 -3
  27. package/dist/index.d.ts +2 -0
  28. package/dist/tf-checkout-react.cjs.development.js +1400 -575
  29. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  30. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  31. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  32. package/dist/tf-checkout-react.esm.js +1409 -586
  33. package/dist/tf-checkout-react.esm.js.map +1 -1
  34. package/dist/tf-checkout-styles.css +1 -1
  35. package/dist/utils/cookies.d.ts +3 -0
  36. package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +6 -1
  37. package/dist/utils/downloadPDF.d.ts +1 -1
  38. package/dist/utils/getDomain.d.ts +1 -0
  39. package/dist/utils/index.d.ts +2 -0
  40. package/package.json +89 -89
  41. package/src/.DS_Store +0 -0
  42. package/src/.d.ts +2 -2
  43. package/src/api/index.ts +313 -278
  44. package/src/assets/images/cross.svg +44 -0
  45. package/src/assets/images/done.svg +3 -3
  46. package/src/components/.DS_Store +0 -0
  47. package/src/components/account-settings/index.tsx +161 -0
  48. package/src/components/account-settings/style.css +200 -0
  49. package/src/components/billing-info-container/index.tsx +821 -777
  50. package/src/components/billing-info-container/style.css +106 -106
  51. package/src/components/billing-info-container/utils.ts +233 -223
  52. package/src/components/common/CheckboxField.tsx +41 -41
  53. package/src/components/common/CustomField.tsx +87 -84
  54. package/src/components/common/DatePickerField.tsx +98 -0
  55. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  56. package/src/components/common/Loader.tsx +9 -9
  57. package/src/components/common/RadioField.tsx +35 -35
  58. package/src/components/common/RedirectModal.tsx +43 -0
  59. package/src/components/common/SelectField.tsx +80 -80
  60. package/src/components/common/SnackbarAlert.tsx +54 -0
  61. package/src/components/common/dist/PhoneNumberField.js +96 -0
  62. package/src/components/common/index.tsx +4 -4
  63. package/src/components/confirmModal/index.tsx +51 -51
  64. package/src/components/confirmModal/style.css +21 -21
  65. package/src/components/confirmationContainer/config.ts +72 -72
  66. package/src/components/confirmationContainer/index.tsx +197 -194
  67. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  68. package/src/components/confirmationContainer/style.css +202 -202
  69. package/src/components/countdown/index.tsx +100 -89
  70. package/src/components/countdown/style.css +9 -9
  71. package/src/components/index.ts +7 -7
  72. package/src/components/loginModal/index.tsx +171 -209
  73. package/src/components/loginModal/style.css +71 -71
  74. package/src/components/myTicketsContainer/index.tsx +201 -137
  75. package/src/components/myTicketsContainer/row.tsx +41 -41
  76. package/src/components/myTicketsContainer/style.css +40 -40
  77. package/src/components/myTicketsContainer/tableConfig.tsx +32 -34
  78. package/src/components/orderDetailsContainer/index.tsx +289 -249
  79. package/src/components/orderDetailsContainer/style.css +73 -73
  80. package/src/components/orderDetailsContainer/ticketsTable.tsx +177 -124
  81. package/src/components/paymentContainer/index.tsx +352 -284
  82. package/src/components/registerModal/index.tsx +183 -190
  83. package/src/components/rsvpContainer/index.tsx +126 -0
  84. package/src/components/stripePayment/index.tsx +258 -253
  85. package/src/components/stripePayment/style.css +60 -60
  86. package/src/components/ticketResale/index.tsx +74 -56
  87. package/src/components/ticketResaleModal/index.tsx +213 -210
  88. package/src/components/ticketResaleModal/style.css +28 -28
  89. package/src/components/ticketsContainer/AccessCodeSection.tsx +50 -0
  90. package/src/components/ticketsContainer/PromoCodeSection.tsx +89 -99
  91. package/src/components/ticketsContainer/ReferralLogic.tsx +31 -33
  92. package/src/components/ticketsContainer/TicketRow.tsx +89 -83
  93. package/src/components/ticketsContainer/TicketsSection.tsx +87 -81
  94. package/src/components/ticketsContainer/index.tsx +506 -409
  95. package/src/components/ticketsContainer/style.css +181 -181
  96. package/src/components/ticketsContainer/utils.ts +11 -11
  97. package/src/components/timerWidget/index.tsx +87 -70
  98. package/src/components/timerWidget/style.css +34 -26
  99. package/src/components/waitingList/index.tsx +178 -178
  100. package/src/components/waitingList/style.css +26 -26
  101. package/src/env.ts +20 -19
  102. package/src/index.ts +15 -13
  103. package/src/normalizers/index.ts +45 -45
  104. package/src/types/billing-info-data.ts +37 -37
  105. package/src/types/payment-field.ts +7 -7
  106. package/src/types/referral-promotion.ts +7 -7
  107. package/src/utils/cookies.ts +42 -0
  108. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +71 -59
  109. package/src/utils/downloadPDF.tsx +52 -30
  110. package/src/utils/formikErrorFocus.ts +24 -24
  111. package/src/utils/getDomain.ts +15 -0
  112. package/src/utils/getImage.ts +14 -14
  113. package/src/utils/getQueryVariable.ts +13 -13
  114. package/src/utils/index.ts +7 -5
  115. package/src/utils/setConfigs.ts +26 -26
  116. package/src/utils/showZero.tsx +10 -10
  117. package/src/validators/index.ts +20 -20
@@ -1,137 +1,201 @@
1
- import React, { useEffect, useState } from 'react'
2
- import './style.css'
3
-
4
- import Table from '@mui/material/Table'
5
- import TableBody from '@mui/material/TableBody'
6
- import TableCell from '@mui/material/TableCell'
7
- import TableContainer from '@mui/material/TableContainer'
8
- import TableHead from '@mui/material/TableHead'
9
- import TableRow from '@mui/material/TableRow'
10
- import Paper from '@mui/material/Paper'
11
- import TablePagination from '@mui/material/TablePagination'
12
- import CircularProgress from '@mui/material/CircularProgress'
13
- import TextField from '@mui/material/TextField'
14
- import Autocomplete from '@mui/material/Autocomplete'
15
- import _get from 'lodash/get'
16
- import MyTicketsRow, { RowItems } from './row'
17
- import tableConfig from './tableConfig'
18
- import { getOrders } from '../../api'
19
-
20
- interface MyTicketsTypes {
21
- handleDetailsInfo: (id: string) => void;
22
- onGetOrdersSuccess: (res: any) => void;
23
- onGetOrdersError: (err: any) => void;
24
-
25
- theme?: 'light' | 'dark';
26
- }
27
-
28
- interface EventFilter {
29
- event_name: string;
30
- url_name: string;
31
- }
32
-
33
- export const MyTicketsContainer = ({
34
- handleDetailsInfo = () => {},
35
- onGetOrdersSuccess = () => {},
36
- onGetOrdersError = () => {},
37
- theme = 'dark',
38
- }: MyTicketsTypes) => {
39
- const [data, setData] = useState<any>(null)
40
- const [loading, setLoading] = useState(true)
41
- const [limit, setLimit] = useState(10)
42
- const [filter, setFilter] = useState('')
43
-
44
- //just once
45
- useEffect(() => {
46
- fetchData(1, limit, filter)
47
- }, [])
48
-
49
- const fetchData = async (page: number, limit: number, filter: string) => {
50
- try {
51
- setLoading(true)
52
- const response = await getOrders(page, limit, filter)
53
- onGetOrdersSuccess(response)
54
-
55
- const data = _get(response, 'data.data.attributes')
56
- data.page -= 1
57
-
58
- setData(data)
59
- } catch (error) {
60
- onGetOrdersError(error)
61
- } finally {
62
- setLoading(false)
63
- }
64
- }
65
-
66
- const handleChangePage = (_event: any, newPage: number) => {
67
- fetchData(newPage + 1, limit, filter)
68
- }
69
-
70
- const handleChangeRowsPerPage = (
71
- event: React.ChangeEvent<HTMLInputElement>
72
- ) => {
73
- fetchData(1, +event.target.value, filter)
74
- setLimit(+event.target.value)
75
- }
76
-
77
- const onChange = (
78
- _event: React.SyntheticEvent<Element, Event>,
79
- eventFilter: EventFilter | null
80
- ) => {
81
- fetchData(1, limit, eventFilter?.url_name || '')
82
- setFilter(eventFilter?.url_name || '')
83
- }
84
-
85
- return (
86
- <div className={`my-ticket ${theme}`}>
87
- {loading && (
88
- <div className="loading">
89
- <CircularProgress />
90
- </div>
91
- )}
92
- {data && (
93
- <>
94
- <Autocomplete
95
- disablePortal
96
- id="combo-box-demo"
97
- getOptionLabel={(option: EventFilter) => option.event_name}
98
- onChange={onChange}
99
- options={data.purchased_events}
100
- sx={{ width: 300 }}
101
- renderInput={params => <TextField {...params} label="Events" />}
102
- />
103
- <TableContainer component={Paper} className="my-ticket-table">
104
- <Table aria-label="collapsible table">
105
- <TableHead>
106
- <TableRow>
107
- {tableConfig().header.map((column: string, index: number) => (
108
- <TableCell key={index}>{column}</TableCell>
109
- ))}
110
- <TableCell />
111
- </TableRow>
112
- </TableHead>
113
- <TableBody>
114
- {data.orders?.map((row: RowItems) => (
115
- <MyTicketsRow
116
- key={row.id}
117
- row={row}
118
- handleDetailsInfo={handleDetailsInfo}
119
- />
120
- ))}
121
- </TableBody>
122
- </Table>
123
- </TableContainer>
124
- <TablePagination
125
- rowsPerPageOptions={[10, 25, 100]}
126
- component="div"
127
- count={data.total_count}
128
- rowsPerPage={limit}
129
- page={data.page}
130
- onPageChange={handleChangePage}
131
- onRowsPerPageChange={handleChangeRowsPerPage}
132
- />
133
- </>
134
- )}
135
- </div>
136
- )
137
- }
1
+ import React, { useEffect, useState } from 'react'
2
+ import './style.css'
3
+
4
+ import Table from '@mui/material/Table'
5
+ import TableBody from '@mui/material/TableBody'
6
+ // import TableCell from '@mui/material/TableCell'
7
+ import TableContainer from '@mui/material/TableContainer'
8
+ // import TableHead from '@mui/material/TableHead'
9
+ // import TableRow from '@mui/material/TableRow'
10
+ import Paper from '@mui/material/Paper'
11
+ import TablePagination from '@mui/material/TablePagination'
12
+ import CircularProgress from '@mui/material/CircularProgress'
13
+ import TextField from '@mui/material/TextField'
14
+ import Autocomplete from '@mui/material/Autocomplete'
15
+ import _get from 'lodash/get'
16
+ import MyTicketsRow, { RowItems } from './row'
17
+ // import tableConfig from './tableConfig'
18
+ import { getOrders } from '../../api'
19
+ import { LoginModal } from '../loginModal'
20
+ import axios from 'axios'
21
+
22
+ interface MyTicketsTypes {
23
+ handleDetailsInfo: (id: string) => void;
24
+ onGetOrdersSuccess: (res: any) => void;
25
+ onGetOrdersError: (err: any) => void;
26
+
27
+ theme?: 'light' | 'dark';
28
+ }
29
+
30
+ interface EventFilter {
31
+ event_name: string;
32
+ url_name: string;
33
+ }
34
+
35
+ export const MyTicketsContainer = ({
36
+ handleDetailsInfo = () => {},
37
+ onGetOrdersSuccess = () => {},
38
+ onGetOrdersError = () => {},
39
+ theme = 'dark',
40
+ }: MyTicketsTypes) => {
41
+ const [data, setData] = useState<any>(null)
42
+ const [loading, setLoading] = useState(true)
43
+ const [limit, setLimit] = useState(10)
44
+ const [filter, setFilter] = useState('')
45
+
46
+ const isWindowDefined = typeof window !== 'undefined'
47
+ const [isLogged, setIsLogged] = useState(
48
+ isWindowDefined ? !!window.localStorage.getItem('access_token') : false
49
+ )
50
+ const [showModalLogin, setShowModalLogin] = useState(false)
51
+ const [userExpired, setUserExpired] = useState(false)
52
+
53
+ //just once
54
+ useEffect(() => {
55
+ fetchData(1, limit, filter)
56
+ }, [isLogged])
57
+
58
+ const fetchData = async (page: number, limit: number, filter: string) => {
59
+ try {
60
+ setLoading(true)
61
+ const response = await getOrders(page, limit, filter)
62
+ onGetOrdersSuccess(response)
63
+
64
+ const data = _get(response, 'data.data.attributes')
65
+ data.page -= 1
66
+
67
+ setData(data)
68
+ } catch (error) {
69
+ if (axios.isAxiosError(error)) {
70
+ if (error.response?.data.error === 'invalid_token') {
71
+ if (isWindowDefined) {
72
+ window.localStorage.removeItem('user_data')
73
+ window.localStorage.removeItem('access_token')
74
+ setUserExpired(true)
75
+ setShowModalLogin(true)
76
+ }
77
+ }
78
+ }
79
+ onGetOrdersError(error)
80
+ } finally {
81
+ setLoading(false)
82
+ }
83
+ }
84
+
85
+ const handleChangePage = (_event: any, newPage: number) => {
86
+ fetchData(newPage + 1, limit, filter)
87
+ }
88
+
89
+ const handleChangeRowsPerPage = (
90
+ event: React.ChangeEvent<HTMLInputElement>
91
+ ) => {
92
+ fetchData(1, +event.target.value, filter)
93
+ setLimit(+event.target.value)
94
+ }
95
+
96
+ const onChange = (
97
+ _event: React.SyntheticEvent<Element, Event>,
98
+ eventFilter: EventFilter | null
99
+ ) => {
100
+ fetchData(1, limit, eventFilter?.url_name || '')
101
+ setFilter(eventFilter?.url_name || '')
102
+ }
103
+
104
+ return (
105
+ <div className={`my-ticket ${theme}`}>
106
+ {loading && (
107
+ <div className="loading">
108
+ <CircularProgress />
109
+ </div>
110
+ )}
111
+ {!isLogged ? (
112
+ <div className="account-actions-block">
113
+ <div className="login-block">
114
+ <button
115
+ className="login-register-button"
116
+ type="button"
117
+ onClick={() => {
118
+ setShowModalLogin(true)
119
+ }}
120
+ >
121
+ Login
122
+ </button>
123
+ <div className="logo-image-container">
124
+ <img
125
+ src={
126
+ theme === 'dark'
127
+ ? 'https://www.ticketfairy.com/resources/images/logo-ttf.svg'
128
+ : 'https://www.ticketfairy.com/resources/images/logo-ttf-black.svg'
129
+ }
130
+ alt="nodata"
131
+ />
132
+ </div>
133
+ </div>
134
+ </div>
135
+ ) : null}
136
+ {data && (
137
+ <>
138
+ <h2>My Ticket Orders</h2>
139
+ <div className="order_event">
140
+ <Autocomplete
141
+ disablePortal
142
+ id="combo-box-demo"
143
+ getOptionLabel={(option: EventFilter) => option.event_name}
144
+ onChange={onChange}
145
+ options={data.purchased_events}
146
+ sx={{ width: 300 }}
147
+ renderInput={params => <TextField {...params} label="Events" />}
148
+ />
149
+ <button className="clear">CLEAR</button>
150
+ </div>
151
+
152
+ <TableContainer component={Paper} className="my-ticket-table">
153
+ <Table aria-label="collapsible table">
154
+ {/*<TableHead>
155
+ <TableRow>
156
+ {tableConfig().header.map((column: string, index: number) => (
157
+ <TableCell key={index}>{column}</TableCell>
158
+ ))}
159
+ <TableCell />
160
+ </TableRow>
161
+ </TableHead>*/}
162
+ <TableBody>
163
+ {data.orders?.map((row: RowItems) => (
164
+ <MyTicketsRow
165
+ key={row.id}
166
+ row={row}
167
+ handleDetailsInfo={handleDetailsInfo}
168
+ />
169
+ ))}
170
+ </TableBody>
171
+ </Table>
172
+ </TableContainer>
173
+ <TablePagination
174
+ rowsPerPageOptions={[10, 25, 100]}
175
+ component="div"
176
+ count={data.total_count}
177
+ rowsPerPage={limit}
178
+ page={data.page}
179
+ onPageChange={handleChangePage}
180
+ onRowsPerPageChange={handleChangeRowsPerPage}
181
+ />
182
+ </>
183
+ )}
184
+ <>
185
+ {showModalLogin && (
186
+ <LoginModal
187
+ onClose={() => {
188
+ setShowModalLogin(false)
189
+ }}
190
+ onLogin={() => {
191
+ setShowModalLogin(false)
192
+ setUserExpired(false)
193
+ setIsLogged(true)
194
+ }}
195
+ userExpired={userExpired}
196
+ />
197
+ )}
198
+ </>
199
+ </div>
200
+ )
201
+ }
@@ -1,41 +1,41 @@
1
- import React from 'react'
2
- import TableRow from '@mui/material/TableRow'
3
- import TableCell from '@mui/material/TableCell'
4
- import tableConfig from './tableConfig'
5
-
6
- export interface RowItems {
7
- id: string;
8
- date: string;
9
- image: string;
10
- eventName: string;
11
- amount: string;
12
- currency: string;
13
- }
14
-
15
- interface RowPropsTypes {
16
- row: RowItems;
17
- handleDetailsInfo: (id: string) => void;
18
- }
19
-
20
- const Row = ({ row, handleDetailsInfo }: RowPropsTypes) => {
21
- return (
22
- <TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
23
- {tableConfig().body.map((column: any, index: number) => (
24
- <TableCell component="th" scope="row" key={index}>
25
- {column(row)}
26
- </TableCell>
27
- ))}
28
- <TableCell component="th" scope="row">
29
- <button
30
- type='button'
31
- className="order-details-button"
32
- onClick={() => handleDetailsInfo(row.id)}
33
- >
34
- Details
35
- </button>
36
- </TableCell>
37
- </TableRow>
38
- );
39
- }
40
-
41
- export default Row
1
+ import React from 'react'
2
+ import TableRow from '@mui/material/TableRow'
3
+ import TableCell from '@mui/material/TableCell'
4
+ import tableConfig from './tableConfig'
5
+
6
+ export interface RowItems {
7
+ id: string;
8
+ date: string;
9
+ image: string;
10
+ eventName: string;
11
+ amount: string;
12
+ currency: string;
13
+ }
14
+
15
+ interface RowPropsTypes {
16
+ row: RowItems;
17
+ handleDetailsInfo: (id: string) => void;
18
+ }
19
+
20
+ const Row = ({ row, handleDetailsInfo }: RowPropsTypes) => {
21
+ return (
22
+ <TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
23
+ {tableConfig().body.map((column: any, index: number) => (
24
+ <TableCell component="th" scope="row" key={index}>
25
+ {column(row)}
26
+ </TableCell>
27
+ ))}
28
+ <TableCell component="th" scope="row">
29
+ <button
30
+ type='button'
31
+ className="order-details-button"
32
+ onClick={() => handleDetailsInfo(row.id)}
33
+ >
34
+ Details
35
+ </button>
36
+ </TableCell>
37
+ </TableRow>
38
+ );
39
+ }
40
+
41
+ export default Row
@@ -1,40 +1,40 @@
1
- .my-ticket {
2
- padding: 30px;
3
- }
4
- .my-ticket-table {
5
- margin-top: 30px;
6
- }
7
- .my-ticket .loading {
8
- width: 100%;
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- height: 100vh;
13
- position: fixed;
14
- top: 0;
15
- left: 0;
16
- background-color: rgba(0, 0, 0, .4);
17
- }
18
- .my-ticket .event-info {
19
- display: flex;
20
- align-items: center;
21
- }
22
- .my-ticket thead th {
23
- font-weight: 700;
24
- }
25
- .my-ticket .event-info img {
26
- width: 50px;
27
- margin-right: 10px;
28
- }
29
- .my-ticket .order-details-button {
30
- border: none;
31
- border-radius: 4px;
32
- color: #fff;
33
- background-color: #32325d;
34
- transition: all 150ms ease;
35
- cursor: pointer;
36
- padding: 10px 14px;
37
- }
38
- .my-ticket .order-details-button:hover {
39
- background-color: #505050;
40
- }
1
+ .my-ticket {
2
+ padding: 30px;
3
+ }
4
+ .my-ticket-table {
5
+ margin-top: 30px;
6
+ }
7
+ .my-ticket .loading {
8
+ width: 100%;
9
+ display: flex;
10
+ justify-content: center;
11
+ align-items: center;
12
+ height: 100vh;
13
+ position: fixed;
14
+ top: 0;
15
+ left: 0;
16
+ background-color: rgba(0, 0, 0, 0.4);
17
+ }
18
+ .my-ticket .event-info {
19
+ display: flex;
20
+ align-items: center;
21
+ }
22
+ .my-ticket thead th {
23
+ font-weight: 700;
24
+ }
25
+ .my-ticket .event-info img {
26
+ width: 50px;
27
+ margin-right: 10px;
28
+ }
29
+ .my-ticket .order-details-button {
30
+ border: none;
31
+ border-radius: 4px;
32
+ color: #fff;
33
+ background-color: #32325d;
34
+ transition: all 150ms ease;
35
+ cursor: pointer;
36
+ padding: 10px 14px;
37
+ }
38
+ .my-ticket .order-details-button:hover {
39
+ background-color: #505050;
40
+ }
@@ -1,34 +1,32 @@
1
- import React from 'react'
2
-
3
- interface EventInfoTypes {
4
- image: string;
5
- name: string;
6
- }
7
-
8
- const EventInfoItem = ({ image, name }: EventInfoTypes) => {
9
- return (
10
- <div className='event-info'>
11
- <img src={image} alt="event" />
12
- {name}
13
- </div>
14
- )
15
- }
16
-
17
- const tableConfig = (key?: string) => {
18
- let config;
19
- switch (key) {
20
- default:
21
- config = {
22
- header: ['Order No.', 'Date', 'Event', 'Total'],
23
- body: [
24
- (row: any) => row.id,
25
- (row: any) => row.date,
26
- (row: any) => <EventInfoItem image={row.image} name={row.eventName} />,
27
- (row: any) => row.currency + row.amount
28
- ],
29
- }
30
- }
31
- return config
32
- }
33
-
34
- export default tableConfig
1
+ import React from 'react'
2
+
3
+ interface EventInfoTypes {
4
+ image: string;
5
+ name: string;
6
+ }
7
+
8
+ const EventInfoItem = ({ image, name }: EventInfoTypes) => {
9
+ return (
10
+ <div className='event-info'>
11
+ <img src={image} alt="event" />
12
+ {name}
13
+ </div>
14
+ )
15
+ }
16
+
17
+ const tableConfig = (key?: string) => {
18
+ let config;
19
+ switch (key) {
20
+ default:
21
+ config = {
22
+ body: [
23
+ (row: any) => row.date,
24
+ (row: any) => <EventInfoItem image={row.image} name={row.eventName} />,
25
+ (row: any) => row.currency + row.amount
26
+ ],
27
+ }
28
+ }
29
+ return config
30
+ }
31
+
32
+ export default tableConfig