Skip to content
Open
Changes from all commits
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
16 changes: 16 additions & 0 deletions client/modules/IDE/components/SketchListRowBase.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ const SketchListRowBase = ({
[changeVisibility]
);

const isPublic =
typeof sketch.visibility === 'string' &&
sketch.visibility.toLowerCase() === 'public';
const toggleVisibilityFromMenu = () => {
const toggle = isPublic ? 'Private' : 'Public';
handleVisibilityChange(sketch.id, sketch.name, toggle);
};

const userIsOwner = user.username === username;

let url = `/${username}/sketches/${sketch.id}`;
Expand Down Expand Up @@ -148,6 +156,14 @@ const SketchListRowBase = ({
<MenuItem hideIf={!user.authenticated} onClick={onAddToCollection}>
{t('SketchList.DropdownAddToCollection')}
</MenuItem>
<MenuItem
hideIf={!userIsOwner || !mobile}
onClick={toggleVisibilityFromMenu}
>
{isPublic
? t('SketchList.MakePrivate', 'Make Private')
: t('SketchList.MakePublic', 'Make Public')}
</MenuItem>
{/* <MenuItem onClick={handleSketchShare}>
{t('SketchList.DropdownShare')}
</MenuItem> */}
Expand Down