tf-checkout-react 1.0.103 → 1.0.106

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 (96) hide show
  1. package/dist/api/index.d.ts +3 -1
  2. package/dist/components/common/CustomField.d.ts +1 -1
  3. package/dist/components/common/DatePickerField.d.ts +14 -0
  4. package/dist/components/common/RedirectModal.d.ts +7 -0
  5. package/dist/components/countdown/index.d.ts +3 -1
  6. package/dist/components/orderDetailsContainer/ticketsTable.d.ts +2 -0
  7. package/dist/components/rsvpContainer/index.d.ts +7 -0
  8. package/dist/components/ticketResale/index.d.ts +5 -3
  9. package/dist/components/ticketsContainer/AccessCodeSection.d.ts +7 -0
  10. package/dist/components/ticketsContainer/PromoCodeSection.d.ts +5 -9
  11. package/dist/components/ticketsContainer/TicketsSection.d.ts +6 -3
  12. package/dist/components/ticketsContainer/index.d.ts +9 -2
  13. package/dist/components/timerWidget/index.d.ts +3 -3
  14. package/dist/images/cross.svg +44 -0
  15. package/dist/images/done.svg +3 -3
  16. package/dist/index.d.ts +2 -0
  17. package/dist/tf-checkout-react.cjs.development.js +639 -223
  18. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  19. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  20. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  21. package/dist/tf-checkout-react.esm.js +645 -231
  22. package/dist/tf-checkout-react.esm.js.map +1 -1
  23. package/dist/tf-checkout-styles.css +1 -1
  24. package/package.json +89 -89
  25. package/src/.DS_Store +0 -0
  26. package/src/.d.ts +2 -2
  27. package/src/api/index.ts +300 -278
  28. package/src/assets/images/cross.svg +44 -0
  29. package/src/assets/images/done.svg +3 -3
  30. package/src/components/.DS_Store +0 -0
  31. package/src/components/billing-info-container/index.tsx +811 -799
  32. package/src/components/billing-info-container/style.css +105 -105
  33. package/src/components/billing-info-container/utils.ts +225 -224
  34. package/src/components/common/CheckboxField.tsx +41 -41
  35. package/src/components/common/CustomField.tsx +87 -84
  36. package/src/components/common/DatePickerField.tsx +98 -0
  37. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  38. package/src/components/common/Loader.tsx +9 -9
  39. package/src/components/common/RadioField.tsx +35 -35
  40. package/src/components/common/RedirectModal.tsx +43 -0
  41. package/src/components/common/SelectField.tsx +80 -80
  42. package/src/components/common/SnackbarAlert.tsx +53 -53
  43. package/src/components/common/index.tsx +4 -4
  44. package/src/components/confirmModal/index.tsx +51 -51
  45. package/src/components/confirmModal/style.css +21 -21
  46. package/src/components/confirmationContainer/config.ts +72 -72
  47. package/src/components/confirmationContainer/index.tsx +197 -197
  48. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  49. package/src/components/confirmationContainer/style.css +202 -202
  50. package/src/components/countdown/index.tsx +98 -89
  51. package/src/components/countdown/style.css +9 -9
  52. package/src/components/index.ts +7 -7
  53. package/src/components/loginModal/index.tsx +209 -209
  54. package/src/components/loginModal/style.css +71 -71
  55. package/src/components/myTicketsContainer/index.tsx +196 -196
  56. package/src/components/myTicketsContainer/row.tsx +41 -41
  57. package/src/components/myTicketsContainer/style.css +39 -39
  58. package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
  59. package/src/components/orderDetailsContainer/index.tsx +252 -249
  60. package/src/components/orderDetailsContainer/style.css +72 -72
  61. package/src/components/orderDetailsContainer/ticketsTable.tsx +130 -124
  62. package/src/components/paymentContainer/index.tsx +285 -284
  63. package/src/components/registerModal/index.tsx +190 -190
  64. package/src/components/rsvpContainer/index.tsx +126 -0
  65. package/src/components/stripePayment/index.tsx +254 -253
  66. package/src/components/stripePayment/style.css +59 -59
  67. package/src/components/ticketResale/index.tsx +74 -56
  68. package/src/components/ticketResaleModal/index.tsx +215 -210
  69. package/src/components/ticketResaleModal/style.css +28 -28
  70. package/src/components/ticketsContainer/AccessCodeSection.tsx +50 -0
  71. package/src/components/ticketsContainer/PromoCodeSection.tsx +88 -99
  72. package/src/components/ticketsContainer/ReferralLogic.tsx +31 -33
  73. package/src/components/ticketsContainer/TicketRow.tsx +83 -83
  74. package/src/components/ticketsContainer/TicketsSection.tsx +90 -81
  75. package/src/components/ticketsContainer/index.tsx +464 -430
  76. package/src/components/ticketsContainer/style.css +181 -181
  77. package/src/components/ticketsContainer/utils.ts +11 -11
  78. package/src/components/timerWidget/index.tsx +87 -70
  79. package/src/components/timerWidget/style.css +34 -26
  80. package/src/components/waitingList/index.tsx +178 -178
  81. package/src/components/waitingList/style.css +26 -26
  82. package/src/env.ts +20 -20
  83. package/src/index.ts +15 -13
  84. package/src/normalizers/index.ts +45 -45
  85. package/src/types/billing-info-data.ts +37 -37
  86. package/src/types/payment-field.ts +7 -7
  87. package/src/types/referral-promotion.ts +7 -7
  88. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
  89. package/src/utils/downloadPDF.tsx +30 -30
  90. package/src/utils/formikErrorFocus.ts +24 -24
  91. package/src/utils/getImage.ts +14 -14
  92. package/src/utils/getQueryVariable.ts +13 -13
  93. package/src/utils/index.ts +5 -5
  94. package/src/utils/setConfigs.ts +26 -26
  95. package/src/utils/showZero.tsx +10 -10
  96. package/src/validators/index.ts +20 -20
