2023-03-21 18:29:44 +00:00
|
|
|
<div class="identification-row">
|
|
|
|
<div>
|
|
|
|
<Field label="ship class" bind:value={shipClass} />
|
2023-04-20 13:58:52 +00:00
|
|
|
<Field suffix>
|
2023-03-21 18:29:44 +00:00
|
|
|
<select bind:value={shipType}>
|
|
|
|
{#each shipTypes as name (name)}
|
|
|
|
<option>{name}</option>
|
|
|
|
{/each}
|
|
|
|
</select>
|
2023-04-20 13:58:52 +00:00
|
|
|
<label class="active">ship type</label>
|
|
|
|
<i>arrow_drop_down</i>
|
2023-03-21 18:29:44 +00:00
|
|
|
</Field>
|
2023-04-21 17:12:37 +00:00
|
|
|
<label class="switch icon">
|
|
|
|
<div>carrier</div>
|
|
|
|
<input type="checkbox" bind:checked={isCarrier} />
|
|
|
|
<span>
|
|
|
|
<i>airplanemode_inactive</i>
|
|
|
|
<i>airplanemode_active</i>
|
|
|
|
</span>
|
|
|
|
</label>
|
2023-03-21 18:29:44 +00:00
|
|
|
</div>
|
|
|
|
<ShipCost {...reqs} />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { getContext } from "svelte";
|
|
|
|
|
|
|
|
import Field from "$lib/components/Field.svelte";
|
|
|
|
import { candidateShipTypes } from "./Identification/shipTypes.js";
|
|
|
|
import ShipCost from "./Identification/ShipCost.svelte";
|
|
|
|
|
|
|
|
export let shipClass = "";
|
|
|
|
export let shipType = "";
|
|
|
|
export let isCarrier = false;
|
|
|
|
export let reqs = {};
|
|
|
|
|
2023-04-22 14:37:49 +00:00
|
|
|
$: console.log("in the comp", isCarrier, shipClass);
|
|
|
|
|
2023-03-21 18:29:44 +00:00
|
|
|
export let api = getContext("api");
|
|
|
|
|
|
|
|
$: shipTypes = candidateShipTypes(reqs.mass, isCarrier).map(
|
|
|
|
({ name }) => name
|
|
|
|
);
|
|
|
|
|
|
|
|
$: if (shipTypes.length > 0 && !shipTypes.includes(shipType))
|
|
|
|
shipType = shipTypes[0];
|
|
|
|
|
2023-03-21 19:42:45 +00:00
|
|
|
$: api?.dispatch?.updateIdentification?.({ shipType, shipClass });
|
2023-04-21 17:12:37 +00:00
|
|
|
|
|
|
|
$: api?.dispatch.setCarrier?.(isCarrier);
|
2023-03-21 18:29:44 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
div {
|
|
|
|
display: flex;
|
|
|
|
align-items: end;
|
|
|
|
gap: 2em;
|
|
|
|
}
|
|
|
|
.identification-row {
|
|
|
|
display: flex;
|
|
|
|
align-items: start;
|
|
|
|
}
|
2023-04-21 17:12:37 +00:00
|
|
|
select {
|
|
|
|
min-width: 10em;
|
|
|
|
}
|
2023-03-21 18:29:44 +00:00
|
|
|
|
|
|
|
.identification-row :global(> *:first-child) {
|
|
|
|
flex: 1;
|
|
|
|
}
|
2023-04-21 17:12:37 +00:00
|
|
|
label div {
|
|
|
|
font-size: var(--font-scale-10);
|
|
|
|
margin-right: 1em;
|
|
|
|
}
|
|
|
|
label.switch {
|
|
|
|
margin-left: 2em;
|
|
|
|
}
|
2023-03-21 18:29:44 +00:00
|
|
|
</style>
|