Dieser Commit ist enthalten in:
Ursprung
926624542d
Commit
0a0946e335
@ -24,19 +24,12 @@
|
|||||||
import {createEventDispatcher} from "svelte";
|
import {createEventDispatcher} from "svelte";
|
||||||
import type {Player} from "@type/data.ts";
|
import type {Player} from "@type/data.ts";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import {schemRepo} from "@repo/schem.ts";
|
|
||||||
import SWModal from "@components/styled/SWModal.svelte";
|
import SWModal from "@components/styled/SWModal.svelte";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
export let info: SchematicInfo;
|
export let info: SchematicInfo;
|
||||||
export let user: Player;
|
export let user: Player;
|
||||||
|
|
||||||
async function download() {
|
|
||||||
const code = await $schemRepo.createDownload(info.schem.id);
|
|
||||||
window.open(import.meta.env.PUBLIC_API_SERVER + "/download/" + code.code, "_blank")
|
|
||||||
dispatch("reset")
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<SWModal title={info.schem.name} open on:close={() => dispatch("reset")}>
|
<SWModal title={info.schem.name} open on:close={() => dispatch("reset")}>
|
||||||
@ -71,9 +64,6 @@
|
|||||||
<p class="!mt-0">{t("dashboard.schematic.info.members", {members: info.members.map(value => value.name).join(", ")})}</p>
|
<p class="!mt-0">{t("dashboard.schematic.info.members", {members: info.members.map(value => value.name).join(", ")})}</p>
|
||||||
{/if}
|
{/if}
|
||||||
<svelte:fragment slot="footer">
|
<svelte:fragment slot="footer">
|
||||||
{#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" class:!ml-auto={info.schem.owner !== user.id} on:click={() => dispatch("reset")}>{t("dashboard.schematic.info.btn.close")}</button>
|
<button class="btn" class:!ml-auto={info.schem.owner !== user.id} on:click={() => dispatch("reset")}>{t("dashboard.schematic.info.btn.close")}</button>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SWModal>
|
</SWModal>
|
@ -37,10 +37,6 @@ export class SchematicRepo {
|
|||||||
return await fetchWithToken(this.token, `/schem/${id}`).then(value => value.json()).then(SchematicInfoSchema.parse);
|
return await fetchWithToken(this.token, `/schem/${id}`).then(value => value.json()).then(SchematicInfoSchema.parse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createDownload(id: number): Promise<SchematicCode> {
|
|
||||||
return await fetchWithToken(this.token, `/schem/${id}/download`).then(value => value.json()).then(SchematicCodeSchema.parse);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async uploadSchematic(name: string, content: string) {
|
public async uploadSchematic(name: string, content: string) {
|
||||||
return await fetchWithToken(this.token, "/schem", {
|
return await fetchWithToken(this.token, "/schem", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
build:
|
build:
|
||||||
- "echo 'PUBLIC_API_SERVER=https://steamwar.de/eventplanner-api/'"
|
- "echo 'PUBLIC_API_SERVER=https://steamwar.de/api/'"
|
||||||
- "pnpm run ci"
|
- "pnpm run ci"
|
||||||
|
|
||||||
release:
|
release:
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren