Skip to content

Commit

Permalink
pids: improve UI for optional DOI
Browse files Browse the repository at this point in the history
  • Loading branch information
zzacharo committed Jan 21, 2025
1 parent 9b313de commit 689c9c8
Show file tree
Hide file tree
Showing 18 changed files with 1,123 additions and 714 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class PublishButtonComponent extends Component {

handlePublish = (event, handleSubmit, publishWithoutCommunity) => {
const { setSubmitContext } = this.context;
const { formik, raiseDOINeededButNotReserved, isDOIRequired } = this.props;
const noINeedDOI = formik?.values?.noINeedDOI;
const { formik, raiseDOINeededButNotReserved, isDOIRequired, noINeedDOI } =
this.props;
// Check for explicit DOI reservation via the "GET DOI button" only when DOI is
// optional in the instance's settings. If it is required, backend will automatically
// mint one even if it was not explicitly reserved
Expand Down Expand Up @@ -92,6 +92,8 @@ class PublishButtonComponent extends Component {
formik,
publishModalExtraContent,
raiseDOINeededButNotReserved,
noINeedDOI,
isDOIRequired,
...ui
} = this.props;
const { isConfirmModalOpen } = this.state;
Expand Down Expand Up @@ -166,6 +168,7 @@ PublishButtonComponent.propTypes = {
filesState: PropTypes.object,
raiseDOINeededButNotReserved: PropTypes.func.isRequired,
isDOIRequired: PropTypes.bool,
noINeedDOI: PropTypes.bool,
};

PublishButtonComponent.defaultProps = {
Expand All @@ -175,13 +178,15 @@ PublishButtonComponent.defaultProps = {
publishModalExtraContent: undefined,
filesState: undefined,
isDOIRequired: undefined,
noINeedDOI: undefined,
};

const mapStateToProps = (state) => ({
actionState: state.deposit.actionState,
publishModalExtraContent: state.deposit.config.publish_modal_extra,
filesState: state.files,
isDOIRequired: state.deposit.config.is_doi_required,
noINeedDOI: state.deposit.noINeedDOI,
});

export const PublishButton = connect(mapStateToProps, (dispatch) => {
Expand Down
Loading

0 comments on commit 689c9c8

Please sign in to comment.