2026-10-28 16:57:44 +00:00
|
|
|
|
<script setup lang="ts">
|
2026-10-28 20:18:57 +00:00
|
|
|
|
import type { BuildOption, Building, BuildingType, Cost, Offer, Resources } from '~/types/game'
|
2026-10-28 16:57:44 +00:00
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
|
options: BuildOption[]
|
2026-10-28 20:01:23 +00:00
|
|
|
|
buildings: Building[]
|
2026-10-28 18:54:29 +00:00
|
|
|
|
space: { used: number; max: number }
|
2026-10-28 18:04:21 +00:00
|
|
|
|
resources: Resources
|
2026-10-28 16:57:44 +00:00
|
|
|
|
canAfford: (cost: Cost) => boolean
|
|
|
|
|
|
busy: boolean
|
2026-11-03 08:56:40 +00:00
|
|
|
|
/** Villagers free for a new level (`population.idle`): a villager count above it shows red. */
|
|
|
|
|
|
idle: number
|
2026-10-29 09:15:36 +00:00
|
|
|
|
/** A building type a quest points at: its rows are marked and scrolled into view. */
|
|
|
|
|
|
hint?: string | null
|
2026-10-28 16:57:44 +00:00
|
|
|
|
}>()
|
2026-10-28 20:18:57 +00:00
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
|
build: [type: BuildingType]
|
|
|
|
|
|
upgrade: [buildingId: number]
|
|
|
|
|
|
demolish: [buildingId: number]
|
|
|
|
|
|
select: [buildingId: number]
|
|
|
|
|
|
}>()
|
2026-10-28 16:57:44 +00:00
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
|
2026-10-28 20:18:57 +00:00
|
|
|
|
// Like the Die Stämme headquarters: one table where every building upgrades in its own
|
|
|
|
|
|
// row, and building one more of a type is the row below its instances. Demolition is
|
|
|
|
|
|
// the second tab; types still waiting for requirements are listed at the bottom.
|
|
|
|
|
|
const tab = ref<'construct' | 'demolish'>('construct')
|
|
|
|
|
|
|
2026-11-03 08:56:40 +00:00
|
|
|
|
/** Instances per type in the server's rank: the one that works in full first, then the copies. */
|
2026-10-28 20:18:57 +00:00
|
|
|
|
const byType = computed(() => {
|
|
|
|
|
|
const map = new Map<BuildingType, Building[]>()
|
|
|
|
|
|
for (const b of props.buildings) map.set(b.type, [...(map.get(b.type) ?? []), b])
|
2026-11-03 08:56:40 +00:00
|
|
|
|
for (const [type, list] of map) map.set(type, ranked(list))
|
2026-10-28 20:18:57 +00:00
|
|
|
|
return map
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-11-03 08:56:40 +00:00
|
|
|
|
// Rows of one type form a group. With two or more instances the group opens with a header
|
|
|
|
|
|
// (portrait, name, count) and the instances follow as sub-rows; building one more is the
|
|
|
|
|
|
// group's last sub-row. A type with one instance or none stays a single row.
|
|
|
|
|
|
type Row = { group: number; first: boolean; sub: boolean } & (
|
|
|
|
|
|
| { kind: 'head'; key: string; type: BuildingType; count: number }
|
|
|
|
|
|
| { kind: 'upgrade'; key: string; type: BuildingType; building: Building; offer: Offer | null; rank: number }
|
|
|
|
|
|
| { kind: 'build'; key: string; type: BuildingType; option: BuildOption; another: boolean }
|
2026-10-30 10:03:15 +00:00
|
|
|
|
)
|
2026-10-28 20:01:23 +00:00
|
|
|
|
|
2026-10-28 20:18:57 +00:00
|
|
|
|
const rows = computed<Row[]>(() => {
|
|
|
|
|
|
const out: Row[] = []
|
2026-10-30 10:03:15 +00:00
|
|
|
|
let group = 0
|
2026-10-28 20:18:57 +00:00
|
|
|
|
for (const o of props.options) {
|
|
|
|
|
|
if (o.blocked === 'requires') continue
|
|
|
|
|
|
const instances = byType.value.get(o.type) ?? []
|
2026-11-03 08:56:40 +00:00
|
|
|
|
const grouped = instances.length > 1
|
2026-10-30 10:03:15 +00:00
|
|
|
|
const start = out.length
|
|
|
|
|
|
group++
|
2026-11-03 08:56:40 +00:00
|
|
|
|
if (grouped) out.push({ group, first: false, sub: false, kind: 'head', key: `head-${o.type}`, type: o.type, count: instances.length })
|
|
|
|
|
|
instances.forEach((b, rank) => {
|
|
|
|
|
|
out.push({ group, first: false, sub: grouped, kind: 'upgrade', key: `b${b.id}`, type: b.type, building: b, offer: b.upgrade, rank })
|
2026-10-28 20:18:57 +00:00
|
|
|
|
})
|
|
|
|
|
|
// A unique type that already stands has nothing more to build.
|
2026-11-03 08:56:40 +00:00
|
|
|
|
if (!(o.blocked === 'max_per_village' && instances.length)) {
|
|
|
|
|
|
out.push({ group, first: false, sub: instances.length > 0, kind: 'build', key: `new-${o.type}`, type: o.type, option: o, another: instances.length > 0 })
|
|
|
|
|
|
}
|
2026-10-30 10:03:15 +00:00
|
|
|
|
if (out[start]) out[start]!.first = true
|
2026-10-28 20:18:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
return out
|
2026-10-28 20:01:23 +00:00
|
|
|
|
})
|
|
|
|
|
|
|
2026-10-29 09:15:36 +00:00
|
|
|
|
// A quest's "show me" lands here: bring the first marked row into view.
|
|
|
|
|
|
const root = ref<HTMLElement | null>(null)
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => props.hint,
|
|
|
|
|
|
async (hint) => {
|
|
|
|
|
|
if (!hint) return
|
|
|
|
|
|
tab.value = 'construct'
|
|
|
|
|
|
await nextTick()
|
|
|
|
|
|
root.value?.querySelector('[data-hint]')?.scrollIntoView({ block: 'center' })
|
|
|
|
|
|
},
|
|
|
|
|
|
{ immediate: true },
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-10-28 20:18:57 +00:00
|
|
|
|
const locked = computed(() => props.options.filter((o) => o.blocked === 'requires'))
|
|
|
|
|
|
|
|
|
|
|
|
/** Why a row can't be built now, or '' when its button shows. */
|
|
|
|
|
|
function reason(offer: Offer | null) {
|
|
|
|
|
|
if (!offer) return t('village.blocked.max_level')
|
|
|
|
|
|
if (offer.blocked) return t(`village.blocked.${offer.blocked}`)
|
|
|
|
|
|
if (!props.canAfford(offer.cost)) return t('village.blocked.resources')
|
2026-10-28 16:57:44 +00:00
|
|
|
|
return ''
|
|
|
|
|
|
}
|
2026-10-28 20:18:57 +00:00
|
|
|
|
|
2026-11-03 08:56:40 +00:00
|
|
|
|
/** "Storage" for the one that works in full, "Storage, copy 2" for the copies after it. */
|
|
|
|
|
|
function nameOf(b: Building) {
|
|
|
|
|
|
const name = t(`buildings.${b.type}`)
|
|
|
|
|
|
const n = byType.value.get(b.type)?.indexOf(b) ?? 0
|
|
|
|
|
|
return n > 0 ? t('village.copy.name', { name, n: n + 1 }) : name
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const demolishable = computed(() => [...byType.value.values()].flat().map((b) => ({ b, name: nameOf(b) })))
|
2026-10-28 16:57:44 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-10-29 09:15:36 +00:00
|
|
|
|
<section ref="root" class="panel overflow-hidden">
|
2026-10-28 18:04:21 +00:00
|
|
|
|
<div class="panel-head">
|
2026-10-28 20:18:57 +00:00
|
|
|
|
<div class="flex items-center gap-1" role="tablist">
|
|
|
|
|
|
<button
|
|
|
|
|
|
v-for="name in ['construct', 'demolish'] as const"
|
|
|
|
|
|
:key="name"
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
role="tab"
|
|
|
|
|
|
:aria-selected="tab === name"
|
2026-10-29 13:09:03 +00:00
|
|
|
|
class="inline-flex items-center gap-1 border border-wood-800 px-2 py-0.5 text-sm font-semibold"
|
2026-10-29 00:26:08 +00:00
|
|
|
|
:class="tab === name ? 'bg-wood-800 text-gold-400' : 'bg-parchment-200 text-wood-950 hover:bg-parchment-100'"
|
2026-10-28 20:18:57 +00:00
|
|
|
|
@click="tab = name"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ $t(`village.build.tab_${name}`) }}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
2026-10-28 19:22:53 +00:00
|
|
|
|
<span class="badge badge-plain">
|
2026-10-29 15:22:52 +00:00
|
|
|
|
{{ $t('village.build.free_space', { free: Math.max(0, space.max - space.used) }) }}
|
2026-10-28 18:54:29 +00:00
|
|
|
|
</span>
|
2026-10-28 18:04:21 +00:00
|
|
|
|
</div>
|
2026-10-28 20:01:23 +00:00
|
|
|
|
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<div v-if="tab === 'construct'">
|
|
|
|
|
|
<table class="grid-table build-table">
|
2026-10-28 20:01:23 +00:00
|
|
|
|
<thead>
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<tr>
|
|
|
|
|
|
<th class="pl-3">{{ $t('village.build.building') }}</th>
|
|
|
|
|
|
<th class="hidden @2xl:table-cell">{{ $t('village.build.cost') }}</th>
|
|
|
|
|
|
<th class="hidden text-right @2xl:table-cell">{{ $t('village.build.space_col') }}</th>
|
|
|
|
|
|
<th class="hidden text-right @2xl:table-cell">{{ $t('village.build.time') }}</th>
|
|
|
|
|
|
<th class="pr-3 text-right">{{ $t('village.build.construct') }}</th>
|
2026-10-28 20:01:23 +00:00
|
|
|
|
</tr>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
2026-10-29 09:15:36 +00:00
|
|
|
|
<tr
|
|
|
|
|
|
v-for="row in rows"
|
|
|
|
|
|
:key="row.key"
|
2026-11-03 08:56:40 +00:00
|
|
|
|
:class="[row.type === hint ? 'quest-hint' : row.group % 2 ? 'bg-parchment-100' : '', { 'group-start': row.first }]"
|
2026-10-29 09:15:36 +00:00
|
|
|
|
:data-hint="row.type === hint ? '' : undefined"
|
|
|
|
|
|
>
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<!-- The group's header: the portrait once, the name and how many stand. -->
|
|
|
|
|
|
<td v-if="row.kind === 'head'" colspan="5" class="pl-3">
|
2026-10-28 20:01:23 +00:00
|
|
|
|
<div class="flex items-center gap-2">
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<VillagePortraitTile :type="row.type" :level="byType.get(row.type)![0]!.level" class="size-8" />
|
|
|
|
|
|
<p class="font-semibold">{{ $t('village.build.group', { name: $t(`buildings.${row.type}`), count: row.count }) }}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
<td class="pr-2" :class="row.sub ? 'pl-6 @2xl:pl-12' : 'pl-3'">
|
|
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-if="row.kind === 'build' && row.another"
|
|
|
|
|
|
class="grid size-6 shrink-0 place-items-center border border-dashed border-wood-700 text-wood-800"
|
|
|
|
|
|
aria-hidden="true"
|
2026-10-28 20:18:57 +00:00
|
|
|
|
>
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<IconUi name="plus" class="size-3.5" />
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<VillagePortraitTile v-else-if="!row.sub" :type="row.type" :level="row.kind === 'upgrade' ? row.building.level : 1" class="size-8" />
|
|
|
|
|
|
<div class="min-w-0 leading-tight">
|
|
|
|
|
|
<!-- A standing building: under its group header the level is its name. -->
|
2026-10-31 09:54:49 +00:00
|
|
|
|
<template v-if="row.kind === 'upgrade'">
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
class="block max-w-full truncate text-left font-semibold hover:text-blood-700 hover:underline"
|
|
|
|
|
|
:title="$t('village.buildings.show')"
|
|
|
|
|
|
@click="emit('select', row.building.id)"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ row.sub ? $t('village.buildings.level_n', { level: row.building.level }) : $t(`buildings.${row.type}`) }}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<p class="flex flex-wrap items-center gap-1.5 text-xs text-ink-500">
|
|
|
|
|
|
<template v-if="!row.sub">{{ $t('village.buildings.level_n', { level: row.building.level }) }}</template>
|
|
|
|
|
|
<!-- A copy works at a share of the first: one amber chip, from the server's share. -->
|
|
|
|
|
|
<span v-if="row.rank > 0" class="badge badge-gold whitespace-nowrap">
|
|
|
|
|
|
{{ $t('village.copy.nth', { n: row.rank + 1, share: sharePercent(row.building.instance_share) }) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- One more of a type that stands: an action, not a building. -->
|
|
|
|
|
|
<p v-else-if="row.another" class="text-xs text-ink-700">
|
|
|
|
|
|
<span v-if="isCopy(row.option.instance_share)" class="badge badge-gold whitespace-normal @2xl:whitespace-nowrap">
|
|
|
|
|
|
{{ $t('village.copy.new', { share: sharePercent(row.option.instance_share) }) }}
|
2026-10-31 09:54:49 +00:00
|
|
|
|
</span>
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<template v-else>{{ $t('village.build.another_hint') }}</template>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
<p class="truncate font-semibold">{{ $t(`buildings.${row.type}`) }}</p>
|
|
|
|
|
|
<p class="text-xs text-ink-500">{{ $t('village.build.not_built') }}</p>
|
2026-10-31 09:54:49 +00:00
|
|
|
|
</template>
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<!-- Narrow screens: cost, villagers, time and why not under the name instead of in columns. -->
|
|
|
|
|
|
<p v-if="row.kind === 'upgrade' ? row.offer : true" class="mt-0.5 flex flex-wrap items-center gap-x-2.5 gap-y-0.5 @2xl:hidden">
|
|
|
|
|
|
<template v-if="row.kind === 'upgrade'">
|
|
|
|
|
|
<UiCost :cost="row.offer!.cost" :have="resources" nowrap />
|
|
|
|
|
|
<UiVillagers :villagers="row.offer!.villagers" :idle="idle" />
|
|
|
|
|
|
<span class="inline-flex items-center gap-1 text-xs text-ink-700 tabular-nums"><IconUi name="clock" class="size-3" />{{ formatDuration(row.offer!.seconds) }}</span>
|
|
|
|
|
|
<span v-if="reason(row.offer)" class="basis-full text-xs font-semibold text-blood-700">{{ reason(row.offer) }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
<UiCost :cost="row.option.cost" :have="resources" nowrap />
|
|
|
|
|
|
<UiVillagers :villagers="row.option.villagers" :idle="idle" />
|
|
|
|
|
|
<span class="inline-flex items-center gap-1 text-xs text-ink-700 tabular-nums"><IconUi name="clock" class="size-3" />{{ formatDuration(row.option.seconds) }}</span>
|
|
|
|
|
|
<span v-if="reason(row.option)" class="basis-full text-xs font-semibold text-blood-700">{{ reason(row.option) }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
2026-10-28 20:01:23 +00:00
|
|
|
|
</div>
|
2026-10-28 20:18:57 +00:00
|
|
|
|
</td>
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<template v-if="row.kind === 'upgrade'">
|
|
|
|
|
|
<td class="hidden @2xl:table-cell"><UiCost v-if="row.offer" :cost="row.offer.cost" :have="resources" :villagers="row.offer.villagers" :idle="idle" nowrap /></td>
|
|
|
|
|
|
<td class="hidden text-right text-ink-400 @2xl:table-cell">–</td>
|
|
|
|
|
|
<td class="hidden text-right tabular-nums whitespace-nowrap @2xl:table-cell">{{ row.offer ? formatDuration(row.offer.seconds) : '' }}</td>
|
|
|
|
|
|
<td class="pr-3 text-right">
|
|
|
|
|
|
<button
|
|
|
|
|
|
v-if="!reason(row.offer)"
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
class="btn btn-primary px-2 py-0.5 whitespace-nowrap @2xl:min-w-[5.5rem] @2xl:px-2.5"
|
|
|
|
|
|
:disabled="busy"
|
|
|
|
|
|
@click="emit('upgrade', row.building.id)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<IconUi name="up" class="size-3.5" />
|
|
|
|
|
|
{{ $t('village.build.level_button', { level: row.offer!.target_level }) }}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<!-- On narrow screens the reason stands under the name; max level has no line there. -->
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-else
|
|
|
|
|
|
class="text-xs font-semibold whitespace-nowrap text-blood-700 @2xl:inline"
|
|
|
|
|
|
:class="row.offer ? 'hidden' : ''"
|
|
|
|
|
|
>{{ reason(row.offer) }}</span>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
<td class="hidden @2xl:table-cell"><UiCost :cost="row.option.cost" :have="resources" :villagers="row.option.villagers" :idle="idle" nowrap /></td>
|
|
|
|
|
|
<td class="hidden text-right tabular-nums @2xl:table-cell">{{ row.option.space || '–' }}</td>
|
|
|
|
|
|
<td class="hidden text-right tabular-nums whitespace-nowrap @2xl:table-cell">{{ formatDuration(row.option.seconds) }}</td>
|
|
|
|
|
|
<td class="pr-3 text-right">
|
|
|
|
|
|
<button
|
|
|
|
|
|
v-if="!reason(row.option)"
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
class="btn btn-outline border-blood-700 px-2 py-0.5 whitespace-nowrap text-blood-700 @2xl:min-w-[5.5rem] @2xl:px-2.5"
|
|
|
|
|
|
:disabled="busy"
|
|
|
|
|
|
:title="row.another ? $t('village.build.submit_another') : undefined"
|
|
|
|
|
|
@click="emit('build', row.type)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<IconUi :name="row.another ? 'plus' : 'hammer'" class="size-3.5" />
|
|
|
|
|
|
<!-- Phones say just "Build": the plus and the row already say it is another one. -->
|
|
|
|
|
|
<span v-if="row.another" class="hidden @2xl:inline">{{ $t('village.build.submit_another') }}</span>
|
|
|
|
|
|
<span :class="row.another ? '@2xl:hidden' : ''">{{ $t('village.build.submit') }}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<span v-else class="hidden text-xs font-semibold whitespace-nowrap text-blood-700 @2xl:inline">{{ reason(row.option) }}</span>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</template>
|
2026-10-28 20:18:57 +00:00
|
|
|
|
</template>
|
2026-10-28 20:01:23 +00:00
|
|
|
|
</tr>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
2026-10-28 20:18:57 +00:00
|
|
|
|
|
|
|
|
|
|
<template v-if="locked.length">
|
2026-10-29 13:09:03 +00:00
|
|
|
|
<h3 class="border-y border-wood-700 bg-parchment-300 px-2 py-0.5 text-sm font-bold text-wood-950">
|
2026-10-28 20:18:57 +00:00
|
|
|
|
{{ $t('village.build.not_available') }}
|
|
|
|
|
|
</h3>
|
|
|
|
|
|
<table class="w-full border-collapse text-sm">
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
<tr v-for="o in locked" :key="o.type" class="border-b border-parchment-300 text-ink-500 last:border-b-0">
|
|
|
|
|
|
<td class="w-1/3 px-3 py-1">
|
|
|
|
|
|
<div class="flex items-center gap-2 opacity-70">
|
|
|
|
|
|
<IconBuildingTile :type="o.type" class="size-7" />
|
|
|
|
|
|
<span class="font-semibold">{{ $t(`buildings.${o.type}`) }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="px-2 py-1">
|
|
|
|
|
|
<span class="mr-2 text-xs">{{ $t('village.build.requires') }}</span>
|
|
|
|
|
|
<span v-for="r in o.requires" :key="r.type" class="mr-3 inline-flex items-center gap-1 whitespace-nowrap">
|
|
|
|
|
|
<IconBuildingTile :type="r.type" class="size-5" />
|
|
|
|
|
|
{{ $t('village.build.requirement', { type: $t(`buildings.${r.type}`), level: r.level }) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
</template>
|
2026-10-28 18:04:21 +00:00
|
|
|
|
</div>
|
2026-10-28 20:01:23 +00:00
|
|
|
|
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<div v-else>
|
|
|
|
|
|
<table class="grid-table build-table">
|
2026-10-28 20:18:57 +00:00
|
|
|
|
<thead>
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<tr>
|
|
|
|
|
|
<th class="pl-3">{{ $t('village.build.building') }}</th>
|
|
|
|
|
|
<th class="hidden @xl:table-cell">{{ $t('village.build.refund') }}</th>
|
|
|
|
|
|
<th class="hidden text-right @xl:table-cell">{{ $t('village.build.time') }}</th>
|
|
|
|
|
|
<th class="pr-3 text-right">{{ $t('village.build.tab_demolish') }}</th>
|
2026-10-28 20:18:57 +00:00
|
|
|
|
</tr>
|
|
|
|
|
|
</thead>
|
2026-10-28 20:01:23 +00:00
|
|
|
|
<tbody>
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<tr v-for="{ b, name } in demolishable" :key="b.id" class="even:bg-parchment-100">
|
|
|
|
|
|
<td class="pl-3">
|
2026-10-28 20:18:57 +00:00
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
|
|
<IconBuildingTile :type="b.type" class="size-7" />
|
|
|
|
|
|
<div class="min-w-0 leading-tight">
|
|
|
|
|
|
<p class="truncate font-semibold">{{ name }}</p>
|
|
|
|
|
|
<p class="text-xs text-ink-500">{{ $t('village.buildings.level_n', { level: b.level }) }}</p>
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<p v-if="b.demolish" class="mt-0.5 flex flex-wrap items-center gap-x-2.5 @xl:hidden">
|
|
|
|
|
|
<UiCost :cost="b.demolish.refund" />
|
|
|
|
|
|
<span class="inline-flex items-center gap-1 text-xs text-ink-700 tabular-nums"><IconUi name="clock" class="size-3" />{{ formatDuration(b.demolish.seconds) }}</span>
|
|
|
|
|
|
</p>
|
2026-10-28 20:18:57 +00:00
|
|
|
|
</div>
|
2026-10-28 20:01:23 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
2026-11-03 08:56:40 +00:00
|
|
|
|
<td class="hidden @xl:table-cell"><UiCost v-if="b.demolish" :cost="b.demolish.refund" nowrap /></td>
|
|
|
|
|
|
<td class="hidden text-right tabular-nums whitespace-nowrap @xl:table-cell">{{ b.demolish ? formatDuration(b.demolish.seconds) : '' }}</td>
|
|
|
|
|
|
<td class="pr-3 text-right">
|
2026-10-28 20:18:57 +00:00
|
|
|
|
<button
|
|
|
|
|
|
v-if="b.demolish"
|
|
|
|
|
|
type="button"
|
2026-11-03 08:56:40 +00:00
|
|
|
|
class="btn btn-outline min-w-[5.5rem] border-blood-700 px-2.5 py-0.5 whitespace-nowrap text-blood-700"
|
2026-10-28 20:18:57 +00:00
|
|
|
|
:disabled="busy"
|
|
|
|
|
|
@click="emit('demolish', b.id)"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{
|
2026-10-28 21:26:50 +00:00
|
|
|
|
b.demolish.target_level < 1
|
2026-10-28 20:18:57 +00:00
|
|
|
|
? $t('village.build.remove')
|
|
|
|
|
|
: $t('village.build.level_button', { level: b.demolish.target_level })
|
|
|
|
|
|
}}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<span v-else class="text-xs font-semibold text-ink-500">{{ $t('village.build.core') }}</span>
|
2026-10-28 20:01:23 +00:00
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
2026-10-28 20:18:57 +00:00
|
|
|
|
</div>
|
2026-10-28 16:57:44 +00:00
|
|
|
|
</section>
|
|
|
|
|
|
</template>
|
2026-10-29 09:15:36 +00:00
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
@reference "~/assets/css/main.css";
|
|
|
|
|
|
|
2026-11-03 08:56:40 +00:00
|
|
|
|
/* A heavier rule opens each building type, so the groups read as blocks. */
|
|
|
|
|
|
.build-table tr.group-start td {
|
|
|
|
|
|
@apply border-t-2 border-t-wood-600;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-29 09:15:36 +00:00
|
|
|
|
/* The row a quest points at: a gold band and a marker before the name. */
|
|
|
|
|
|
.quest-hint {
|
|
|
|
|
|
@apply bg-gold-400;
|
|
|
|
|
|
}
|
|
|
|
|
|
.quest-hint td:first-child {
|
|
|
|
|
|
@apply border-l-4 border-l-blood-700;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|