diff --git a/src/custom/CatalogDetail/OverviewSection.tsx b/src/custom/CatalogDetail/OverviewSection.tsx index 825ed48a..57b2cf66 100644 --- a/src/custom/CatalogDetail/OverviewSection.tsx +++ b/src/custom/CatalogDetail/OverviewSection.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { Grid } from '../../base'; import { Pattern } from '../CustomCatalog/CustomCard'; +import { VIEW_VISIBILITY } from '../VisibilityChipMenu/VisibilityChipMenu'; import ContentClassInfo from './ContentClassInfo'; import MetricsDisplay from './MetricsDisplay'; import PatternInfo from './PatternInfo'; @@ -25,6 +26,8 @@ interface OverviewSectionProps { userProfile?: any; showShareAction: boolean; handleShare: () => void; + isVisibilityEnabled: boolean; + handleVisibilityChange: (visibility: VIEW_VISIBILITY) => void; } const OverviewSection: React.FC = ({ @@ -41,7 +44,9 @@ const OverviewSection: React.FC = ({ fontFamily, userProfile, showShareAction, - handleShare + handleShare, + isVisibilityEnabled, + handleVisibilityChange }) => { return ( @@ -64,6 +69,8 @@ const OverviewSection: React.FC = ({ handleCopyUrl={handleCopyUrl} showShareAction={showShareAction} handleShare={handleShare} + isVisibilityEnabled={isVisibilityEnabled} + handleVisibilityChange={handleVisibilityChange} /> diff --git a/src/custom/CatalogDetail/RightPanel.tsx b/src/custom/CatalogDetail/RightPanel.tsx index 98c83698..570119ab 100644 --- a/src/custom/CatalogDetail/RightPanel.tsx +++ b/src/custom/CatalogDetail/RightPanel.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { Pattern } from '../CustomCatalog/CustomCard'; +import { VIEW_VISIBILITY } from '../VisibilityChipMenu/VisibilityChipMenu'; import CaveatsSection from './CaveatsSection'; import OverviewSection from './OverviewSection'; import RelatedDesigns, { PatternsPerUser } from './RelatedDesigns'; @@ -28,6 +29,8 @@ interface RightPanelProps { fetchingOrgError: boolean; showShareAction: boolean; handleShare: () => void; + isVisibilityEnabled: boolean; + handleVisibilityChange: (visibility: VIEW_VISIBILITY) => void; } const RightPanel: React.FC = ({ @@ -51,7 +54,9 @@ const RightPanel: React.FC = ({ orgName, fetchingOrgError, showShareAction, - handleShare + handleShare, + isVisibilityEnabled = false, + handleVisibilityChange }) => { const cleanedType = type.replace('my-', '').replace(/s$/, ''); const { data: userProfile } = useGetUserProfileByIdQuery({ @@ -75,6 +80,8 @@ const RightPanel: React.FC = ({ userProfile={userProfile} showShareAction={showShareAction} handleShare={handleShare} + isVisibilityEnabled={isVisibilityEnabled} + handleVisibilityChange={handleVisibilityChange} /> {showCaveats && } void; showShareAction: boolean; handleShare: () => void; + isVisibilityEnabled: boolean; + handleVisibilityChange: (visibility: VIEW_VISIBILITY) => void; } const SocialSharePopper: React.FC = ({ @@ -38,7 +40,9 @@ const SocialSharePopper: React.FC = ({ title, getUrl, handleCopyUrl, - handleShare + handleShare, + isVisibilityEnabled, + handleVisibilityChange }) => { const theme = useTheme(); const [anchorEl, setAnchorEl] = useState(null); @@ -59,8 +63,8 @@ const SocialSharePopper: React.FC = ({ {}} - enabled={false} + onChange={(value) => handleVisibilityChange(value as VIEW_VISIBILITY)} + enabled={isVisibilityEnabled} options={[ [VIEW_VISIBILITY.PUBLIC, PublicIcon], [VIEW_VISIBILITY.PRIVATE, LockIcon]