Working stuff!
This commit is contained in:
1 parent
9d69d13aa5
commit
5b73127836
9 files changed
+168
-38
No files matched your search
@@ -27,6 +27,10 @@ export default function WelcomeScreen() {
|
||||
return tourCode.length === CODE_LENGTH;
|
||||
};
|
||||
|
||||
const cleanTourCode = (dirtyTourCode: string): string => {
|
||||
return dirtyTourCode.toUpperCase().replaceAll(/\W/g, "").substring(0, 9);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (checkCooldown()) {
|
||||
setIsCooldown(true);
|
||||
@@ -41,7 +45,7 @@ export default function WelcomeScreen() {
|
||||
}, [lastSubmitTs]);
|
||||
|
||||
const submit = () => {
|
||||
const value = tourCodeRef.current;
|
||||
const value = cleanTourCode(tourCodeRef.current);
|
||||
|
||||
if (!isTourCodeValid() && checkCooldown()) {
|
||||
return;
|
||||
@@ -63,7 +67,7 @@ export default function WelcomeScreen() {
|
||||
return false;
|
||||
}
|
||||
tourCodeRef.current = value;
|
||||
setTourCode(value.toUpperCase().replaceAll(/\W/g, ""));
|
||||
setTourCode(cleanTourCode(value));
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -83,7 +87,7 @@ export default function WelcomeScreen() {
|
||||
</label>
|
||||
<br></br>
|
||||
<ChargedButton
|
||||
holdDuration={1000}
|
||||
holdDuration={500}
|
||||
onAction={submit}
|
||||
className="screen-submit"
|
||||
disabled={buttonDisabled}
|
||||
|
||||
Reference in new issue
Block a user