Skip to content

Commit c5956b8

Browse files
committed
Merge branch 'develop'
2 parents 9b3fb9b + 026135f commit c5956b8

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"private": true,
1515
"dependencies": {
16-
"@abstractplay/gameslib": "latest",
16+
"@abstractplay/gameslib": "^1.0.0-ci-20664066000.0",
1717
"@abstractplay/renderer": "latest",
1818
"@atlaskit/pragmatic-drag-and-drop": "^1.3.0",
1919
"@tanstack/react-table": "^8.11.2",

src/components/NewChallengeModal.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,28 @@ function NewChallengeModal(props) {
6565
const [globalMe] = useContext(MeContext);
6666
const [allUsers] = useContext(UsersContext);
6767
const [users, usersSetter] = useState([]);
68+
const [forceUnrated, setForceUnrated] = useState(false);
6869
const errorRef = useRef(null);
6970

7071
useEffect(() => {
7172
addResource(i18n.language);
7273
}, [i18n.language]);
7374

75+
useEffect(() => {
76+
let forced = false;
77+
if (metaGame !== null) {
78+
const info = gameinfo.get(metaGame);
79+
for (const vname of selectedVariants) {
80+
const variant = info.variants.find((v) => v.uid === vname);
81+
if (variant.unrated === true) {
82+
forced = true;
83+
break;
84+
}
85+
}
86+
}
87+
setForceUnrated(forced);
88+
}, [metaGame, selectedVariants]);
89+
7490
useEffect(() => {
7591
if (error && errorRef.current) {
7692
errorRef.current.scrollIntoView({ behavior: "smooth", block: "end" });
@@ -291,7 +307,7 @@ function NewChallengeModal(props) {
291307
clockInc: clockInc,
292308
clockMax: clockMax,
293309
clockHard: clockHard,
294-
rated: rated,
310+
rated: forceUnrated ? false : rated,
295311
noExplore: noExplore,
296312
comment: comment,
297313
});
@@ -774,6 +790,7 @@ function NewChallengeModal(props) {
774790
id="rated"
775791
checked={rated}
776792
onChange={handleRatedChange}
793+
disabled={forceUnrated}
777794
/>
778795
{t("ChooseRated")}
779796
</label>

0 commit comments

Comments
 (0)