commit 5184657c008f5c9bb3be4fca64a275e72d3c8fcc
parent 52ea1bcf0aecaba35259cf03a69c82118e14b60b
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Tue, 14 Mar 2023 18:15:18 +0100
feat(newheat): prevent default name
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/Leaderboard.js b/src/Leaderboard.js
@@ -90,13 +90,18 @@ function rankByHeat(rankingComp) {
async function newHeatFromLeaderboard(e, leaderboard, rankingComp, selectHeatRef, newHeatSize, newHeatName) {
e.preventDefault()
- selectHeatRef.current.clearValue()
-
if (leaderboard.length === 0) {
// cannot create new heat from empty leaderboard
return
}
+ if (newHeatName === "Heat name") {
+ alert('Choose a better name for your new heat')
+ return
+ }
+
+ selectHeatRef.current.clearValue()
+
// create new heat
const { data, error } = await supabase
.from('heats')