Compare commits
No commits in common. "2aa8c4178a56adf886707c5ef277238591bb9e53" and "625c0c3ed21c52e36bfad21a3a7863e230784bda" have entirely different histories.
2aa8c4178a
...
625c0c3ed2
@ -13,12 +13,17 @@
|
|||||||
<Card.Header>
|
<Card.Header>
|
||||||
<Card.Title class="text-2xl">Login</Card.Title>
|
<Card.Title class="text-2xl">Login</Card.Title>
|
||||||
<Card.Description
|
<Card.Description
|
||||||
>Please enter kiosk credentials.</Card.Description
|
>Please enter credentials for an account that is allowed to create
|
||||||
|
runners and their selfservice links.</Card.Description
|
||||||
>
|
>
|
||||||
</Card.Header>
|
</Card.Header>
|
||||||
<Card.Content class="grid gap-4">
|
<Card.Content class="grid gap-4">
|
||||||
<div class="grid gap-2">
|
<div class="grid gap-2">
|
||||||
<Label for="password">Token</Label>
|
<Label for="email">Email</Label>
|
||||||
|
<Input id="email" type="email" placeholder="m@example.com" required />
|
||||||
|
</div>
|
||||||
|
<div class="grid gap-2">
|
||||||
|
<Label for="password">Password</Label>
|
||||||
<Input id="password" type="password" required />
|
<Input id="password" type="password" required />
|
||||||
</div>
|
</div>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
|
@ -9,83 +9,31 @@
|
|||||||
WELCOME: {
|
WELCOME: {
|
||||||
name: "Welcome",
|
name: "Welcome",
|
||||||
progress: 0,
|
progress: 0,
|
||||||
showback: false,
|
|
||||||
},
|
},
|
||||||
SIGNUP: {
|
SIGNUP: {
|
||||||
name: "Signup",
|
name: "Signup",
|
||||||
progress: 25,
|
progress: 25,
|
||||||
showback: true,
|
|
||||||
},
|
},
|
||||||
SIGNUP_MAIL: {
|
SIGNUP_MAIL: {
|
||||||
name: "Signup with Mail",
|
name: "Signup with Mail",
|
||||||
progress: 50,
|
progress: 50,
|
||||||
showback: true,
|
|
||||||
},
|
|
||||||
SIGNUP_MAIL_ACCEPT: {
|
|
||||||
name: "Accept terms",
|
|
||||||
progress: 75,
|
|
||||||
showback: true,
|
|
||||||
},
|
|
||||||
SIGNUP_SUCCESS: {
|
|
||||||
name: "Done",
|
|
||||||
progress: 100,
|
|
||||||
showback: false,
|
|
||||||
},
|
},
|
||||||
SIGNIN: {
|
SIGNIN: {
|
||||||
name: "Signin",
|
name: "Signin",
|
||||||
progress: 50,
|
progress: 50,
|
||||||
showback: true,
|
|
||||||
},
|
},
|
||||||
SIGNIN_BARCODE: {
|
SIGNIN_BARCODE: {
|
||||||
name: "Signin with Barcode",
|
name: "Signin with Barcode",
|
||||||
progress: 100,
|
progress: 100,
|
||||||
showback: false,
|
|
||||||
},
|
},
|
||||||
SIGNIN_MAIL: {
|
SIGNIN_MAIL: {
|
||||||
name: "Signin by Mail",
|
name: "Signin by Mail",
|
||||||
progress: 75,
|
progress: 75,
|
||||||
showback: true,
|
|
||||||
},
|
|
||||||
SIGNIN_MAIL_SUCCESS: {
|
|
||||||
name: "Signin by Mail Success",
|
|
||||||
progress: 100,
|
|
||||||
showback: false,
|
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
type StepType = (typeof Steps)[keyof typeof Steps];
|
type StepType = (typeof Steps)[keyof typeof Steps];
|
||||||
let currentStep = $state<StepType>(Steps.WELCOME);
|
let currentStep = $state<StepType>(Steps.WELCOME);
|
||||||
let email = $state<string>("");
|
|
||||||
let remainingseconds = $state<number>(5);
|
|
||||||
|
|
||||||
// Function to handle automatic return to welcome screen
|
|
||||||
function startCountdown() {
|
|
||||||
if (currentStep.progress === 100) {
|
|
||||||
remainingseconds = 10;
|
|
||||||
const timer = setInterval(() => {
|
|
||||||
remainingseconds -= 1;
|
|
||||||
if (remainingseconds <= 0) {
|
|
||||||
clearInterval(timer);
|
|
||||||
currentStep = Steps.WELCOME;
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
return timer;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
import { onDestroy } from 'svelte';
|
|
||||||
|
|
||||||
// Watch for changes to currentStep
|
|
||||||
$effect(() => {
|
|
||||||
if (currentStep.progress === 100) {
|
|
||||||
const timer = startCountdown();
|
|
||||||
// Cleanup when component is destroyed
|
|
||||||
onDestroy(() => {
|
|
||||||
if (timer) clearInterval(timer);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="pt-48">
|
<div class="pt-48">
|
||||||
@ -146,27 +94,6 @@
|
|||||||
>
|
>
|
||||||
<Input id="email" type="email" placeholder="m@example.com" />
|
<Input id="email" type="email" placeholder="m@example.com" />
|
||||||
</div>
|
</div>
|
||||||
<Button
|
|
||||||
variant="default"
|
|
||||||
class="w-full"
|
|
||||||
on:click={() => {
|
|
||||||
currentStep = Steps.SIGNUP_MAIL_ACCEPT;
|
|
||||||
}}>Continue</Button
|
|
||||||
>
|
|
||||||
{:else if currentStep.name == Steps.SIGNUP_MAIL_ACCEPT.name}
|
|
||||||
<Button
|
|
||||||
variant="default"
|
|
||||||
class="w-full"
|
|
||||||
on:click={() => {
|
|
||||||
currentStep = Steps.SIGNUP_SUCCESS;
|
|
||||||
}}>Continue</Button
|
|
||||||
>
|
|
||||||
{:else if currentStep.name == Steps.SIGNUP_SUCCESS.name}
|
|
||||||
<p class="text-center">
|
|
||||||
Alright that's it, just walk up to the next available person and tell them your name.<br>
|
|
||||||
You can scan this qr code to login to our selfservice.
|
|
||||||
</p>
|
|
||||||
TODO:
|
|
||||||
{:else if currentStep.name == Steps.SIGNIN.name}
|
{:else if currentStep.name == Steps.SIGNIN.name}
|
||||||
<div class="grid gap-2">
|
<div class="grid gap-2">
|
||||||
<Button
|
<Button
|
||||||
@ -196,7 +123,6 @@
|
|||||||
id="email"
|
id="email"
|
||||||
type="email"
|
type="email"
|
||||||
placeholder="m@example.com"
|
placeholder="m@example.com"
|
||||||
bind:value={email}
|
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -204,17 +130,14 @@
|
|||||||
<Button
|
<Button
|
||||||
class="w-full"
|
class="w-full"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
console.log("Email: ", email);
|
currentStep = Steps.SIGNIN_BARCODE;
|
||||||
currentStep = Steps.SIGNIN_MAIL_SUCCESS;
|
}}>Next!</Button
|
||||||
}}>Continue</Button
|
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
{:else if currentStep.name == Steps.SIGNIN_MAIL_SUCCESS.name}
|
|
||||||
We found your email address, just walk up to the next available person and tell them your name.
|
|
||||||
{/if}
|
{/if}
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
<Card.Footer class="grid gap-4">
|
<Card.Footer>
|
||||||
{#if currentStep.showback}
|
{#if currentStep.name != Steps.WELCOME.name}
|
||||||
<Button
|
<Button
|
||||||
variant="destructive"
|
variant="destructive"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
@ -241,19 +164,6 @@
|
|||||||
}}>Go Back</Button
|
}}>Go Back</Button
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
{#if currentStep.progress == 100}
|
|
||||||
<Button
|
|
||||||
variant="default"
|
|
||||||
class="w-full"
|
|
||||||
on:click={() => {
|
|
||||||
currentStep=Steps.WELCOME;
|
|
||||||
}
|
|
||||||
}>Done</Button
|
|
||||||
>
|
|
||||||
<p class="text-center">
|
|
||||||
Returning to the home screen in {remainingseconds} seconds...
|
|
||||||
</p>
|
|
||||||
{/if}
|
|
||||||
</Card.Footer>
|
</Card.Footer>
|
||||||
</Card.Root>
|
</Card.Root>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user