Finish MVP
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
{#await schematicFetch}
|
||||
<p>{t("status.loading")}</p>
|
||||
{:then schematics}
|
||||
<SchematicList {schematics} on:reset={() => schematicFetch = getSchematics()} on:to={(e) => schematicFetch = getSchematic(e.detail.id) } />
|
||||
<SchematicList {schematics} {user} on:reset={() => schematicFetch = getSchematics()} on:to={(e) => schematicFetch = getSchematic(e.detail.id) } />
|
||||
{:catch error}
|
||||
<p>error: {error.message}</p>
|
||||
{/await}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import {statsRepo} from "./repo/repo.ts";
|
||||
import {t} from "astro-i18n";
|
||||
|
||||
export let gamemode: string;
|
||||
|
||||
@@ -16,9 +17,9 @@
|
||||
<div>
|
||||
<table>
|
||||
<tr class="font-bold">
|
||||
<td>Platz</td>
|
||||
<td>Spieler</td>
|
||||
<td>Elo</td>
|
||||
<td>{t("elo.place")}</td>
|
||||
<td>{t("elo.name")}</td>
|
||||
<td>{t("elo.elo")}</td>
|
||||
</tr>
|
||||
{#each data as player, i}
|
||||
<tr>
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
import moment from "moment/moment";
|
||||
import {CheckSolid, XCircleOutline} from "flowbite-svelte-icons";
|
||||
import SchematicInfoModal from "./SchematicInfoModal.svelte";
|
||||
import type {Player} from "../types/data.ts";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
export let schematicId: number;
|
||||
export let user: Player;
|
||||
|
||||
let schemInfo = getSchematicInfo(schematicId);
|
||||
|
||||
@@ -24,7 +26,7 @@
|
||||
<Spinner />
|
||||
</Modal>
|
||||
{:then info}
|
||||
<SchematicInfoModal {info} on:reset />
|
||||
<SchematicInfoModal {user} {info} on:reset />
|
||||
{:catch e}
|
||||
<Modal title="Error" open on:close={() => dispatch("reset")}>
|
||||
<p>{e.message}</p>
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
import type {SchematicInfo} from "../types/schem.ts";
|
||||
import {createEventDispatcher} from "svelte";
|
||||
import {schemRepo} from "../repo/repo.ts";
|
||||
import type {Player} from "../types/data.ts";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
export let info: SchematicInfo;
|
||||
export let user: Player;
|
||||
|
||||
async function download() {
|
||||
const code = await $schemRepo.createDownload(info.schem.id);
|
||||
@@ -50,7 +52,9 @@
|
||||
<p class="!mt-0">{t("dashboard.schematic.info.members", {members: info.members.join(", ")})}</p>
|
||||
{/if}
|
||||
<svelte:fragment slot="footer">
|
||||
<button class="btn !ml-auto" on:click={download}>{t("dashboard.schematic.info.btn.download")}</button>
|
||||
{#if (info.schem.owner === user.id)}
|
||||
<button class="btn !ml-auto" on:click={download}>{t("dashboard.schematic.info.btn.download")}</button>
|
||||
{/if}
|
||||
<button class="btn" on:click={() => dispatch("reset")}>{t("dashboard.schematic.info.btn.close")}</button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
@@ -7,10 +7,12 @@
|
||||
import type {SchematicList} from "../types/schem.ts";
|
||||
import SchematicInfo from "./SchematicInfo.svelte";
|
||||
import UploadModal from "./UploadModal.svelte";
|
||||
import type {Player} from "../types/data.ts";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
export let schematics: SchematicList;
|
||||
export let user: Player;
|
||||
|
||||
let uploadOpen = false;
|
||||
let infoModalId: number | null = null;
|
||||
@@ -96,7 +98,7 @@
|
||||
<UploadModal bind:open={uploadOpen} on:refresh />
|
||||
|
||||
{#if infoModalId !== null}
|
||||
<SchematicInfo schematicId={infoModalId} on:reset={() => infoModalId = null} />
|
||||
<SchematicInfo schematicId={infoModalId} {user} on:reset={() => infoModalId = null} />
|
||||
{/if}
|
||||
|
||||
<style lang="postcss">
|
||||
|
||||
Reference in New Issue
Block a user