<script lang="ts">
    import units from "../data/units";
    import village from "../village";

    $: currentUnits = Object.entries($village.units).map(([type, count]) => {
        const unit = units.find(u => u.type === type);
        return {
            ...unit,
            count,
        };
    });
</script>

<section>
    { #each currentUnits as unit }
    <p>{ unit.name }: { unit.count }</p>
    { /each }
</section>
