From b3b1e460bb4c1e39f88d717b88399007c293d519 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 25 Jul 2023 14:25:58 +0200 Subject: [PATCH] Fix WideScreens --- src/pages/event/FightCard.svelte | 11 ++++++----- src/stores/stores.ts | 5 ++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pages/event/FightCard.svelte b/src/pages/event/FightCard.svelte index 79e7cae..35cb18e 100644 --- a/src/pages/event/FightCard.svelte +++ b/src/pages/event/FightCard.svelte @@ -3,8 +3,9 @@ import {Button, Checkbox, Modal, Toolbar, ToolbarButton} from "flowbite-svelte"; import type {EventFight, ExtendedEvent} from "../../types/event.js"; import FightEditModal from "./modals/FightEditModal.svelte"; - import {createEventDispatcher} from "svelte"; + import {createEventDispatcher, onMount} from "svelte"; import {fightRepo} from "../../repo/repo.js"; + import {isWide} from "../../stores/stores.js"; export let fight: EventFight; export let data: ExtendedEvent; @@ -37,16 +38,16 @@
- {fight.blueTeam.name} + {$isWide ? fight.blueTeam.name : fight.blueTeam.kuerzel} vs. - {fight.redTeam.name} + {$isWide ? fight.redTeam.name : fight.redTeam.kuerzel}
{#if (fight.ergebnis === 3)} Unentschieden {:else if (fight.ergebnis !== 0)} - {fight.ergebnis === 1 ? 'Sieger: ' + fight.blueTeam.name : 'Sieger: ' + fight.redTeam.name} + {fight.ergebnis === 1 ? 'Sieger: ' + ($isWide ? fight.blueTeam.name : fight.blueTeam.kuerzel) : 'Sieger: ' + ($isWide ? fight.redTeam.name : fight.redTeam.kuerzel)} {:else} - Noch nicht gespielt + {$isWide ? 'Noch nicht gespielt' : 'kommend'} {/if}
diff --git a/src/stores/stores.ts b/src/stores/stores.ts index 4d42809..58c35d1 100644 --- a/src/stores/stores.ts +++ b/src/stores/stores.ts @@ -1,7 +1,7 @@ import type {Player, SchematicType} from "../types/data.js"; import {cached, cachedFamily} from "./cached.js"; import type {Team} from "../types/team.js"; -import {get} from "svelte/store"; +import {get, writable} from "svelte/store"; import {tokenStore} from "../repo/repo.js"; export const schemTypes = cached([], () => { @@ -39,3 +39,6 @@ export const teams = cached([], () => { return fetch("https://steamwar.de/eventplanner-api/team", {headers: {"X-SW-Auth": get(tokenStore)}}) .then(res => res.json()) }) + +export const isWide = writable(window.innerWidth >= 640); +window.addEventListener("resize", () => isWide.set(window.innerWidth >= 640));