Skip to content

Commit 8688851

Browse files
authored
Merge branch 'master' into add-token-new
2 parents e73f089 + b8ea04e commit 8688851

38 files changed

+1439
-486
lines changed

.github/workflows/checks.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/node-checks.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Node version and Lint Check
2+
on:
3+
pull_request:
4+
types: [opened, synchronize]
5+
push:
6+
branches:
7+
- '*'
8+
paths-ignore:
9+
- 'system/**/*'
10+
- '.github/**/*'
11+
- '*.md'
12+
13+
jobs:
14+
compatibility-check:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node-version: [16, 18, 20]
19+
steps:
20+
- name: Checkout Repository
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: Install Dependencies
29+
run: npm install
30+
31+
- name: Lint Check
32+
run: npm run lint
33+
34+
- name: Prettier Check
35+
run: npm run format:check
36+
37+
- name: Build Project
38+
run: npm run build
39+
40+
- name: Run Tests
41+
run: npm run test
42+
43+
- name: Log Node.js Version
44+
run: echo "Tested on Node.js version ${{ matrix.node-version }}"

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.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@
119119
"billboard.js": "^3.14.3",
120120
"js-yaml": "^4.1.0",
121121
"lodash": "^4.17.21",
122+
"moment": "^2.30.1",
122123
"re-resizable": "^6.10.3",
123124
"react-draggable": "^4.4.6",
124-
"moment": "^2.30.1",
125125
"react-share": "^5.1.0"
126126
}
127127
}

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/CatalogDetail/RelatedDesigns.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CatalogCardDesignLogo } from '../CustomCatalog';
22
import CustomCatalogCard, { Pattern } from '../CustomCatalog/CustomCard';
3-
import { formatToTitleCase } from './helper';
3+
import { getHeadingText } from './helper';
44
import { AdditionalContainer, ContentHeading, DesignCardContainer } from './style';
55
import { UserProfile } from './types';
66

@@ -41,8 +41,7 @@ const RelatedDesigns: React.FC<RelatedDesignsProps> = ({
4141
<AdditionalContainer>
4242
<ContentHeading>
4343
<h2 style={{ margin: '0', textTransform: 'uppercase' }}>
44-
Other published design by {formatToTitleCase(userProfile?.first_name ?? '')}{' '}
45-
{fetchingOrgError ? '' : `under ${organizationName}`}
44+
{getHeadingText({ type, userProfile, organizationName, fetchingOrgError })}
4645
</h2>
4746
</ContentHeading>
4847
<DesignCardContainer>

0 commit comments

Comments
 (0)