Skip to content

Commit c6e172b

Browse files
Merge branch 'master' into fix/my-design
2 parents 70bf901 + ad3d1a4 commit c6e172b

30 files changed

+1334
-293
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/custom/CatalogDesignTable/CatalogDesignTable.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ interface CatalogDesignsTableProps {
2828
rowsPerPageOptions?: number[];
2929
handleBulkDeleteModal: (patterns: Pattern[], modalRef: React.RefObject<PromptRef>) => void;
3030
setSearch?: (search: string) => void;
31+
tableBackgroundColor?: string;
3132
handleBulkpatternsDataUnpublishModal: (
3233
selected: any,
3334
patterns: Pattern[],
@@ -51,6 +52,7 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
5152
handleBulkDeleteModal,
5253
setSearch,
5354
rowsPerPageOptions = [10, 25, 50, 100],
55+
tableBackgroundColor,
5456
handleBulkpatternsDataUnpublishModal
5557
}) => {
5658
const theme = useTheme();
@@ -203,7 +205,9 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
203205
tableCols={processedColumns}
204206
columnVisibility={columnVisibility}
205207
backgroundColor={
206-
theme.palette.mode === 'light'
208+
tableBackgroundColor
209+
? tableBackgroundColor
210+
: theme.palette.mode === 'light'
207211
? theme.palette.background.default
208212
: theme.palette.background.secondary
209213
}

src/custom/CatalogDesignTable/DesignTableColumnConfig.tsx

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
import { Theme } from '@mui/material';
12
import { MUIDataTableColumn, MUIDataTableMeta } from 'mui-datatables';
23
import { PLAYGROUND_MODES } from '../../constants/constants';
34
import { ChainIcon, CopyIcon, KanvasIcon, PublishIcon } from '../../icons';
45
import Download from '../../icons/Download/Download';
5-
import { CHARCOAL } from '../../theme';
66
import { downloadPattern, slugify } from '../CatalogDetail/helper';
77
import { RESOURCE_TYPES } from '../CatalogDetail/types';
88
import { Pattern } from '../CustomCatalog/CustomCard';
99
import { ConditionalTooltip } from '../Helpers/CondtionalTooltip';
1010
import { ColView } from '../Helpers/ResponsiveColumns/responsive-coulmns.tsx';
1111
import { DataTableEllipsisMenu } from '../ResponsiveDataTable';
12-
import AuthorCell from './AuthorCell';
12+
import { UserTableAvatarInfo } from '../UsersTable';
1313
import { getColumnValue } from './helper';
1414
import { L5DeleteIcon, NameDiv } from './style';
1515

@@ -25,7 +25,8 @@ interface ColumnConfigProps {
2525
handleCopyUrl: (type: string, name: string, id: string) => void;
2626
handleClone: (name: string, id: string) => void;
2727
handleShowDetails: (designId: string, designName: string) => void;
28-
getDownloadUrl: (id: string) => string;
28+
handleDownload?: (design: Pattern) => void;
29+
getDownloadUrl?: (id: string) => string;
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

3941
export const colViews: ColView[] = [
@@ -55,12 +57,14 @@ export const createDesignsColumnsConfig = ({
5557
handleClone,
5658
handleShowDetails,
5759
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,22 @@ 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: getDownloadUrl
188+
? () => downloadPattern(rowData.id, rowData.name, getDownloadUrl)
189+
: () => handleDownload && handleDownload(rowData),
173190
disabled: !isDownloadAllowed,
174-
icon: <Download width={24} height={24} fill={CHARCOAL} />
191+
icon: <Download width={24} height={24} fill={theme?.palette.icon.secondary} />
175192
},
176193
{
177194
title: 'Copy Link',
178195
disabled: rowData.visibility === 'private' || !isCopyLinkAllowed,
179196
onClick: () => {
180197
handleCopyUrl(RESOURCE_TYPES.DESIGN, rowData?.name, rowData?.id);
181198
},
182-
icon: <ChainIcon width={'24'} height={'24'} fill={CHARCOAL} />
199+
icon: <ChainIcon width={'24'} height={'24'} fill={theme?.palette.icon.secondary} />
183200
},
184201
{
185202
title: 'Open in playground',
@@ -191,7 +208,9 @@ export const createDesignsColumnsConfig = ({
191208
'_blank'
192209
);
193210
},
194-
icon: <KanvasIcon width={24} height={24} primaryFill={CHARCOAL} />
211+
icon: (
212+
<KanvasIcon width={24} height={24} primaryFill={theme?.palette.icon.secondary} />
213+
)
195214
},
196215
{
197216
title: isFromWorkspaceTable ? 'Remove Design' : 'Delete',
@@ -205,20 +224,20 @@ export const createDesignsColumnsConfig = ({
205224
title: 'Publish',
206225
disabled: !isPublishAllowed,
207226
onClick: () => handlePublishModal(rowData),
208-
icon: <PublishIcon width={24} height={24} fill={CHARCOAL} />
227+
icon: <PublishIcon width={24} height={24} fill={theme?.palette.icon.secondary} />
209228
};
210229

211230
const unpublishAction = {
212231
title: 'Unpublish',
213232
onClick: () => handleUnpublishModal(rowData)(),
214233
disabled: !isUnpublishAllowed,
215-
icon: <PublishIcon width={24} height={24} fill={CHARCOAL} />
234+
icon: <PublishIcon width={24} height={24} fill={theme?.palette.icon.secondary} />
216235
};
217236

218237
const cloneAction = {
219238
title: 'Clone',
220239
onClick: () => handleClone(rowData?.name, rowData?.id),
221-
icon: <CopyIcon width={24} height={24} fill={CHARCOAL} />
240+
icon: <CopyIcon width={24} height={24} fill={theme?.palette.icon.secondary} />
222241
};
223242

224243
if (rowData.visibility === 'published') {
@@ -228,7 +247,7 @@ export const createDesignsColumnsConfig = ({
228247
actionsList.splice(1, 0, publishAction);
229248
}
230249

231-
return <DataTableEllipsisMenu actionsList={actionsList} />;
250+
return <DataTableEllipsisMenu actionsList={actionsList} theme={theme} />;
232251
}
233252
}
234253
}

src/custom/CatalogDesignTable/columnConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export const createDesignColumns = ({
320320
});
321321
}
322322
//@ts-ignore
323-
return <DataTableEllipsisMenu actionsList={actionsList} theme={theme} />;
323+
return <DataTableEllipsisMenu actionsList={actionsList} />;
324324
}
325325
}
326326
}

src/custom/CatalogDesignTable/style.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface DeleteIconProps {
1919
}
2020

2121
export const L5DeleteIcon = styled(DeleteIcon)<DeleteIconProps>(({ disabled, bulk, theme }) => ({
22-
color: disabled ? theme.palette.icon.disabled : theme.palette.text.secondary,
22+
color: disabled ? theme.palette.icon.disabled : theme.palette.text.default,
2323
cursor: disabled ? 'not-allowed' : 'pointer',
2424
width: bulk ? '32' : '28.8',
2525
height: bulk ? '32' : '28.8',

src/custom/CustomColumnVisibilityControl/CustomColumnVisibilityControl.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ export function CustomColumnVisibilityControl({
3636
const theme = useTheme();
3737

3838
const handleOpen = (event: React.MouseEvent<HTMLElement>) => {
39+
event.stopPropagation();
40+
setOpen((prev) => !prev);
41+
if (anchorEl) {
42+
setAnchorEl(null);
43+
return;
44+
}
3945
setAnchorEl(event.currentTarget);
40-
setOpen(true);
4146
};
4247

4348
const handleClose = () => {

src/custom/FlipCard/FlipCard.tsx

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@ export type FlipCardProps = {
77
onClick?: () => void;
88
onShow?: () => void;
99
children: [React.ReactNode, React.ReactNode];
10+
disableFlip?: boolean;
11+
padding?: string;
1012
};
1113

14+
/**
15+
* Helper function to get the front or back child component from the children array
16+
* @param children Array containing exactly two child components
17+
* @param key Index to retrieve (0 for front, 1 for back)
18+
* @throws Error if children is undefined or doesn't contain exactly two components
19+
* @returns The selected child component
20+
*/
1221
function GetChild(children: [React.ReactNode, React.ReactNode], key: number) {
1322
if (!children) throw Error('FlipCard requires exactly two child components');
1423
if (children.length != 2) throw Error('FlipCard requires exactly two child components');
@@ -42,7 +51,32 @@ const BackContent = styled('div')({
4251
wordBreak: 'break-word'
4352
});
4453

45-
export function FlipCard({ duration = 500, onClick, onShow, children }: FlipCardProps) {
54+
/**
55+
* A card component that provides a flipping animation between two content faces
56+
*
57+
* @component
58+
* @param props.duration - Animation duration in milliseconds (default: 500)
59+
* @param props.onClick - Callback function triggered on card click
60+
* @param props.onShow - Additional callback function triggered when card shows new face
61+
* @param props.children - Array of exactly two child components (front and back)
62+
* @param props.disableFlip - When true, prevents the card from flipping (default: false)
63+
*
64+
* @example
65+
* ```tsx
66+
* <FlipCard>
67+
* <div>Front Content</div>
68+
* <div>Back Content</div>
69+
* </FlipCard>
70+
* ```
71+
*/
72+
export function FlipCard({
73+
duration = 500,
74+
onClick,
75+
onShow,
76+
children,
77+
disableFlip = false,
78+
padding
79+
}: FlipCardProps) {
4680
const [flipped, setFlipped] = React.useState(false);
4781
const [activeBack, setActiveBack] = React.useState(false);
4882

@@ -72,6 +106,7 @@ export function FlipCard({ duration = 500, onClick, onShow, children }: FlipCard
72106
return (
73107
<Card
74108
onClick={() => {
109+
if (disableFlip) return;
75110
setFlipped((flipped) => !flipped);
76111
onClick && onClick();
77112
onShow && onShow();
@@ -80,7 +115,8 @@ export function FlipCard({ duration = 500, onClick, onShow, children }: FlipCard
80115
<InnerCard
81116
style={{
82117
transform: flipped ? 'scale(-1,1)' : undefined,
83-
transition: `transform ${duration}ms`
118+
transition: `transform ${duration}ms`,
119+
padding: padding
84120
}}
85121
>
86122
{!activeBack ? (

src/custom/ResponsiveDataTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const DataTableEllipsisMenu: React.FC<{
4848
<TooltipIcon
4949
title="View Actions"
5050
onClick={handleClick}
51-
icon={<EllipsisIcon fill={theme?.palette.text.primary ?? 'black'} />}
51+
icon={<EllipsisIcon fill={theme?.palette.icon.default ?? 'black'} />}
5252
arrow
5353
/>
5454
<Menu
@@ -59,7 +59,7 @@ export const DataTableEllipsisMenu: React.FC<{
5959
sx={{
6060
fontFamily: theme?.typography.fontFamily,
6161
'& .MuiPaper-root': {
62-
backgroundColor: theme?.palette.background.default ?? 'white'
62+
backgroundColor: theme?.palette.background.card ?? 'white'
6363
}
6464
}}
6565
>

src/custom/TeamTable/TeamTable.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { Grid, TableCell } from '@mui/material';
2+
import { TableCell } from '@mui/material';
33
import { MUIDataTableColumn } from 'mui-datatables';
4+
import { Grid } from '../../base';
5+
import { styled, useTheme } from '../../theme';
46
import { ErrorBoundary } from '../ErrorBoundary/ErrorBoundary.js';
57
import { ColView } from '../Helpers/ResponsiveColumns/responsive-coulmns.tsx/index.js';
68
import ResponsiveDataTable from '../ResponsiveDataTable.js';
@@ -20,6 +22,14 @@ interface TeamTableProps {
2022
useNotificationHandlers: any;
2123
useRemoveUserFromTeamMutation: any;
2224
}
25+
const StyledGrid = styled(Grid)(({ theme }) => ({
26+
display: 'grid',
27+
margin: 'auto',
28+
paddingLeft: '0.5rem',
29+
borderRadius: '0.25rem',
30+
width: 'inherit',
31+
gap: theme.spacing(1)
32+
}));
2333

2434
const TeamTable: React.FC<TeamTableProps> = ({
2535
teams,
@@ -35,6 +45,7 @@ const TeamTable: React.FC<TeamTableProps> = ({
3545
useNotificationHandlers,
3646
useRemoveUserFromTeamMutation
3747
}) => {
48+
const theme = useTheme();
3849
return (
3950
<ErrorBoundary>
4051
<ResponsiveDataTable
@@ -48,31 +59,20 @@ const TeamTable: React.FC<TeamTableProps> = ({
4859
<TableCell
4960
colSpan={6}
5061
sx={{
51-
padding: '0.5rem',
52-
backgroundColor: 'rgba(0, 0, 0, 0.05)'
62+
padding: '0.5rem'
5363
}}
5464
>
55-
<Grid
56-
container
57-
xs={12}
58-
spacing={1}
59-
sx={{
60-
margin: 'auto',
61-
backgroundColor: '#f3f1f1',
62-
paddingLeft: '0.5rem',
63-
borderRadius: '0.25rem',
64-
width: 'inherit'
65-
}}
66-
>
65+
<StyledGrid container xs={12}>
6766
<UsersTable
6867
teamID={teamID}
6968
isRemoveFromTeamAllowed={isRemoveFromTeamAllowed}
7069
org_id={org_id}
7170
useGetUsersForOrgQuery={useGetUsersForOrgQuery}
7271
useNotificationHandlers={useNotificationHandlers}
7372
useRemoveUserFromTeamMutation={useRemoveUserFromTeamMutation}
73+
theme={theme}
7474
/>
75-
</Grid>
75+
</StyledGrid>
7676
</TableCell>
7777
);
7878
}

0 commit comments

Comments
 (0)