1
+ import { Theme } from '@mui/material' ;
1
2
import { MUIDataTableColumn , MUIDataTableMeta } from 'mui-datatables' ;
2
3
import { PLAYGROUND_MODES } from '../../constants/constants' ;
3
4
import { ChainIcon , CopyIcon , KanvasIcon , PublishIcon } from '../../icons' ;
4
5
import Download from '../../icons/Download/Download' ;
5
- import { CHARCOAL } from '../../theme' ;
6
- import { downloadPattern , slugify } from '../CatalogDetail/helper' ;
6
+ import { slugify } from '../CatalogDetail/helper' ;
7
7
import { RESOURCE_TYPES } from '../CatalogDetail/types' ;
8
8
import { Pattern } from '../CustomCatalog/CustomCard' ;
9
9
import { ConditionalTooltip } from '../Helpers/CondtionalTooltip' ;
10
10
import { ColView } from '../Helpers/ResponsiveColumns/responsive-coulmns.tsx' ;
11
11
import { DataTableEllipsisMenu } from '../ResponsiveDataTable' ;
12
- import AuthorCell from './AuthorCell ' ;
12
+ import { UserTableAvatarInfo } from '../UsersTable ' ;
13
13
import { getColumnValue } from './helper' ;
14
14
import { L5DeleteIcon , NameDiv } from './style' ;
15
15
@@ -26,6 +26,7 @@ interface ColumnConfigProps {
26
26
handleClone : ( name : string , id : string ) => void ;
27
27
handleShowDetails : ( designId : string , designName : string ) => void ;
28
28
getDownloadUrl : ( id : string ) => string ;
29
+ handleDownload : ( design : Pattern ) => void ;
29
30
isDownloadAllowed : boolean ;
30
31
isCopyLinkAllowed : boolean ;
31
32
isDeleteAllowed : boolean ;
@@ -34,6 +35,7 @@ interface ColumnConfigProps {
34
35
// for workspace designs table page only
35
36
isFromWorkspaceTable ?: boolean ;
36
37
isRemoveAllowed ?: boolean ;
38
+ theme ?: Theme ;
37
39
}
38
40
39
41
export const colViews : ColView [ ] = [
@@ -54,13 +56,15 @@ export const createDesignsColumnsConfig = ({
54
56
handleCopyUrl,
55
57
handleClone,
56
58
handleShowDetails,
57
- getDownloadUrl,
59
+ // getDownloadUrl,
60
+ handleDownload,
58
61
isUnpublishAllowed,
59
62
isCopyLinkAllowed,
60
63
isDeleteAllowed,
61
64
isPublishAllowed,
62
65
isDownloadAllowed,
63
66
isRemoveAllowed,
67
+ theme,
64
68
isFromWorkspaceTable = false
65
69
} : ColumnConfigProps ) : MUIDataTableColumn [ ] => {
66
70
return [
@@ -99,13 +103,14 @@ export const createDesignsColumnsConfig = ({
99
103
const lastName = getColumnValue ( tableMeta as TableMeta , 'last_name' ) ;
100
104
const avatar_url = getColumnValue ( tableMeta as TableMeta , 'avatar_url' ) ;
101
105
const user_id = getColumnValue ( tableMeta as TableMeta , 'user_id' ) ;
106
+ const userEmail = getColumnValue ( tableMeta as TableMeta , 'email' ) ;
102
107
103
108
return (
104
- < AuthorCell
105
- firstName = { firstName }
106
- lastName = { lastName }
107
- avatarUrl = { avatar_url }
109
+ < UserTableAvatarInfo
110
+ userEmail = { userEmail }
108
111
userId = { user_id }
112
+ userName = { `${ firstName } ${ lastName } ` }
113
+ profileUrl = { avatar_url }
109
114
/>
110
115
) ;
111
116
}
@@ -153,6 +158,17 @@ export const createDesignsColumnsConfig = ({
153
158
searchable : false
154
159
}
155
160
} ,
161
+
162
+ {
163
+ name : 'email' ,
164
+ label : 'email' ,
165
+ options : {
166
+ filter : false ,
167
+ sort : false ,
168
+ searchable : false
169
+ }
170
+ } ,
171
+
156
172
{
157
173
name : 'actions' ,
158
174
label : 'Actions' ,
@@ -165,21 +181,21 @@ export const createDesignsColumnsConfig = ({
165
181
customBodyRender : function CustomBody ( _ , tableMeta : MUIDataTableMeta ) {
166
182
const rowIndex = ( tableMeta as TableMeta ) . rowIndex ;
167
183
const rowData = ( tableMeta as TableMeta ) . tableData [ rowIndex ] ;
168
-
169
184
const actionsList = [
170
185
{
171
186
title : 'Download' ,
172
- onClick : ( ) => downloadPattern ( rowData . id , rowData . name , getDownloadUrl ) ,
187
+ // onClick: () => downloadPattern(rowData.id, rowData.name, getDownloadUrl),
188
+ onClick : ( ) => handleDownload ( rowData ) ,
173
189
disabled : ! isDownloadAllowed ,
174
- icon : < Download width = { 24 } height = { 24 } fill = { CHARCOAL } />
190
+ icon : < Download width = { 24 } height = { 24 } fill = { theme ?. palette . icon . secondary } />
175
191
} ,
176
192
{
177
193
title : 'Copy Link' ,
178
194
disabled : rowData . visibility === 'private' || ! isCopyLinkAllowed ,
179
195
onClick : ( ) => {
180
196
handleCopyUrl ( RESOURCE_TYPES . DESIGN , rowData ?. name , rowData ?. id ) ;
181
197
} ,
182
- icon : < ChainIcon width = { '24' } height = { '24' } fill = { CHARCOAL } />
198
+ icon : < ChainIcon width = { '24' } height = { '24' } fill = { theme ?. palette . icon . secondary } />
183
199
} ,
184
200
{
185
201
title : 'Open in playground' ,
@@ -191,7 +207,9 @@ export const createDesignsColumnsConfig = ({
191
207
'_blank'
192
208
) ;
193
209
} ,
194
- icon : < KanvasIcon width = { 24 } height = { 24 } primaryFill = { CHARCOAL } />
210
+ icon : (
211
+ < KanvasIcon width = { 24 } height = { 24 } primaryFill = { theme ?. palette . icon . secondary } />
212
+ )
195
213
} ,
196
214
{
197
215
title : isFromWorkspaceTable ? 'Remove Design' : 'Delete' ,
@@ -205,20 +223,20 @@ export const createDesignsColumnsConfig = ({
205
223
title : 'Publish' ,
206
224
disabled : ! isPublishAllowed ,
207
225
onClick : ( ) => handlePublishModal ( rowData ) ,
208
- icon : < PublishIcon width = { 24 } height = { 24 } fill = { CHARCOAL } />
226
+ icon : < PublishIcon width = { 24 } height = { 24 } fill = { theme ?. palette . icon . secondary } />
209
227
} ;
210
228
211
229
const unpublishAction = {
212
230
title : 'Unpublish' ,
213
231
onClick : ( ) => handleUnpublishModal ( rowData ) ( ) ,
214
232
disabled : ! isUnpublishAllowed ,
215
- icon : < PublishIcon width = { 24 } height = { 24 } fill = { CHARCOAL } />
233
+ icon : < PublishIcon width = { 24 } height = { 24 } fill = { theme ?. palette . icon . secondary } />
216
234
} ;
217
235
218
236
const cloneAction = {
219
237
title : 'Clone' ,
220
238
onClick : ( ) => handleClone ( rowData ?. name , rowData ?. id ) ,
221
- icon : < CopyIcon width = { 24 } height = { 24 } fill = { CHARCOAL } />
239
+ icon : < CopyIcon width = { 24 } height = { 24 } fill = { theme ?. palette . icon . secondary } />
222
240
} ;
223
241
224
242
if ( rowData . visibility === 'published' ) {
@@ -228,7 +246,7 @@ export const createDesignsColumnsConfig = ({
228
246
actionsList . splice ( 1 , 0 , publishAction ) ;
229
247
}
230
248
231
- return < DataTableEllipsisMenu actionsList = { actionsList } /> ;
249
+ return < DataTableEllipsisMenu actionsList = { actionsList } theme = { theme } /> ;
232
250
}
233
251
}
234
252
}
0 commit comments