Skip to content

Commit

Permalink
fix: make remove cc license an option
Browse files Browse the repository at this point in the history
  • Loading branch information
louisewang1 committed May 11, 2022
1 parent 7dfe7dc commit fd44bf6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 35 deletions.
11 changes: 7 additions & 4 deletions src/components/item/publish/CCLicenseDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const CCLicenseDialog = ({
disabled,
className,
buttonName,
dialogContent,
handleSubmit,
}) => {
const { t } = useTranslation();
Expand All @@ -42,7 +41,11 @@ const CCLicenseDialog = ({
<Dialog open={open} onClose={handleClose}>
<DialogTitle>{t('Confirm Your Submission')}</DialogTitle>
<DialogContent>
<DialogContentText>{dialogContent}</DialogContentText>
<DialogContentText>
{t(
'Please verify that your item fits the CC License, and do not change to a more restricted option.',
)}
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleClose} autoFocus variant="text">
Expand All @@ -58,15 +61,15 @@ const CCLicenseDialog = ({
CCLicenseDialog.propTypes = {
open: PropTypes.bool.isRequired,
setOpen: PropTypes.func.isRequired,
disabled: PropTypes.bool.isRequired,
disabled: PropTypes.bool,
className: PropTypes.string,
buttonName: PropTypes.string.isRequired,
dialogContent: PropTypes.string.isRequired,
handleSubmit: PropTypes.func.isRequired,
};

CCLicenseDialog.defaultProps = {
className: '',
disabled: false,
};

export default CCLicenseDialog;
32 changes: 5 additions & 27 deletions src/components/item/publish/CCLicenseSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ const CCLicenseSelection = ({ item }) => {
setOpen(false);
};

const handleRemove = (event) => {
event.preventDefault();
updateCCLicense({
id: itemId,
name: itemName,
settings: { ccLicenseAdaption: '' },
});
setOpen(false);
};

return (
<>
<Typography variant="h6" className={classes.title}>
Expand Down Expand Up @@ -129,31 +119,19 @@ const CCLicenseSelection = ({ item }) => {
control={<Radio color="primary" />}
label={t('Only if others share alike')}
/>
<FormControlLabel
value={CC_LICENSE_ADAPTION_OPTIONS.NONE}
control={<Radio color="primary" />}
label={t('None')}
/>
</RadioGroup>
<CCLicenseDialog
open={open}
setOpen={setOpen}
disabled={!optionValue}
className={classes.button}
buttonName={t('Submit')}
dialogContent={t(
'Please verify that your item fits the CC License, and do not change to a more restricted option.',
)}
handleSubmit={handleSubmit}
/>
{settings?.ccLicenseAdaption !== '' && (
<CCLicenseDialog
open={open}
setOpen={setOpen}
disabled={!optionValue}
className={classes.button}
buttonName={t('Remove License')}
dialogContent={t(
'Are you sure to remove existing CC License? This action is not suggested, and may lead to license inconsistency.',
)}
handleSubmit={handleRemove}
/>
)}
<Typography variant="subtitle1">{t('Icon Preview')}</Typography>
<CCLicenseIcon
adaption={settings?.ccLicenseAdaption}
Expand Down
1 change: 1 addition & 0 deletions src/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export const ACCEPT_COOKIES_NAME = 'accept-all-cookies';
export const CC_LICENSE_ADAPTION_OPTIONS = {
ALLOW: 'allow',
ALIKE: 'alike',
NONE: '',
};

export const CC_LICENSE_ABOUT_URL =
Expand Down
3 changes: 1 addition & 2 deletions src/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@
"Icon Preview": "Icon Preview",
"Creative Commons License": "Creative Commons License",
"CC License": "CC License",
"Attention: This Action is irreversible!": "Attention: This Action is irreversible!",
"Once you submit your choice, you cannot remove selected Creative Commons License, or change to a more restricted choice.": "Once you submit your choice, you cannot remove selected Creative Commons License, or change to a more restricted choice.",
"Please verify that your item fits the CC License, and do not change to a more restricted option.": "Please verify that your item fits the CC License, and do not change to a more restricted option.",
"Confirm Your Submission": "Confirm Your Submission",
"itemValidationFailureMessage": "Your item might contain inappropriate content. Please remove them and validate your item again. If you have any question, please contact {{contact, string}}.",
"Publication On Explorer": "Publication On Explorer",
Expand Down
4 changes: 2 additions & 2 deletions src/langs/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
"Create Shortcut": "Créer un Raccourci",
"Sign Out": "Déconnexion",
"Confirm deletion": "Confirmer la suppression",
"itemDeleteMessage_one": "Cet élément sera supprimé définitivement.",
"itemDeleteMessage_other": "Ces éléments seront supprimés définitivement.",
"itemDeleteMessage_one": "Cet élément sera supprimé définitivement.",
"itemDeleteMessage_other": "Ces éléments seront supprimés définitivement.",
"Allow Item Login": "Activer l'authentification pour l'élément",
"Language": "Langue",
"Storage Used": "Mémoire utilisée",
Expand Down

0 comments on commit fd44bf6

Please sign in to comment.