Skip to content

Commit b6ec794

Browse files
committed
fix*share): ci check
Signed-off-by: Sudhanshu Dasgupta <[email protected]>
1 parent 216733f commit b6ec794

File tree

5 files changed

+43
-16
lines changed

5 files changed

+43
-16
lines changed

src/custom/CatalogDetail/OverviewSection.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ interface OverviewSectionProps {
2323
fontFamily?: string;
2424
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2525
userProfile?: any;
26+
showShareAction: boolean;
27+
handleShare: () => void;
2628
}
2729

2830
const OverviewSection: React.FC<OverviewSectionProps> = ({
@@ -37,7 +39,9 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
3739
classes,
3840
handleCopyUrl,
3941
fontFamily,
40-
userProfile
42+
userProfile,
43+
showShareAction,
44+
handleShare
4145
}) => {
4246
return (
4347
<OverviewContainer>
@@ -58,6 +62,8 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
5862
title={title}
5963
getUrl={getUrl}
6064
handleCopyUrl={handleCopyUrl}
65+
showShareAction={showShareAction}
66+
handleShare={handleShare}
6167
/>
6268
</div>
6369
<Grid container spacing={2}>

src/custom/CatalogDetail/RightPanel.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ interface RightPanelProps {
2626
technologySVGSubpath: string;
2727
orgName: string;
2828
fetchingOrgError: boolean;
29+
showShareAction: boolean;
30+
handleShare: () => void;
2931
}
3032

3133
const RightPanel: React.FC<RightPanelProps> = ({
@@ -47,7 +49,9 @@ const RightPanel: React.FC<RightPanelProps> = ({
4749
technologySVGPath,
4850
technologySVGSubpath,
4951
orgName,
50-
fetchingOrgError
52+
fetchingOrgError,
53+
showShareAction,
54+
handleShare
5155
}) => {
5256
const cleanedType = type.replace('my-', '').replace(/s$/, '');
5357
const { data: userProfile } = useGetUserProfileByIdQuery({
@@ -69,6 +73,8 @@ const RightPanel: React.FC<RightPanelProps> = ({
6973
handleCopyUrl={handleCopyUrl}
7074
fontFamily={fontFamily}
7175
userProfile={userProfile}
76+
showShareAction={showShareAction}
77+
handleShare={handleShare}
7278
/>
7379
{showCaveats && <CaveatsSection details={details} />}
7480
<RelatedDesigns

src/custom/CatalogDetail/SocialSharePopper.tsx

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useTheme } from '../../theme';
66
import { Pattern } from '../CustomCatalog/CustomCard';
77
import { CustomTooltip } from '../CustomTooltip';
88
import { ErrorBoundary } from '../ErrorBoundary';
9-
import { CopyShareIconWrapper, VisibilityChip } from './style';
9+
import { ActionButton, CopyShareIconWrapper, VisibilityChip } from './style';
1010

1111
interface SocialSharePopperProps {
1212
details: Pattern;
@@ -15,6 +15,8 @@ interface SocialSharePopperProps {
1515
title: string;
1616
getUrl: (type: string, id: string) => string;
1717
handleCopyUrl: (type: string, name: string, id: string) => void;
18+
showShareAction: boolean;
19+
handleShare: () => void;
1820
}
1921

2022
const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
@@ -23,7 +25,9 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
2325
cardId,
2426
title,
2527
getUrl,
26-
handleCopyUrl
28+
handleCopyUrl,
29+
showShareAction,
30+
handleShare
2731
}) => {
2832
const theme = useTheme();
2933
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
@@ -50,15 +54,26 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
5054
{details?.visibility}
5155
</VisibilityChip>
5256

53-
{details?.visibility !== 'private' && (
54-
<CustomTooltip title="Copy Link" placement="top" arrow>
55-
<IconButton
56-
sx={{ borderRadius: '0.1rem', padding: '0.5rem' }}
57-
onClick={() => handleCopyUrl(cleanedType, details?.name, details?.id)}
58-
>
57+
{showShareAction ? (
58+
<CustomTooltip title="Share" placement="top" arrow>
59+
<ActionButton sx={{ borderRadius: '0.1rem', padding: '0.5rem' }} onClick={handleShare}>
5960
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.secondary} />
60-
</IconButton>
61+
Share
62+
</ActionButton>
6163
</CustomTooltip>
64+
) : (
65+
<>
66+
{details?.visibility !== 'private' && (
67+
<CustomTooltip title="Copy Link" placement="top" arrow>
68+
<IconButton
69+
sx={{ borderRadius: '0.1rem', padding: '0.5rem' }}
70+
onClick={() => handleCopyUrl(cleanedType, details?.name, details?.id)}
71+
>
72+
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.secondary} />
73+
</IconButton>
74+
</CustomTooltip>
75+
)}
76+
</>
6277
)}
6378

6479
{(details?.visibility === 'published' || details?.visibility === 'public') && (

src/custom/ShareModal/ShareModal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ChainIcon, DeleteIcon, LockIcon, PublicIcon } from '../../icons';
1515
import { useTheme } from '../../theme';
1616
import { BLACK, WHITE } from '../../theme/colors';
1717
import { Modal, ModalBody, ModalButtonPrimary, ModalButtonSecondary, ModalFooter } from '../Modal';
18-
import { UserSearchField } from '../UserSearchField';
18+
import UserShareSearch from '../UserSearchField/UserSearchField';
1919
import {
2020
CustomDialogContentText,
2121
CustomListItemText,
@@ -224,7 +224,7 @@ const ShareModal: React.FC<ShareModalProps> = ({
224224
title={`Share ${dataName} "${selectedResource?.name}"`}
225225
>
226226
<ModalBody>
227-
<UserSearchField
227+
<UserShareSearch
228228
setUsersData={setShareUserData}
229229
usersData={shareUserData}
230230
label="Search Users"
@@ -293,7 +293,7 @@ const ShareModal: React.FC<ShareModalProps> = ({
293293
style={{ marginRight: '1rem', padding: '7px 16px' }}
294294
>
295295
<IconButtonWrapper>
296-
<ChainIcon width={24} height={24} fill={theme.palette.text.constant?.white} />
296+
<ChainIcon width="24" height="24" fill={theme.palette.text.constant?.white} />
297297
</IconButtonWrapper>
298298
<Typography>Copy Link</Typography>
299299
</ModalButtonSecondary>

src/custom/UserSearchField/UserSearchField.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ interface UserSearchFieldProps {
4141
fetchSuggestions: (value: string) => Promise<User[]>;
4242
}
4343

44-
const UserSearchField: React.FC<UserSearchFieldProps> = ({
44+
const UserShareSearch: React.FC<UserSearchFieldProps> = ({
4545
usersData,
4646
setUsersData,
4747
label,
@@ -234,4 +234,4 @@ const UserSearchField: React.FC<UserSearchFieldProps> = ({
234234
);
235235
};
236236

237-
export default UserSearchField;
237+
export default UserShareSearch;

0 commit comments

Comments
 (0)