disable register rule timeout in dev mode

This commit is contained in:
bytedream 2024-10-19 20:53:40 +02:00
parent c6040f06dd
commit 0bb02b4687

@ -5,9 +5,12 @@
import { env } from '$env/dynamic/public';
import { rulesShort } from '$lib/rules';
import { RegisterSchema } from './schema';
import { dev } from '$app/environment';
const dispatch = createEventDispatcher();
const modalTimeoutSeconds = dev ? 0 : 30;
// eslint-disable-next-line @typescript-eslint/no-empty-function
let checkInputs = () => {};
let playertype = 'java';
@ -281,14 +284,14 @@
<!-- svelte-ignore a11y-no-static-element-interactions a11y-click-events-have-key-events -->
<div
class="relative w-min"
title={rulesModalSecondsOpened < 30
title={rulesModalSecondsOpened < modalTimeoutSeconds
? `Regeln können in ${Math.max(
30 - rulesModalSecondsOpened,
modalTimeoutSeconds - rulesModalSecondsOpened,
0
)} Sekunden akzeptiert werden`
: ''}
on:click={() => {
if (rulesModalSecondsOpened < 30) {
if (rulesModalSecondsOpened < modalTimeoutSeconds) {
errorMessage =
'Bitte lies die Regeln aufmerksam durch. Du kannst erst in einigen Sekunden fortfahren.';
}
@ -296,7 +299,7 @@
>
<div class="absolute top-0 left-0 h-full w-full overflow-hidden rounded-lg">
<div
style="width: {Math.min((rulesModalSecondsOpened / 30) * 100, 100)}%"
style="width: {Math.min((rulesModalSecondsOpened / modalTimeoutSeconds) * 100, 100)}%"
class="h-full bg-base-300"
/>
</div>
@ -304,7 +307,7 @@
id="rules-accept"
type="submit"
value="Akzeptieren"
disabled={rulesModalSecondsOpened < 30}
disabled={rulesModalSecondsOpened < modalTimeoutSeconds}
containerClass="bg-transparent z-[1] relative"
on:click={() => {
rulesAccepted = true;