Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(visibilitySelector): add visibility selector to change catalog visibility #861

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/custom/CatalogDetail/OverviewSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ interface OverviewSectionProps {
userProfile?: any;
showShareAction: boolean;
handleShare: () => void;
isVisibilityEnabled: boolean;
handleVisibilityChange: () => void;
}

const OverviewSection: React.FC<OverviewSectionProps> = ({
Expand All @@ -41,7 +43,9 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
fontFamily,
userProfile,
showShareAction,
handleShare
handleShare,
isVisibilityEnabled,
handleVisibilityChange
}) => {
return (
<OverviewContainer>
Expand All @@ -64,6 +68,8 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
handleCopyUrl={handleCopyUrl}
showShareAction={showShareAction}
handleShare={handleShare}
isVisibilityEnabled={isVisibilityEnabled}
handleVisibilityChange={handleVisibilityChange}
/>
</div>
<Grid container spacing={2}>
Expand Down
8 changes: 7 additions & 1 deletion src/custom/CatalogDetail/RightPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ interface RightPanelProps {
fetchingOrgError: boolean;
showShareAction: boolean;
handleShare: () => void;
isVisibilityEnabled: boolean;
handleVisibilityChange: () => void;
}

const RightPanel: React.FC<RightPanelProps> = ({
Expand All @@ -51,7 +53,9 @@ const RightPanel: React.FC<RightPanelProps> = ({
orgName,
fetchingOrgError,
showShareAction,
handleShare
handleShare,
isVisibilityEnabled = false,
handleVisibilityChange
}) => {
const cleanedType = type.replace('my-', '').replace(/s$/, '');
const { data: userProfile } = useGetUserProfileByIdQuery({
Expand All @@ -75,6 +79,8 @@ const RightPanel: React.FC<RightPanelProps> = ({
userProfile={userProfile}
showShareAction={showShareAction}
handleShare={handleShare}
isVisibilityEnabled={isVisibilityEnabled}
handleVisibilityChange={handleVisibilityChange}
/>
{showCaveats && <CaveatsSection details={details} />}
<RelatedDesigns
Expand Down
10 changes: 7 additions & 3 deletions src/custom/CatalogDetail/SocialSharePopper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ interface SocialSharePopperProps {
handleCopyUrl: (type: string, name: string, id: string) => void;
showShareAction: boolean;
handleShare: () => void;
isVisibilityEnabled: boolean;
handleVisibilityChange: () => void;
}

const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
Expand All @@ -38,7 +40,9 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
title,
getUrl,
handleCopyUrl,
handleShare
handleShare,
isVisibilityEnabled,
handleVisibilityChange
}) => {
const theme = useTheme();
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
Expand All @@ -59,8 +63,8 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
<CopyShareIconWrapper style={{ marginBottom: '2rem' }}>
<VisibilityChipMenu
value={details?.visibility as VIEW_VISIBILITY}
onChange={() => {}}
enabled={false}
onChange={handleVisibilityChange}
enabled={isVisibilityEnabled}
options={[
[VIEW_VISIBILITY.PUBLIC, PublicIcon],
[VIEW_VISIBILITY.PRIVATE, LockIcon]
Expand Down
Loading