game-village-politics-frontend/app/pages/village/[id]/rally.vue

44 lines
1.4 KiB
Vue

<script setup lang="ts">
const route = useRoute()
const v = useVillageContext()
const village = computed(() => v.village.value!)
/** `?x=&y=` from the map fills in the target. */
const initialTarget = computed(() => (route.query.x && route.query.y ? { x: Number(route.query.x), y: Number(route.query.y) } : null))
</script>
<!-- The rally point: send troops, the troop movements, and support. -->
<template>
<div class="grid gap-6 px-4 py-6 sm:px-6 lg:grid-cols-[minmax(0,1fr)_22rem] 2xl:grid-cols-[minmax(0,1fr)_26rem]">
<div class="min-w-0 space-y-6">
<VillageSendTroops
:key="`${route.query.x}|${route.query.y}`"
:village="village"
:busy="v.busy.value"
:initial-target="initialTarget"
:now="v.now.value"
:preview="v.preview"
:send="v.send"
/>
<VillageMovements
:movements="village.movements"
:world-id="village.world_id"
:now="v.now.value"
:seconds-until="v.secondsUntil"
:busy="v.busy.value"
@cancel="v.cancelMovement"
/>
<VillageSimulator :world-id="village.world_id" :troops="village.troops" />
</div>
<VillageSupportPanel
class="self-start"
:here="village.support.here"
:away="village.support.away"
:world-id="village.world_id"
:busy="v.busy.value"
@send-home="v.sendHome"
@withdraw="v.withdraw"
/>
</div>
</template>