2026-10-31 10:07:33 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import type { TradeReport, VillageRef } from '~/types/game'
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{ report: TradeReport; worldId: number }>()
|
|
|
|
|
const mapLink = (v: VillageRef) => ({ path: `/map/${props.worldId}`, query: { x: v.x, y: v.y } })
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<!-- A delivery: from where to where, as part of an offer or not, and the cargo per resource. -->
|
|
|
|
|
<template>
|
|
|
|
|
<div class="space-y-3 text-sm">
|
|
|
|
|
<p>{{ $t(report.offer ? 'reports.trade.arrived_offer' : 'reports.trade.arrived', { to: villageLabel(report.to) }) }}</p>
|
|
|
|
|
<table class="grid-table w-auto">
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr v-for="side in (['from', 'to'] as const)" :key="side">
|
|
|
|
|
<th class="w-28">{{ $t(`reports.trade.${side}`) }}</th>
|
|
|
|
|
<td>
|
|
|
|
|
<NuxtLink :to="mapLink(report[side])" class="font-semibold hover:underline">{{ villageLabel(report[side]) }}</NuxtLink>
|
2026-10-31 10:15:54 +00:00
|
|
|
<span class="ml-1 text-ink-500">{{ report[side].player?.name ?? $t('common.barbarian') }}</span>
|
2026-10-31 10:07:33 +00:00
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>{{ $t('reports.trade.cargo') }}</th>
|
|
|
|
|
<td>
|
|
|
|
|
<span class="flex flex-wrap gap-x-4 gap-y-0.5 tabular-nums">
|
|
|
|
|
<span v-for="r in (['wood', 'clay', 'iron'] as const)" :key="r" class="inline-flex items-center gap-1" :title="$t(`resources.${r}`)">
|
|
|
|
|
<IconResource :resource="r" class="size-4" />{{ report.cargo[r] }}
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|