Skip to content

Commit a6d0779

Browse files
committed
feat(visibility): add visibility selector to change its visibility
Signed-off-by: Sudhanshu Dasgupta <[email protected]>
1 parent 9bbe475 commit a6d0779

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

src/custom/CatalogDetail/OverviewSection.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ interface OverviewSectionProps {
2525
userProfile?: any;
2626
showShareAction: boolean;
2727
handleShare: () => void;
28+
isVisibilityEnabled: boolean;
29+
handleVisibilityChange: () => void;
2830
}
2931

3032
const OverviewSection: React.FC<OverviewSectionProps> = ({
@@ -41,7 +43,9 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
4143
fontFamily,
4244
userProfile,
4345
showShareAction,
44-
handleShare
46+
handleShare,
47+
isVisibilityEnabled,
48+
handleVisibilityChange
4549
}) => {
4650
return (
4751
<OverviewContainer>
@@ -64,6 +68,8 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
6468
handleCopyUrl={handleCopyUrl}
6569
showShareAction={showShareAction}
6670
handleShare={handleShare}
71+
isVisibilityEnabled={isVisibilityEnabled}
72+
handleVisibilityChange={handleVisibilityChange}
6773
/>
6874
</div>
6975
<Grid container spacing={2}>

src/custom/CatalogDetail/RightPanel.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ interface RightPanelProps {
2828
fetchingOrgError: boolean;
2929
showShareAction: boolean;
3030
handleShare: () => void;
31+
isVisibilityEnabled: boolean;
32+
handleVisibilityChange: () => void;
3133
}
3234

3335
const RightPanel: React.FC<RightPanelProps> = ({
@@ -51,7 +53,9 @@ const RightPanel: React.FC<RightPanelProps> = ({
5153
orgName,
5254
fetchingOrgError,
5355
showShareAction,
54-
handleShare
56+
handleShare,
57+
isVisibilityEnabled = false,
58+
handleVisibilityChange
5559
}) => {
5660
const cleanedType = type.replace('my-', '').replace(/s$/, '');
5761
const { data: userProfile } = useGetUserProfileByIdQuery({
@@ -75,6 +79,8 @@ const RightPanel: React.FC<RightPanelProps> = ({
7579
userProfile={userProfile}
7680
showShareAction={showShareAction}
7781
handleShare={handleShare}
82+
isVisibilityEnabled={isVisibilityEnabled}
83+
handleVisibilityChange={handleVisibilityChange}
7884
/>
7985
{showCaveats && <CaveatsSection details={details} />}
8086
<RelatedDesigns

src/custom/CatalogDetail/SocialSharePopper.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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: () => void;
3234
}
3335

3436
const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
@@ -38,7 +40,9 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
3840
title,
3941
getUrl,
4042
handleCopyUrl,
41-
handleShare
43+
handleShare,
44+
isVisibilityEnabled,
45+
handleVisibilityChange
4246
}) => {
4347
const theme = useTheme();
4448
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
@@ -59,8 +63,8 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
5963
<CopyShareIconWrapper style={{ marginBottom: '2rem' }}>
6064
<VisibilityChipMenu
6165
value={details?.visibility as VIEW_VISIBILITY}
62-
onChange={() => {}}
63-
enabled={false}
66+
onChange={handleVisibilityChange}
67+
enabled={isVisibilityEnabled}
6468
options={[
6569
[VIEW_VISIBILITY.PUBLIC, PublicIcon],
6670
[VIEW_VISIBILITY.PRIVATE, LockIcon]

0 commit comments

Comments
 (0)