Skip to content

Commit d51b8c3

Browse files
authored
Merge branch 'master' into leecalcote-patch-1
2 parents f5f1b72 + d02f4fa commit d51b8c3

File tree

13 files changed

+678
-391
lines changed

13 files changed

+678
-391
lines changed

package-lock.json

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

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"commitlint": "commitlint --edit",
1919
"coverage": "jest --coverage",
2020
"dev": "NODE_ENV=development tsup",
21+
"dev:watch": "NODE_ENV=development tsup",
2122
"format:check": "prettier --check \"**/*.{ts,tsx,md}\" --config ./.prettierrc",
2223
"format:write": "prettier --write \"**/*.{ts,tsx,md}\" --config ./.prettierrc",
2324
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
@@ -109,6 +110,7 @@
109110
"mui-datatables": "*",
110111
"re-resizable": "^6.10.3",
111112
"react-draggable": "^4.4.6",
112-
"react-share": "^5.1.0"
113+
"react-share": "^5.1.0",
114+
"use-debounce": "^10.0.4"
113115
}
114116
}

site/package-lock.json

Lines changed: 45 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"postcss": "^8.4.31",
2222
"react": "^18.2.0",
2323
"react-dom": "^18.2.0",
24-
"react-router-dom": "^6.17.0",
24+
"react-router-dom": "^7.5.2",
2525
"tailwindcss": "^3.3.5"
2626
},
2727
"overrides": {

src/constants/constants.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,24 @@ export const CARIBBEAN_GREEN_FILL = '#00D3A9';
77
export const DEFAULT_STROKE = '#000';
88
export const DEFAULT_STROKE_WIDTH = '2';
99
export const CLOUD_URL = 'https://cloud.layer5.io';
10-
export const PLAYGROUND_MODES = {
10+
11+
export const KANVAS_MODE = {
1112
DESIGNER: 'design',
1213
OPERATOR: 'operator'
1314
} as const;
15+
16+
export const PLAYGROUND_MODES = KANVAS_MODE;
17+
18+
export const VISIBILITY = {
19+
PUBLIC: 'public',
20+
PRIVATE: 'private'
21+
};
22+
23+
export const RESOURCE_TYPE = {
24+
FILTER: 'filter',
25+
DESIGN: 'design',
26+
CATALOG: 'catalog',
27+
VIEW: 'view'
28+
} as const;
29+
30+
export type ResourceType = (typeof RESOURCE_TYPE)[keyof typeof RESOURCE_TYPE];

src/custom/CatalogDesignTable/CatalogDesignTable.tsx

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import _ from 'lodash';
33
import { MUIDataTableColumn } from 'mui-datatables';
4-
import { useCallback, useMemo, useRef } from 'react';
4+
import { useCallback, useMemo, useRef, useState } from 'react';
55
import { PublishIcon } from '../../icons';
66
import { CHARCOAL } from '../../theme';
7-
import { FormattedTime } from '../../utils';
87
import { Pattern } from '../CustomCatalog/CustomCard';
98
import { ErrorBoundary } from '../ErrorBoundary';
109
import { ColView } from '../Helpers/ResponsiveColumns/responsive-coulmns.tsx/responsive-column';
@@ -56,37 +55,7 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
5655
handleBulkpatternsDataUnpublishModal
5756
}) => {
5857
const modalRef = useRef<PromptRef>(null);
59-
60-
const processedColumns: MUIDataTableColumn[] = useMemo(() => {
61-
return columns.map((col) => {
62-
const newCol = { ...col };
63-
if (!newCol.options) newCol.options = {};
64-
newCol.options.display = columnVisibility[col.name];
65-
if (
66-
[
67-
'updated_at',
68-
'created_at',
69-
'deleted_at',
70-
'last_login_time',
71-
'joined_at',
72-
'last_run',
73-
'next_run'
74-
].includes(col.name)
75-
) {
76-
newCol.options.customBodyRender = (value: any) => {
77-
if (!value || value === 'NA') return <>NA</>;
78-
if (typeof value === 'object' && 'Valid' in value) {
79-
if (value.Valid && value.Time) {
80-
return <FormattedTime date={value.Time} />;
81-
}
82-
return <>NA</>;
83-
}
84-
return <FormattedTime date={value.Time} />;
85-
};
86-
}
87-
return newCol;
88-
});
89-
}, [columns, columnVisibility]);
58+
const [tableCols, updateCols] = useState(columns);
9059

9160
const handleTableChange = useCallback(
9261
(action: string, tableState: any) => {
@@ -176,22 +145,19 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
176145
]
177146
);
178147

179-
if (!processedColumns.length) {
180-
return null;
181-
}
182-
183148
return (
184149
<ErrorBoundary>
185150
<PromptComponent ref={modalRef} />
186151
<ResponsiveDataTable
187-
columns={processedColumns}
152+
columns={columns}
188153
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
189154
//@ts-ignore
190155
data={patterns || []}
191156
rowsPerPageOptions={rowsPerPageOptions}
192157
options={options}
193158
colViews={colViews}
194-
tableCols={processedColumns}
159+
tableCols={tableCols}
160+
updateCols={updateCols}
195161
columnVisibility={columnVisibility}
196162
/>
197163
</ErrorBoundary>

src/custom/CustomImage/CustomImage.tsx

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState } from 'react';
22
import { Dialog } from '../../base';
3+
import { styled } from '../../theme';
34

45
interface ImageComponentProps {
56
src: string;
@@ -13,35 +14,61 @@ interface ImageComponentProps {
1314
srcSet?: string;
1415
className?: string;
1516
style?: React.CSSProperties;
17+
caption?: string;
18+
align?: 'left' | 'center' | 'right';
1619
onClick?: (event: React.MouseEvent<HTMLImageElement, MouseEvent>) => void;
1720
}
21+
interface AlignProps {
22+
align: 'left' | 'center' | 'right';
23+
}
24+
const Figure = styled('figure')<AlignProps>(({ align }) => ({
25+
margin: '1rem 0',
26+
textAlign: align,
27+
width: '100%',
28+
}));
29+
const FigCaption = styled('figcaption')<AlignProps>(({ align }) => ({
30+
fontSize: '0.9rem',
31+
color: '#666',
32+
marginTop: '0.5rem',
33+
textAlign: align
34+
}));
1835

19-
const CustomImage: React.FC<ImageComponentProps> = ({ src, alt, ...props }) => {
36+
const CustomImage: React.FC<ImageComponentProps> = ({
37+
src,
38+
alt,
39+
caption,
40+
align = 'left',
41+
...props
42+
}) => {
2043
const [isZoomed, setIsZoomed] = useState(false);
21-
2244
const handleZoomClick = () => {
2345
setIsZoomed(true);
2446
};
25-
2647
const handleZoomClose = () => {
2748
setIsZoomed(false);
2849
};
2950

3051
return (
3152
<>
32-
<img
33-
src={src}
34-
alt={alt}
35-
loading="lazy"
36-
onClick={handleZoomClick}
37-
{...props}
38-
style={{
39-
cursor: 'pointer',
40-
maxWidth: '100%',
41-
height: 'auto',
42-
...props.style
43-
}}
44-
/>
53+
<Figure align={align}>
54+
<img
55+
src={src}
56+
alt={alt || caption || ''}
57+
loading="lazy"
58+
onClick={handleZoomClick}
59+
{...props}
60+
style={{
61+
cursor: 'pointer',
62+
maxWidth: '100%',
63+
height: 'auto',
64+
boxShadow: 'rgba(149, 157, 165, 0.2) 0px 8px 24px',
65+
borderRadius: '15px',
66+
width: '50%'
67+
}}
68+
/>
69+
{caption && <FigCaption align={align}>{caption}</FigCaption>}
70+
</Figure>
71+
4572
<Dialog
4673
open={isZoomed}
4774
onClose={handleZoomClose}
@@ -59,7 +86,7 @@ const CustomImage: React.FC<ImageComponentProps> = ({ src, alt, ...props }) => {
5986
>
6087
<img
6188
src={src}
62-
alt={alt}
89+
alt={alt || caption || ''}
6390
onClick={handleZoomClose}
6491
style={{
6592
objectFit: 'contain',

src/custom/DashboardWidgets/GettingStartedWidget/JourneyModal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ const stepperType = {
2626
} as const;
2727

2828
export const ModalImage = styled('img')(() => ({
29-
aspectRatio: '16/9',
29+
display: 'block',
30+
width: '100%',
31+
height: 'auto',
32+
objectFit: 'contain',
3033
paddingBlock: '1rem'
3134
}));
3235

src/custom/Modal/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const StyledDialog = styled(Dialog)`
5151
&& {
5252
.MuiDialog-paper {
5353
border-radius: 0.5rem;
54+
overflow: hidden;
5455
}
5556
}
5657
`;

0 commit comments

Comments
 (0)