add titles head

This commit is contained in:
Lilian 2023-02-28 20:08:40 +01:00 committed by Kilton937342
parent 75cc30ccc8
commit 229f2097fd
8 changed files with 110 additions and 82 deletions

View File

@ -15,6 +15,11 @@
</script>
<svelte:head>
<title>Générateur d'exercices</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="/favicon.png">
</svelte:head>
<Notification>
<Navigation>

View File

@ -32,7 +32,9 @@
$: !$initialLoading && !$isAuth && goto("/");
</script>
<svelte:head>
<title>Profil - {$user != null ? $user.username: ""}</title>
</svelte:head>
<div>
{#if $user != null}
<h1>Mon compte</h1>

View File

@ -3,5 +3,7 @@
/** @type {import('./$types').PageData} */
</script>
<svelte:head>
<title>Exercices</title>
</svelte:head>
<Feed />

View File

@ -11,7 +11,9 @@
<button class="primary-btn" on:click={()=>{goto('/room/create')}}>Créer</button>
</div>
</div>
<svelte:head>
<title>Rejoindre</title>
</svelte:head>
<style lang="scss">
h1{
font-size: 4rem;

View File

@ -463,6 +463,10 @@
</script>
<svelte:head>
<title>{$room != null ? $room.name: "Salle - Chargement"}</title>
</svelte:head>
<div class="container">
<div class="full" class:fade>
{#if $page.url.searchParams.get('a') == "waiting"}

View File

@ -48,7 +48,9 @@
</button>
</form>
</div>
<svelte:head>
<title>Créer une salle</title>
</svelte:head>
<style lang="scss">
h1 {
font-size: 3em;

View File

@ -13,7 +13,9 @@
}
let loading = false
</script>
<svelte:head>
<title>Se connecter</title>
</svelte:head>
<div class="parent">
<div>
<h1>Se connecter</h1>

View File

@ -1,68 +1,74 @@
<script lang="ts">
import InputWithLabel from '../../components/forms/InputWithLabel.svelte';
import { form, field } from 'svelte-forms';
import { getContext, onMount } from 'svelte';
import { required, max, min, matchField, pattern } from 'svelte-forms/validators';
import { errorMsg } from '../../utils/forms';
import { writable } from 'svelte/store';
import { goto } from '$app/navigation';
let errors = {
password_error: null,
username_error: null,
confirm_error: null
};
const { register, isAuth, initialLoading } = getContext('auth');
const username = field('username', '', [required(), max(20)]);
const password = field('password', '', [required(), min(8), pattern(/[0-9]/), pattern(/[A-Z]/)]);
const confirm = field('confirm', '', [required(), matchField(password)]);
const myForm = form(username, password, confirm);
import InputWithLabel from "../../components/forms/InputWithLabel.svelte";
import { form, field } from "svelte-forms";
import { getContext, onMount } from "svelte";
import { required, max, min, matchField, pattern } from "svelte-forms/validators";
import { errorMsg } from "../../utils/forms";
import { writable } from "svelte/store";
import { goto } from "$app/navigation";
$: !$initialLoading && !!$isAuth && goto('/dashboard');
let loading = false
let errors = {
password_error: null,
username_error: null,
confirm_error: null
};
const { register, isAuth, initialLoading } = getContext("auth");
const username = field("username", "", [required(), max(20)]);
const password = field("password", "", [required(), min(8), pattern(/[0-9]/), pattern(/[A-Z]/)]);
const confirm = field("confirm", "", [required(), matchField(password)]);
const myForm = form(username, password, confirm);
$: !$initialLoading && !!$isAuth && goto("/dashboard");
let loading = false;
</script>
<svelte:head>
<title>S'inscrire</title>
</svelte:head>
<div class="parent">
<div>
<h1>S'inscrire</h1>
<InputWithLabel
change={(e) => {
<div>
<h1>S'inscrire</h1>
<InputWithLabel
change={(e) => {
errors.username_error = null;
}}
type="text"
bind:value={$username.value}
label="Nom d'utilisateur"
errors={[
type="text"
bind:value={$username.value}
label="Nom d'utilisateur"
errors={[
...errorMsg($myForm, 'username'),
...(errors.username_error != null ? [errors.username_error] : [])
]}
/>
<InputWithLabel
change={(e) => {
/>
<InputWithLabel
change={(e) => {
errors.password_error = null;
}}
type="password"
bind:value={$password.value}
label="Mot de passe"
errors={[
type="password"
bind:value={$password.value}
label="Mot de passe"
errors={[
...errorMsg($myForm, 'password'),
...(errors.password_error != null ? [errors.password_error] : [])
]}
/>
<InputWithLabel
type="password"
change={(e) => {
/>
<InputWithLabel
type="password"
change={(e) => {
errors.confirm_error = null;
}}
bind:value={$confirm.value}
label="Confirmation"
errors={[
bind:value={$confirm.value}
label="Confirmation"
errors={[
...errorMsg($myForm, 'confirm'),
...(errors.confirm_error != null ? [errors.confirm_error] : [])
]}
/>
<button
class="primary-btn"
on:click={() => {
/>
<button
class="primary-btn"
on:click={() => {
loading = true
register($username.value, $password.value, $confirm.value).then(()=>{loading=false}).catch((r) => {
loading = false
@ -71,39 +77,42 @@
errors = { ...errors, ...r.data.detail };
});
}}
disabled={!$myForm.valid}
>
<!-- loading et span.spinner else text-->
{#if loading}
<span class="spinner"></span>
{:else}
S'inscrire
{/if}
</button>
</div>
disabled={!$myForm.valid}
>
<!-- loading et span.spinner else text-->
{#if loading}
<span class="spinner"></span>
{:else}
S'inscrire
{/if}
</button>
</div>
</div>
<style lang="scss">
h1 {
font-size: 4em;
}
.parent {
width: 100%;
display: flex;
justify-content: center;
margin-top: 50px;
div {
display: flex;
flex-direction: column;
align-items: center;
gap: 20px;
width: min(100%, 666px);
padding: 7px 20px;
}
}
.spinner{
width: 15px;
height: 15px;
border-width: 2px!important;
}
h1 {
font-size: 4em;
}
.parent {
width: 100%;
display: flex;
justify-content: center;
margin-top: 50px;
div {
display: flex;
flex-direction: column;
align-items: center;
gap: 20px;
width: min(100%, 666px);
padding: 7px 20px;
}
}
.spinner {
width: 15px;
height: 15px;
border-width: 2px !important;
}
</style>