Skip to content

Commit

Permalink
Collection default improvments
Browse files Browse the repository at this point in the history
  • Loading branch information
macterra committed Jan 20, 2024
1 parent 6f4fce8 commit 99d633e
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions frontend/src/CollectionEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,26 @@ const CollectionEditor = ({ navigate }) => {
selectedCollection.collection.default.title = defaultTitle;
}

const defaultEditions = parseInt(selectedCollection.collection.default.editions);

if (isNaN(defaultEditions) || defaultEditions < 0 || defaultEditions > 100) {
alert("Default editions must be in range 0-100");
return;
}
else {
selectedCollection.collection.default.editions = defaultEditions;
}

const defaultRoyalty = parseInt(selectedCollection.collection.default.royalty);

if (isNaN(defaultRoyalty) || defaultRoyalty < 0 || defaultRoyalty > 25) {
alert("Default royalty must be in range 0-25");
return;
}
else {
selectedCollection.collection.default.royalty = defaultRoyalty;
}

setDisableSave(true);

try {
Expand Down Expand Up @@ -246,7 +266,7 @@ const CollectionEditor = ({ navigate }) => {
<TextField
label="Default Royalty (0-25%)"
type="number"
value={selectedCollection.collection.default.royalty || 0}
value={selectedCollection.collection.default.royalty}
onChange={(e) =>
handleDefaultRoyaltyChange(e.target.value)
}
Expand All @@ -258,14 +278,14 @@ const CollectionEditor = ({ navigate }) => {
}}
/>
<TextField
label="Default Editions (1-100)"
label="Default Editions (0-100)"
type="number"
value={selectedCollection.collection.default.editions || 1}
value={selectedCollection.collection.default.editions}
onChange={(e) => handleDefaultEditionsChange(e.target.value)}
fullWidth
margin="normal"
inputProps={{
min: 1,
min: 0,
max: 100,
}}
/>
Expand Down

0 comments on commit 99d633e

Please sign in to comment.