2020-07-28 18:03:59 +00:00
|
|
|
<div>
|
2022-03-01 17:42:33 +00:00
|
|
|
<Field
|
|
|
|
label="ship class"
|
|
|
|
value={general.ship_class}
|
|
|
|
on:change={change_class}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Field label="ship type">
|
|
|
|
<select value={ship_type} on:change={change_ship_type}>
|
2020-07-19 20:21:28 +00:00
|
|
|
{#each ship_types as type (type)}
|
|
|
|
<option>{type}</option>
|
2022-03-01 17:42:33 +00:00
|
|
|
{/each}
|
|
|
|
</select>
|
|
|
|
</Field>
|
2020-07-19 20:21:28 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
2022-03-01 17:42:33 +00:00
|
|
|
import { getContext } from "svelte";
|
2020-07-19 20:21:28 +00:00
|
|
|
|
2022-03-01 17:42:33 +00:00
|
|
|
import Field from "$lib/components/Field/index.svelte";
|
|
|
|
import { candidate_ship_types } from "../../dux/ship_types";
|
2020-07-19 20:21:28 +00:00
|
|
|
|
2022-03-01 17:42:33 +00:00
|
|
|
export let ship = getContext("ship");
|
2020-07-19 20:21:28 +00:00
|
|
|
let general;
|
|
|
|
$: general = $ship.general;
|
|
|
|
|
2022-03-01 17:42:33 +00:00
|
|
|
const change_class = (event) =>
|
|
|
|
ship.dispatch(ship.actions.set_ship_class(event.target.value));
|
2020-07-19 20:21:28 +00:00
|
|
|
|
|
|
|
let ship_type;
|
|
|
|
$: ship_type = $ship.general.ship_type;
|
|
|
|
|
2022-03-01 17:42:33 +00:00
|
|
|
const change_ship_type = ({ target: { value } }) =>
|
|
|
|
ship.dispatch.set_ship_type(value);
|
2020-07-19 20:21:28 +00:00
|
|
|
|
|
|
|
let ship_types;
|
2022-03-01 17:42:33 +00:00
|
|
|
$: ship_types = candidate_ship_types(
|
|
|
|
$ship.general.mass,
|
|
|
|
$ship.carrier.bays > 0
|
|
|
|
).map(({ name }) => name);
|
2020-07-19 20:21:28 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2020-07-28 18:03:59 +00:00
|
|
|
div {
|
2020-07-19 20:21:28 +00:00
|
|
|
display: flex;
|
2020-07-28 18:03:59 +00:00
|
|
|
align-items: end;
|
|
|
|
gap: 2em;
|
|
|
|
}
|
2020-07-19 20:21:28 +00:00
|
|
|
</style>
|