@@ -1,196 +1,196 @@
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
- <Autocomplete
139
- disablePortal
140
- id="combo-box-demo"
141
- getOptionLabel={(option: EventFilter) => option.event_name}
142
- onChange={onChange}
143
- options={data.purchased_events}
144
- sx={{ width: 300 }}
145
- renderInput={params => <TextField {...params} label="Events" />}
146
- />
147
- <TableContainer component={Paper} className="my-ticket-table">
148
- <Table aria-label="collapsible table">
149
- <TableHead>
150
- <TableRow>
151
- {tableConfig().header.map((column: string, index: number) => (
152
- <TableCell key={index}>{column}</TableCell>
153
- ))}
154
- <TableCell />
155
- </TableRow>
156
- </TableHead>
157
- <TableBody>
158
- {data.orders?.map((row: RowItems) => (
159
- <MyTicketsRow
160
- key={row.id}
161
- row={row}
162
- handleDetailsInfo={handleDetailsInfo}
163
- />
164
- ))}
165
- </TableBody>
166
- </Table>
167
- </TableContainer>
168
- <TablePagination
169
- rowsPerPageOptions={[10, 25, 100]}
170
- component="div"
171
- count={data.total_count}
172
- rowsPerPage={limit}
173
- page={data.page}
174
- onPageChange={handleChangePage}
175
- onRowsPerPageChange={handleChangeRowsPerPage}
176
- />
177
- </>
178
- )}
179
- <>
180
- {showModalLogin && (
181
- <LoginModal
182
- onClose={() => {
183
- setShowModalLogin(false)
184
- }}
185
- onLogin={() => {
186
- setShowModalLogin(false)
187
- setUserExpired(false)
188
- setIsLogged(true)
189
- }}
190
- userExpired={userExpired}
191
- />
192
- )}
193
- </>
194
- </div>
195
- )
196
- }
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
+ <Autocomplete
139
+ disablePortal
140
+ id="combo-box-demo"
141
+ getOptionLabel={(option: EventFilter) => option.event_name}
142
+ onChange={onChange}
143
+ options={data.purchased_events}
144
+ sx={{ width: 300 }}
145
+ renderInput={params => <TextField {...params} label="Events" />}
146
+ />
147
+ <TableContainer component={Paper} className="my-ticket-table">
148
+ <Table aria-label="collapsible table">
149
+ <TableHead>
150
+ <TableRow>
151
+ {tableConfig().header.map((column: string, index: number) => (
152
+ <TableCell key={index}>{column}</TableCell>
153
+ ))}
154
+ <TableCell />
155
+ </TableRow>
156
+ </TableHead>
157
+ <TableBody>
158
+ {data.orders?.map((row: RowItems) => (
159
+ <MyTicketsRow
160
+ key={row.id}
161
+ row={row}
162
+ handleDetailsInfo={handleDetailsInfo}
163
+ />
164
+ ))}
165
+ </TableBody>
166
+ </Table>
167
+ </TableContainer>
168
+ <TablePagination
169
+ rowsPerPageOptions={[10, 25, 100]}
170
+ component="div"
171
+ count={data.total_count}
172
+ rowsPerPage={limit}
173
+ page={data.page}
174
+ onPageChange={handleChangePage}
175
+ onRowsPerPageChange={handleChangeRowsPerPage}
176
+ />
177
+ </>
178
+ )}
179
+ <>
180
+ {showModalLogin && (
181
+ <LoginModal
182
+ onClose={() => {
183
+ setShowModalLogin(false)
184
+ }}
185
+ onLogin={() => {
186
+ setShowModalLogin(false)
187
+ setUserExpired(false)
188
+ setIsLogged(true)
189
+ }}
190
+ userExpired={userExpired}
191
+ />
192
+ )}
193
+ </>
194
+ </div>
195
+ )
196
+ }
@@ -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;
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
40
  }
@@ -1,34 +1,34 @@
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
+ 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