Add Updated Toast
Dieser Commit ist enthalten in:
Ursprung
8fac3b8165
Commit
47b70598a3
@ -1,12 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type {ExtendedEvent} from "../../types/event.js";
|
import type {ExtendedEvent} from "../../types/event.js";
|
||||||
import {Button, Heading, Input, Label, Modal, Range, Select, Toggle} from "flowbite-svelte";
|
import {Button, Heading, Input, Label, Modal, Range, Select, Toast, Toggle} from "flowbite-svelte";
|
||||||
import {schemTypes} from "../../stores/stores.js";
|
import {schemTypes} from "../../stores/stores.js";
|
||||||
import moment from "moment/moment.js";
|
import moment from "moment/moment.js";
|
||||||
import type {UpdateEvent} from "../../repo/event.js";
|
import type {UpdateEvent} from "../../repo/event.js";
|
||||||
import {eventRepo} from "../../repo/repo.js";
|
import {eventRepo} from "../../repo/repo.js";
|
||||||
import ErrorModal from "../../components/ErrorModal.svelte";
|
import ErrorModal from "../../components/ErrorModal.svelte";
|
||||||
import {replace} from "svelte-spa-router";
|
import {replace} from "svelte-spa-router";
|
||||||
|
import {CheckCircleOutline} from "flowbite-svelte-icons";
|
||||||
|
|
||||||
export let data: ExtendedEvent;
|
export let data: ExtendedEvent;
|
||||||
let event = data.event;
|
let event = data.event;
|
||||||
@ -55,6 +56,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let successToast: boolean = false;
|
||||||
|
|
||||||
async function update() {
|
async function update() {
|
||||||
let ev: UpdateEvent = {
|
let ev: UpdateEvent = {
|
||||||
deadline: deadlineDate,
|
deadline: deadlineDate,
|
||||||
@ -69,6 +72,8 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
event = await $eventRepo.updateEvent(event.id.toString(), ev);
|
event = await $eventRepo.updateEvent(event.id.toString(), ev);
|
||||||
|
successToast = true;
|
||||||
|
setTimeout(() => successToast = false, 5000);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e;
|
error = e;
|
||||||
errorOpen = true;
|
errorOpen = true;
|
||||||
@ -128,3 +133,8 @@
|
|||||||
<Button class="ml-4" color="red" on:click={del}>Delete</Button>
|
<Button class="ml-4" color="red" on:click={del}>Delete</Button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
<Toast bind:open={successToast} position="bottom-left" color="green">
|
||||||
|
<CheckCircleOutline slot="icon"/>
|
||||||
|
Updated Successfully
|
||||||
|
</Toast>
|
||||||
|
@ -135,7 +135,7 @@
|
|||||||
|
|
||||||
$: minTime = moment(Math.min(...fights.map(fight => fight.start))).utc(true);
|
$: minTime = moment(Math.min(...fights.map(fight => fight.start))).utc(true);
|
||||||
let changeTimeOpen = false;
|
let changeTimeOpen = false;
|
||||||
let changedTime = moment(Math.min(...fights.map(fight => fight.start)))?.utc(true).toISOString().slice(0, -1);
|
let changedTime = moment(Math.min(...fights.map(fight => fight.start)))?.utc(true)?.toISOString()?.slice(0, -1);
|
||||||
|
|
||||||
$: deltaTime = moment.duration(moment(changedTime).utc(true).diff(minTime))
|
$: deltaTime = moment.duration(moment(changedTime).utc(true).diff(minTime))
|
||||||
|
|
||||||
|
@ -112,7 +112,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$: groupsFights = generateGroups(groups)
|
$: groupsFights = generateGroups(groups)
|
||||||
$: console.log(groupsFights)
|
|
||||||
|
|
||||||
$: generateDisabled = groupsFights.length > 0 && groupsFights.every(value => value.every(value1 => value1.length > 0)) && gamemode !== '' && map !== ''
|
$: generateDisabled = groupsFights.length > 0 && groupsFights.every(value => value.every(value1 => value1.length > 0)) && gamemode !== '' && map !== ''
|
||||||
|
|
||||||
|
@ -19,15 +19,15 @@ export const gamemodes = cached<string[]>([], () => {
|
|||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
})
|
})
|
||||||
|
|
||||||
export const maps = cachedFamily<string, string[]>([], (gamemode) => {
|
export const maps = cachedFamily<string, string[]>([], async (gamemode) => {
|
||||||
return fetch(`https://steamwar.de/eventplanner-api/data/gamemodes/${gamemode}/maps`, {headers: {"X-SW-Auth": get(tokenStore)}})
|
if (get(gamemodes).every(value => value !== gamemode)) return [];
|
||||||
.then(res => {
|
|
||||||
if(!res.ok) {
|
const res = await fetch(`https://steamwar.de/eventplanner-api/data/gamemodes/${gamemode}/maps`, {headers: {"X-SW-Auth": get(tokenStore)}});
|
||||||
|
if (!res.ok) {
|
||||||
return [];
|
return [];
|
||||||
} else {
|
} else {
|
||||||
return res.json();
|
return res.json();
|
||||||
}
|
}
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export const groups = cached<string[]>([], () => {
|
export const groups = cached<string[]>([], () => {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren