2023-12-10 01:48:53 +01:00
|
|
|
<!--
|
|
|
|
- This file is a part of the SteamWar software.
|
|
|
|
-
|
|
|
|
- Copyright (C) 2023 SteamWar.de-Serverteam
|
|
|
|
-
|
|
|
|
- This program is free software: you can redistribute it and/or modify
|
|
|
|
- it under the terms of the GNU Affero General Public License as published by
|
|
|
|
- the Free Software Foundation, either version 3 of the License, or
|
|
|
|
- (at your option) any later version.
|
|
|
|
-
|
|
|
|
- This program is distributed in the hope that it will be useful,
|
|
|
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
- GNU Affero General Public License for more details.
|
|
|
|
-
|
|
|
|
- You should have received a copy of the GNU Affero General Public License
|
|
|
|
- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
-->
|
|
|
|
|
2023-11-12 22:43:42 +01:00
|
|
|
<script lang="ts">
|
|
|
|
import {createEventDispatcher} from "svelte";
|
|
|
|
import {Modal, Spinner} from "flowbite-svelte";
|
|
|
|
import SchematicInfoModal from "./SchematicInfoModal.svelte";
|
2023-12-25 21:54:40 +01:00
|
|
|
import type {Player} from "@type/data.ts";
|
2023-12-27 19:16:54 +01:00
|
|
|
import {schemRepo} from "@repo/schem.ts";
|
2023-11-12 22:43:42 +01:00
|
|
|
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
|
|
|
|
export let schematicId: number;
|
2023-12-05 17:55:48 +01:00
|
|
|
export let user: Player;
|
2023-11-12 22:43:42 +01:00
|
|
|
|
|
|
|
let schemInfo = getSchematicInfo(schematicId);
|
|
|
|
|
|
|
|
function getSchematicInfo(id: number) {
|
|
|
|
return $schemRepo.getSchematicInfo(id);
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
{#await schemInfo}
|
|
|
|
<Modal title="Loading" open on:close={() => dispatch("reset")}>
|
|
|
|
<Spinner />
|
|
|
|
</Modal>
|
|
|
|
{:then info}
|
2023-12-05 17:55:48 +01:00
|
|
|
<SchematicInfoModal {user} {info} on:reset />
|
2023-11-12 22:43:42 +01:00
|
|
|
{:catch e}
|
|
|
|
<Modal title="Error" open on:close={() => dispatch("reset")}>
|
|
|
|
<p>{e.message}</p>
|
|
|
|
<button class="btn !ml-auto" slot="footer" on:click={() => dispatch("reset")}>Close</button>
|
|
|
|
</Modal>
|
|
|
|
{/await}
|