@@ -145,6 +146,7 @@ const SketchList = ({
context: mobile ? 'mobile' : ''
})
)}
+ {userIsOwner && renderFieldHeader('makePrivate', 'Make Private')}
|
@@ -187,7 +189,8 @@ SketchList.propTypes = {
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
createdAt: PropTypes.string.isRequired,
- updatedAt: PropTypes.string.isRequired
+ updatedAt: PropTypes.string.isRequired,
+ visibility: PropTypes.string
})
).isRequired,
username: PropTypes.string,
diff --git a/client/modules/IDE/components/SketchListRowBase.jsx b/client/modules/IDE/components/SketchListRowBase.jsx
index 08dc185885..56ddcfc5ae 100644
--- a/client/modules/IDE/components/SketchListRowBase.jsx
+++ b/client/modules/IDE/components/SketchListRowBase.jsx
@@ -10,6 +10,8 @@ import TableDropdown from '../../../components/Dropdown/TableDropdown';
import MenuItem from '../../../components/Dropdown/MenuItem';
import dates from '../../../utils/formatDate';
import getConfig from '../../../utils/getConfig';
+import LockIcon from '../../../images/lock.svg';
+import EarthIcon from '../../../images/earth.svg';
const ROOT_URL = getConfig('API_URL');
@@ -23,6 +25,8 @@ const SketchListRowBase = ({
changeProjectName,
cloneProject,
deleteProject,
+ showShareModal,
+ changeVisibility,
t,
mobile,
onAddToCollection
@@ -75,12 +79,42 @@ const SketchListRowBase = ({
};
const handleSketchDuplicate = () => cloneProject(sketch);
+
+ // const handleSketchShare = () => {
+ // showShareModal(sketch.id, sketch.name, username);
+ // };
+
const handleSketchDelete = () => {
if (window.confirm(t('Common.DeleteConfirmation', { name: sketch.name }))) {
deleteProject(sketch.id);
}
};
+ const handleToggleVisibilityChange = (e) => {
+ const isChecked = e.target.checked;
+ const newVisibility = isChecked ? 'Private' : 'Public';
+ changeVisibility(sketch.id, sketch.name, newVisibility);
+ };
+
+ const renderToggleVisibility = () => (
+
+
+
+
+ );
+
const userIsOwner = user.username === username;
let url = `/${username}/sketches/${sketch.id}`;
@@ -110,6 +144,7 @@ const SketchListRowBase = ({
{name} |
{formatDateCell(sketch.createdAt, mobile)} |
{formatDateCell(sketch.updatedAt, mobile)} |
+ {renderToggleVisibility()} |
|