Skip to content

Commit 2424cb7

Browse files
authored
Merge branch 'master' into fix/forwardRef
2 parents 37c7527 + 17b4a72 commit 2424cb7

7 files changed

Lines changed: 79 additions & 97 deletions

File tree

src/custom/CatalogDetail/ActionButton.tsx

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import React from 'react';
22
import { CircularProgress } from '../../base';
3-
import {
4-
CopyIcon,
5-
DeleteIcon,
6-
EditIcon,
7-
KanvasIcon,
8-
PublishIcon,
9-
ShareLineIcon
10-
} from '../../icons';
3+
import { CopyIcon, DeleteIcon, EditIcon, KanvasIcon, PublishIcon } from '../../icons';
114
import Download from '../../icons/Download/Download';
125
import { charcoal, useTheme } from '../../theme';
136
import { Pattern } from '../CustomCatalog/CustomCard';
@@ -28,8 +21,6 @@ interface ActionButtonsProps {
2821
onOpenPlaygroundClick: (designId: string, name: string) => void;
2922
showInfoAction?: boolean;
3023
handleInfoClick?: () => void;
31-
showShareAction?: boolean;
32-
handleShare: () => void;
3324
showDeleteAction?: boolean;
3425
handleDelete: () => void;
3526
}
@@ -47,8 +38,6 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
4738
onOpenPlaygroundClick,
4839
showInfoAction,
4940
handleInfoClick,
50-
showShareAction,
51-
handleShare,
5241
showDeleteAction,
5342
handleDelete
5443
}) => {
@@ -151,47 +140,31 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
151140
Edit
152141
</ActionButton>
153142
)}
154-
{showShareAction && (
155-
<ActionButton
143+
{showDeleteAction && (
144+
<UnpublishAction
156145
sx={{
157146
borderRadius: '0.2rem',
158-
backgroundColor: 'transparent',
159-
border: `1px solid ${theme.palette.border.normal}`,
160-
gap: '10px',
161-
color: charcoal[10]
147+
gap: '10px'
162148
}}
163-
onClick={handleShare}
149+
onClick={handleDelete}
164150
>
165-
<ShareLineIcon width="24" height="24" fill={theme.palette.icon.default} />
166-
Share
167-
</ActionButton>
151+
<DeleteIcon width={24} height={24} fill={charcoal[100]} />
152+
Delete
153+
</UnpublishAction>
168154
)}
169-
{showDeleteAction && (
155+
{showUnpublishAction && (
170156
<UnpublishAction
171157
sx={{
172158
borderRadius: '0.2rem',
173159
gap: '10px'
174160
}}
175-
onClick={handleDelete}
161+
onClick={handleUnpublish}
176162
>
177-
<DeleteIcon width={24} height={24} fill={charcoal[100]} />
178-
Delete
163+
<PublishIcon width={24} height={24} fill={charcoal[100]} />
164+
Unpublish
179165
</UnpublishAction>
180166
)}
181167
</div>
182-
183-
{showUnpublishAction && (
184-
<UnpublishAction
185-
sx={{
186-
borderRadius: '0.2rem',
187-
gap: '10px'
188-
}}
189-
onClick={handleUnpublish}
190-
>
191-
<PublishIcon width={24} height={24} fill={charcoal[100]} />
192-
Unpublish
193-
</UnpublishAction>
194-
)}
195168
</StyledActionWrapper>
196169
);
197170
};

src/custom/CatalogDetail/LeftPanel.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ interface LeftPanelProps {
2525
onOpenPlaygroundClick: (designId: string, name: string) => void;
2626
showInfoAction?: boolean;
2727
handleInfoClick?: () => void;
28-
showShareAction?: boolean;
29-
handleShare: () => void;
3028
showDeleteAction?: boolean;
3129
handleDelete: () => void;
3230
}
@@ -49,8 +47,6 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
4947
onOpenPlaygroundClick,
5048
showInfoAction = false,
5149
handleInfoClick,
52-
showShareAction = false,
53-
handleShare,
5450
showDeleteAction = false,
5551
handleDelete
5652
}) => {
@@ -97,8 +93,6 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
9793
onOpenPlaygroundClick={onOpenPlaygroundClick}
9894
showInfoAction={showInfoAction}
9995
handleInfoClick={handleInfoClick}
100-
showShareAction={showShareAction}
101-
handleShare={handleShare}
10296
showDeleteAction={showDeleteAction}
10397
handleDelete={handleDelete}
10498
/>

src/custom/CatalogDetail/OverviewSection.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { Grid } from '../../base';
33
import { Pattern } from '../CustomCatalog/CustomCard';
4+
import { VIEW_VISIBILITY } from '../VisibilityChipMenu/VisibilityChipMenu';
45
import ContentClassInfo from './ContentClassInfo';
56
import MetricsDisplay from './MetricsDisplay';
67
import PatternInfo from './PatternInfo';
@@ -25,6 +26,8 @@ interface OverviewSectionProps {
2526
userProfile?: any;
2627
showShareAction: boolean;
2728
handleShare: () => void;
29+
isVisibilityEnabled: boolean;
30+
handleVisibilityChange: (visibility: VIEW_VISIBILITY) => void;
2831
}
2932

3033
const OverviewSection: React.FC<OverviewSectionProps> = ({
@@ -41,7 +44,9 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
4144
fontFamily,
4245
userProfile,
4346
showShareAction,
44-
handleShare
47+
handleShare,
48+
isVisibilityEnabled,
49+
handleVisibilityChange
4550
}) => {
4651
return (
4752
<OverviewContainer>
@@ -64,6 +69,8 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
6469
handleCopyUrl={handleCopyUrl}
6570
showShareAction={showShareAction}
6671
handleShare={handleShare}
72+
isVisibilityEnabled={isVisibilityEnabled}
73+
handleVisibilityChange={handleVisibilityChange}
6774
/>
6875
</div>
6976
<Grid container spacing={2}>

src/custom/CatalogDetail/RightPanel.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { Pattern } from '../CustomCatalog/CustomCard';
3+
import { VIEW_VISIBILITY } from '../VisibilityChipMenu/VisibilityChipMenu';
34
import CaveatsSection from './CaveatsSection';
45
import OverviewSection from './OverviewSection';
56
import RelatedDesigns, { PatternsPerUser } from './RelatedDesigns';
@@ -28,6 +29,8 @@ interface RightPanelProps {
2829
fetchingOrgError: boolean;
2930
showShareAction: boolean;
3031
handleShare: () => void;
32+
isVisibilityEnabled: boolean;
33+
handleVisibilityChange: (visibility: VIEW_VISIBILITY) => void;
3134
}
3235

3336
const RightPanel: React.FC<RightPanelProps> = ({
@@ -51,7 +54,9 @@ const RightPanel: React.FC<RightPanelProps> = ({
5154
orgName,
5255
fetchingOrgError,
5356
showShareAction,
54-
handleShare
57+
handleShare,
58+
isVisibilityEnabled = false,
59+
handleVisibilityChange
5560
}) => {
5661
const cleanedType = type.replace('my-', '').replace(/s$/, '');
5762
const { data: userProfile } = useGetUserProfileByIdQuery({
@@ -75,6 +80,8 @@ const RightPanel: React.FC<RightPanelProps> = ({
7580
userProfile={userProfile}
7681
showShareAction={showShareAction}
7782
handleShare={handleShare}
83+
isVisibilityEnabled={isVisibilityEnabled}
84+
handleVisibilityChange={handleVisibilityChange}
7885
/>
7986
{showCaveats && <CaveatsSection details={details} />}
8087
<RelatedDesigns

src/custom/CatalogDetail/SocialSharePopper.tsx

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { Box, IconButton, Menu, MenuItem } from '@mui/material';
21
import React, { useState } from 'react';
3-
import { FacebookShareButton, LinkedinShareButton, TwitterShareButton } from 'react-share';
42

53
import {
64
ChainIcon,
@@ -16,9 +14,11 @@ import { Pattern } from '../CustomCatalog/CustomCard';
1614
import { CustomTooltip } from '../CustomTooltip';
1715
import { ErrorBoundary } from '../ErrorBoundary';
1816

17+
import { FacebookShareButton, LinkedinShareButton, TwitterShareButton } from 'react-share';
18+
import { Box, IconButton, Menu, MenuItem, Typography } from '../../base';
1919
import { VisibilityChipMenu } from '../VisibilityChipMenu';
2020
import { VIEW_VISIBILITY } from '../VisibilityChipMenu/VisibilityChipMenu';
21-
import { CopyShareIconWrapper } from './style';
21+
import { CopyShareIconWrapper, ShareButton, ShareButtonGroup, ShareSideButton } from './style';
2222

2323
interface SocialSharePopperProps {
2424
details: Pattern;
@@ -29,6 +29,8 @@ interface SocialSharePopperProps {
2929
handleCopyUrl: (type: string, name: string, id: string) => void;
3030
showShareAction: boolean;
3131
handleShare: () => void;
32+
isVisibilityEnabled: boolean;
33+
handleVisibilityChange: (visibility: VIEW_VISIBILITY) => void;
3234
}
3335

3436
const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
@@ -37,7 +39,10 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
3739
cardId,
3840
title,
3941
getUrl,
40-
handleCopyUrl
42+
handleCopyUrl,
43+
handleShare,
44+
isVisibilityEnabled,
45+
handleVisibilityChange
4146
}) => {
4247
const theme = useTheme();
4348
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
@@ -58,22 +63,30 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
5863
<CopyShareIconWrapper style={{ marginBottom: '2rem' }}>
5964
<VisibilityChipMenu
6065
value={details?.visibility as VIEW_VISIBILITY}
61-
onChange={() => {}}
62-
enabled={false}
66+
onChange={(value) => handleVisibilityChange(value as VIEW_VISIBILITY)}
67+
enabled={isVisibilityEnabled}
6368
options={[
6469
[VIEW_VISIBILITY.PUBLIC, PublicIcon],
6570
[VIEW_VISIBILITY.PRIVATE, LockIcon]
6671
]}
6772
/>
6873

69-
<CustomTooltip title="Copy Link" placement="top" arrow>
70-
<IconButton
71-
sx={{ borderRadius: '0.1rem', padding: '0.5rem' }}
72-
onClick={() => handleCopyUrl(cleanedType, details?.name, details?.id)}
73-
>
74-
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.secondary} />
75-
</IconButton>
76-
</CustomTooltip>
74+
<ShareButtonGroup variant="contained">
75+
<CustomTooltip title="Change access and visibility">
76+
<ShareButton variant="contained" onClick={handleShare}>
77+
<Typography>Share</Typography>
78+
</ShareButton>
79+
</CustomTooltip>
80+
<CustomTooltip title="Copy link to design">
81+
<ShareSideButton
82+
variant="contained"
83+
size="small"
84+
onClick={() => handleCopyUrl(cleanedType, details?.name, details?.id)}
85+
>
86+
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.inverse} />
87+
</ShareSideButton>
88+
</CustomTooltip>
89+
</ShareButtonGroup>
7790

7891
{(details?.visibility === 'published' || details?.visibility === 'public') && (
7992
<>

src/custom/ResponsiveDataTable.tsx

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,29 @@ const dataTableTheme = (theme: Theme, backgroundColor?: string) =>
126126
typography: {
127127
fontFamily: theme.typography.fontFamily
128128
},
129+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
130+
//@ts-ignore
131+
palette: {
132+
text: {
133+
primary: theme.palette.text.default,
134+
secondary: theme.palette.text.secondary
135+
},
136+
background: {
137+
default: backgroundColor || theme.palette.background.constant?.table,
138+
paper: backgroundColor || theme.palette.background.constant?.table
139+
}
140+
},
129141
components: {
142+
MuiTableCell: {
143+
styleOverrides: {
144+
root: {
145+
borderBottom: `1px solid ${theme.palette.border.default}`
146+
}
147+
}
148+
},
130149
MuiPaper: {
131150
styleOverrides: {
132151
root: {
133-
background: backgroundColor || theme.palette.background.default,
134152
maxWidth: '-moz-available'
135153
}
136154
}
@@ -141,24 +159,19 @@ const dataTableTheme = (theme: Theme, backgroundColor?: string) =>
141159
width: '-webkit-fill-available',
142160
'@media (max-width: 500px)': {
143161
wordWrap: 'break-word'
144-
},
145-
background: backgroundColor || theme.palette.background.constant?.table,
146-
color: theme.palette.text.default
162+
}
147163
}
148164
}
149165
},
150166
MUIDataTableHeadCell: {
151167
styleOverrides: {
152168
data: {
153169
fontWeight: 'bold',
154-
textTransform: 'uppercase',
155-
color: theme.palette.text.default
170+
textTransform: 'uppercase'
156171
},
157172
root: {
158173
fontWeight: 'bold',
159-
textTransform: 'uppercase',
160-
color: theme.palette.text.default,
161-
backgroundColor: backgroundColor || theme.palette.background.constant?.table
174+
textTransform: 'uppercase'
162175
}
163176
}
164177
},
@@ -177,7 +190,6 @@ const dataTableTheme = (theme: Theme, backgroundColor?: string) =>
177190
intermediate: false,
178191
color: 'transparent',
179192
'&.Mui-checked': {
180-
color: theme.palette.text.default,
181193
'& .MuiSvgIcon-root': {
182194
width: '1.25rem',
183195
height: '1.25rem',
@@ -207,30 +219,6 @@ const dataTableTheme = (theme: Theme, backgroundColor?: string) =>
207219
}
208220
}
209221
},
210-
MuiTableCell: {
211-
styleOverrides: {
212-
body: {
213-
color: theme.palette.text.default
214-
},
215-
root: {
216-
borderBottom: `1px solid ${theme.palette.border.default}`
217-
}
218-
}
219-
},
220-
MUIDataTablePagination: {
221-
styleOverrides: {
222-
toolbar: {
223-
color: theme.palette.text.default
224-
}
225-
}
226-
},
227-
MUIDataTableSelectCell: {
228-
styleOverrides: {
229-
headerCell: {
230-
background: backgroundColor || theme.palette.background.constant?.table
231-
}
232-
}
233-
},
234222
MuiInput: {
235223
styleOverrides: {
236224
root: {

src/icons/Chain/ChainIcon.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ const ChainIcon: React.FC<ChainIconProps> = ({ width, height, style, fill = '#3C
1212
<svg
1313
width={width}
1414
height={height}
15-
viewBox="0 0 34 18"
15+
viewBox="0 0 24 24"
1616
fill={fill}
1717
xmlns="http://www.w3.org/2000/svg"
1818
style={style}
1919
>
20-
<path d="M3.95098 9.00094C3.95098 6.16576 6.2556 3.86114 9.09078 3.86114H15.7228V0.710938H9.09078C4.5147 0.710938 0.800781 4.42486 0.800781 9.00094C0.800781 13.577 4.5147 17.2909 9.09078 17.2909H15.7228V14.1407H9.09078C6.2556 14.1407 3.95098 11.8361 3.95098 9.00094ZM10.7488 10.6589H24.0128V7.34294H10.7488V10.6589ZM25.6708 0.710938H19.0388V3.86114H25.6708C28.506 3.86114 30.8106 6.16576 30.8106 9.00094C30.8106 11.8361 28.506 14.1407 25.6708 14.1407H19.0388V17.2909H25.6708C30.2469 17.2909 33.9608 13.577 33.9608 9.00094C33.9608 4.42486 30.2469 0.710938 25.6708 0.710938Z" />
20+
<path d="M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z" />
2121
</svg>
2222
);
2323

0 commit comments

Comments
 (0)