1+ import { Theme } from '@mui/material' ;
12import { MUIDataTableColumn , MUIDataTableMeta } from 'mui-datatables' ;
23import { PLAYGROUND_MODES } from '../../constants/constants' ;
34import { ChainIcon , CopyIcon , KanvasIcon , PublishIcon } from '../../icons' ;
45import Download from '../../icons/Download/Download' ;
5- import { CHARCOAL } from '../../theme' ;
6- import { downloadPattern , slugify } from '../CatalogDetail/helper' ;
6+ import { slugify } from '../CatalogDetail/helper' ;
77import { RESOURCE_TYPES } from '../CatalogDetail/types' ;
88import { Pattern } from '../CustomCatalog/CustomCard' ;
99import { ConditionalTooltip } from '../Helpers/CondtionalTooltip' ;
1010import { ColView } from '../Helpers/ResponsiveColumns/responsive-coulmns.tsx' ;
1111import { DataTableEllipsisMenu } from '../ResponsiveDataTable' ;
12- import AuthorCell from './AuthorCell ' ;
12+ import { UserTableAvatarInfo } from '../UsersTable ' ;
1313import { getColumnValue } from './helper' ;
1414import { L5DeleteIcon , NameDiv } from './style' ;
1515
@@ -26,6 +26,7 @@ interface ColumnConfigProps {
2626 handleClone : ( name : string , id : string ) => void ;
2727 handleShowDetails : ( designId : string , designName : string ) => void ;
2828 getDownloadUrl : ( id : string ) => string ;
29+ handleDownload : ( design : Pattern ) => void ;
2930 isDownloadAllowed : boolean ;
3031 isCopyLinkAllowed : boolean ;
3132 isDeleteAllowed : boolean ;
@@ -34,6 +35,7 @@ interface ColumnConfigProps {
3435 // for workspace designs table page only
3536 isFromWorkspaceTable ?: boolean ;
3637 isRemoveAllowed ?: boolean ;
38+ theme ?: Theme ;
3739}
3840
3941export const colViews : ColView [ ] = [
@@ -54,13 +56,15 @@ export const createDesignsColumnsConfig = ({
5456 handleCopyUrl,
5557 handleClone,
5658 handleShowDetails,
57- getDownloadUrl,
59+ // getDownloadUrl,
60+ handleDownload,
5861 isUnpublishAllowed,
5962 isCopyLinkAllowed,
6063 isDeleteAllowed,
6164 isPublishAllowed,
6265 isDownloadAllowed,
6366 isRemoveAllowed,
67+ theme,
6468 isFromWorkspaceTable = false
6569} : ColumnConfigProps ) : MUIDataTableColumn [ ] => {
6670 return [
@@ -99,13 +103,14 @@ export const createDesignsColumnsConfig = ({
99103 const lastName = getColumnValue ( tableMeta as TableMeta , 'last_name' ) ;
100104 const avatar_url = getColumnValue ( tableMeta as TableMeta , 'avatar_url' ) ;
101105 const user_id = getColumnValue ( tableMeta as TableMeta , 'user_id' ) ;
106+ const userEmail = getColumnValue ( tableMeta as TableMeta , 'email' ) ;
102107
103108 return (
104- < AuthorCell
105- firstName = { firstName }
106- lastName = { lastName }
107- avatarUrl = { avatar_url }
109+ < UserTableAvatarInfo
110+ userEmail = { userEmail }
108111 userId = { user_id }
112+ userName = { `${ firstName } ${ lastName } ` }
113+ profileUrl = { avatar_url }
109114 />
110115 ) ;
111116 }
@@ -153,6 +158,17 @@ export const createDesignsColumnsConfig = ({
153158 searchable : false
154159 }
155160 } ,
161+
162+ {
163+ name : 'email' ,
164+ label : 'email' ,
165+ options : {
166+ filter : false ,
167+ sort : false ,
168+ searchable : false
169+ }
170+ } ,
171+
156172 {
157173 name : 'actions' ,
158174 label : 'Actions' ,
@@ -165,21 +181,21 @@ export const createDesignsColumnsConfig = ({
165181 customBodyRender : function CustomBody ( _ , tableMeta : MUIDataTableMeta ) {
166182 const rowIndex = ( tableMeta as TableMeta ) . rowIndex ;
167183 const rowData = ( tableMeta as TableMeta ) . tableData [ rowIndex ] ;
168-
169184 const actionsList = [
170185 {
171186 title : 'Download' ,
172- onClick : ( ) => downloadPattern ( rowData . id , rowData . name , getDownloadUrl ) ,
187+ // onClick: () => downloadPattern(rowData.id, rowData.name, getDownloadUrl),
188+ onClick : ( ) => handleDownload ( rowData ) ,
173189 disabled : ! isDownloadAllowed ,
174- icon : < Download width = { 24 } height = { 24 } fill = { CHARCOAL } />
190+ icon : < Download width = { 24 } height = { 24 } fill = { theme ?. palette . icon . secondary } />
175191 } ,
176192 {
177193 title : 'Copy Link' ,
178194 disabled : rowData . visibility === 'private' || ! isCopyLinkAllowed ,
179195 onClick : ( ) => {
180196 handleCopyUrl ( RESOURCE_TYPES . DESIGN , rowData ?. name , rowData ?. id ) ;
181197 } ,
182- icon : < ChainIcon width = { '24' } height = { '24' } fill = { CHARCOAL } />
198+ icon : < ChainIcon width = { '24' } height = { '24' } fill = { theme ?. palette . icon . secondary } />
183199 } ,
184200 {
185201 title : 'Open in playground' ,
@@ -191,7 +207,9 @@ export const createDesignsColumnsConfig = ({
191207 '_blank'
192208 ) ;
193209 } ,
194- icon : < KanvasIcon width = { 24 } height = { 24 } primaryFill = { CHARCOAL } />
210+ icon : (
211+ < KanvasIcon width = { 24 } height = { 24 } primaryFill = { theme ?. palette . icon . secondary } />
212+ )
195213 } ,
196214 {
197215 title : isFromWorkspaceTable ? 'Remove Design' : 'Delete' ,
@@ -205,20 +223,20 @@ export const createDesignsColumnsConfig = ({
205223 title : 'Publish' ,
206224 disabled : ! isPublishAllowed ,
207225 onClick : ( ) => handlePublishModal ( rowData ) ,
208- icon : < PublishIcon width = { 24 } height = { 24 } fill = { CHARCOAL } />
226+ icon : < PublishIcon width = { 24 } height = { 24 } fill = { theme ?. palette . icon . secondary } />
209227 } ;
210228
211229 const unpublishAction = {
212230 title : 'Unpublish' ,
213231 onClick : ( ) => handleUnpublishModal ( rowData ) ( ) ,
214232 disabled : ! isUnpublishAllowed ,
215- icon : < PublishIcon width = { 24 } height = { 24 } fill = { CHARCOAL } />
233+ icon : < PublishIcon width = { 24 } height = { 24 } fill = { theme ?. palette . icon . secondary } />
216234 } ;
217235
218236 const cloneAction = {
219237 title : 'Clone' ,
220238 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 } />
222240 } ;
223241
224242 if ( rowData . visibility === 'published' ) {
@@ -228,7 +246,7 @@ export const createDesignsColumnsConfig = ({
228246 actionsList . splice ( 1 , 0 , publishAction ) ;
229247 }
230248
231- return < DataTableEllipsisMenu actionsList = { actionsList } /> ;
249+ return < DataTableEllipsisMenu actionsList = { actionsList } theme = { theme } /> ;
232250 }
233251 }
234252 }
0 commit comments