fix: market forms accept any whole amount (no step validation), the target placeholder shows x|y, names keep their gap, offers stack Accept under the count on phones, intervals read "1 d", a refused offer list stops loading, the merchant count turns red when none are free
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8ae8e75163
commit
7384566f7f
|
|
@ -37,7 +37,7 @@ function most(r: TradeResource) {
|
||||||
v-model.number="amounts[r]"
|
v-model.number="amounts[r]"
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
step="100"
|
|
||||||
inputmode="numeric"
|
inputmode="numeric"
|
||||||
class="input w-20 px-1.5 py-0.5 text-right tabular-nums"
|
class="input w-20 px-1.5 py-0.5 text-right tabular-nums"
|
||||||
:aria-label="$t('market.amount_of', { resource: $t(`resources.${r}`) })"
|
:aria-label="$t('market.amount_of', { resource: $t(`resources.${r}`) })"
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ const outside = computed(() => every.value < props.min || every.value > props.ma
|
||||||
<label :for="`${id}-h`" class="label mb-0 w-24">{{ $t('market.routes.every') }}</label>
|
<label :for="`${id}-h`" class="label mb-0 w-24">{{ $t('market.routes.every') }}</label>
|
||||||
<input :id="`${id}-h`" v-model.number="hours" type="number" min="0" inputmode="numeric" class="input w-14 px-1.5 py-0.5 text-right tabular-nums" :aria-label="$t('market.routes.hours')" />
|
<input :id="`${id}-h`" v-model.number="hours" type="number" min="0" inputmode="numeric" class="input w-14 px-1.5 py-0.5 text-right tabular-nums" :aria-label="$t('market.routes.hours')" />
|
||||||
<span>{{ $t('market.routes.h') }}</span>
|
<span>{{ $t('market.routes.h') }}</span>
|
||||||
<input v-model.number="minutes" type="number" min="0" max="59" step="5" inputmode="numeric" class="input w-14 px-1.5 py-0.5 text-right tabular-nums" :aria-label="$t('market.routes.minutes')" />
|
<input v-model.number="minutes" type="number" min="0" max="59" inputmode="numeric" class="input w-14 px-1.5 py-0.5 text-right tabular-nums" :aria-label="$t('market.routes.minutes')" />
|
||||||
<span>{{ $t('market.routes.min') }}</span>
|
<span>{{ $t('market.routes.min') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-xs" :class="outside ? 'text-blood-700' : 'text-ink-500'">
|
<p class="text-xs" :class="outside ? 'text-blood-700' : 'text-ink-500'">
|
||||||
|
|
|
||||||
|
|
@ -57,13 +57,13 @@ async function submit() {
|
||||||
<select id="offer-give" v-model="give" class="input w-auto py-0.5">
|
<select id="offer-give" v-model="give" class="input w-auto py-0.5">
|
||||||
<option v-for="r in market.resources" :key="r" :value="r">{{ $t(`resources.${r}`) }}</option>
|
<option v-for="r in market.resources" :key="r" :value="r">{{ $t(`resources.${r}`) }}</option>
|
||||||
</select>
|
</select>
|
||||||
<input v-model.number="giveAmount" type="number" min="1" step="100" inputmode="numeric" class="input w-24 px-1.5 py-0.5 text-right tabular-nums" :aria-label="$t('market.mine.give_amount')" />
|
<input v-model.number="giveAmount" type="number" min="1" inputmode="numeric" class="input w-24 px-1.5 py-0.5 text-right tabular-nums" :aria-label="$t('market.mine.give_amount')" />
|
||||||
|
|
||||||
<label for="offer-want" class="font-semibold text-ink-700">{{ $t('market.mine.want') }}</label>
|
<label for="offer-want" class="font-semibold text-ink-700">{{ $t('market.mine.want') }}</label>
|
||||||
<select id="offer-want" v-model="want" class="input w-auto py-0.5">
|
<select id="offer-want" v-model="want" class="input w-auto py-0.5">
|
||||||
<option v-for="r in market.resources" :key="r" :value="r">{{ $t(`resources.${r}`) }}</option>
|
<option v-for="r in market.resources" :key="r" :value="r">{{ $t(`resources.${r}`) }}</option>
|
||||||
</select>
|
</select>
|
||||||
<input v-model.number="wantAmount" type="number" min="1" step="100" inputmode="numeric" class="input w-24 px-1.5 py-0.5 text-right tabular-nums" :aria-label="$t('market.mine.want_amount')" />
|
<input v-model.number="wantAmount" type="number" min="1" inputmode="numeric" class="input w-24 px-1.5 py-0.5 text-right tabular-nums" :aria-label="$t('market.mine.want_amount')" />
|
||||||
|
|
||||||
<label for="offer-count" class="font-semibold text-ink-700">{{ $t('market.mine.count') }}</label>
|
<label for="offer-count" class="font-semibold text-ink-700">{{ $t('market.mine.count') }}</label>
|
||||||
<input id="offer-count" v-model.number="count" type="number" min="1" inputmode="numeric" class="input w-16 px-1.5 py-0.5 text-right tabular-nums" />
|
<input id="offer-count" v-model.number="count" type="number" min="1" inputmode="numeric" class="input w-16 px-1.5 py-0.5 text-right tabular-nums" />
|
||||||
|
|
@ -78,7 +78,8 @@ async function submit() {
|
||||||
<IconUi name="cart" class="mr-1 inline size-4 align-[-3px]" />{{ $t('market.merchants_needed', { needed: merchants, merchants: market.free }) }}
|
<IconUi name="cart" class="mr-1 inline size-4 align-[-3px]" />{{ $t('market.merchants_needed', { needed: merchants, merchants: market.free }) }}
|
||||||
</li>
|
</li>
|
||||||
<li :class="reserved > Math.floor(stock[give]) ? 'text-blood-700' : ''">
|
<li :class="reserved > Math.floor(stock[give]) ? 'text-blood-700' : ''">
|
||||||
{{ $t('market.mine.reserved', { amount: reserved, resource: $t(`resources.${give}`) }) }}
|
{{ $t('market.mine.reserved') }}
|
||||||
|
<span class="inline-flex items-center gap-0.5 font-semibold tabular-nums"><IconResource :resource="give" class="size-4" />{{ reserved }}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p v-if="problem && n(giveAmount) && n(wantAmount)" class="text-blood-700">{{ problem }}</p>
|
<p v-if="problem && n(giveAmount) && n(wantAmount)" class="text-blood-700">{{ problem }}</p>
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ const mapLink = (r: TradeRoute) => ({ path: `/map/${props.worldId}`, query: { x:
|
||||||
<tr :class="r.paused ? 'bg-parchment-100 text-ink-500' : ''">
|
<tr :class="r.paused ? 'bg-parchment-100 text-ink-500' : ''">
|
||||||
<td class="py-1">
|
<td class="py-1">
|
||||||
<NuxtLink :to="mapLink(r)" class="font-semibold text-ink-900 hover:underline">{{ villageLabel(r.to) }}</NuxtLink>
|
<NuxtLink :to="mapLink(r)" class="font-semibold text-ink-900 hover:underline">{{ villageLabel(r.to) }}</NuxtLink>
|
||||||
<span class="text-xs text-ink-500"> {{ r.to.player?.name }}</span>
|
<span class="ml-1 text-xs text-ink-500">{{ r.to.player?.name }}</span>
|
||||||
<span class="mt-0.5 flex flex-wrap items-center gap-x-2 text-xs text-ink-700">
|
<span class="mt-0.5 flex flex-wrap items-center gap-x-2 text-xs text-ink-700">
|
||||||
<MarketCargo :cargo="r.resources" />
|
<MarketCargo :cargo="r.resources" />
|
||||||
<span class="inline-flex items-center gap-0.5 whitespace-nowrap"><IconUi name="repeat" class="size-3.5" />{{ $t('market.routes.every_n', { every: formatInterval(r.every, t) }) }}</span>
|
<span class="inline-flex items-center gap-0.5 whitespace-nowrap"><IconUi name="repeat" class="size-3.5" />{{ $t('market.routes.every_n', { every: formatInterval(r.every, t) }) }}</span>
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ const other = (x: Trade): VillageRef => (x.kind === 'out' ? x.to : x.from)
|
||||||
<IconUi :name="x.kind === 'back' ? 'return' : 'cart'" class="mt-0.5 size-4 shrink-0" />
|
<IconUi :name="x.kind === 'back' ? 'return' : 'cart'" class="mt-0.5 size-4 shrink-0" />
|
||||||
<div class="min-w-0">
|
<div class="min-w-0">
|
||||||
<NuxtLink :to="{ path: `/map/${worldId}`, query: { x: other(x).x, y: other(x).y } }" class="font-semibold hover:underline">{{ title(x) }}</NuxtLink>
|
<NuxtLink :to="{ path: `/map/${worldId}`, query: { x: other(x).x, y: other(x).y } }" class="font-semibold hover:underline">{{ title(x) }}</NuxtLink>
|
||||||
<span v-if="x.kind === 'in' && x.from.player" class="text-ink-500"> {{ $t('market.trades.by', { player: x.from.player.name }) }}</span>
|
<span v-if="x.kind === 'in' && x.from.player" class="ml-1 text-ink-500">{{ $t('market.trades.by', { player: x.from.player.name }) }}</span>
|
||||||
<div class="mt-0.5 flex flex-wrap items-center gap-x-2.5 gap-y-0.5 text-xs text-ink-700">
|
<div class="mt-0.5 flex flex-wrap items-center gap-x-2.5 gap-y-0.5 text-xs text-ink-700">
|
||||||
<MarketCargo v-if="x.cargo" :cargo="x.cargo" />
|
<MarketCargo v-if="x.cargo" :cargo="x.cargo" />
|
||||||
<span v-if="x.kind !== 'in'" class="inline-flex items-center gap-0.5 whitespace-nowrap tabular-nums">
|
<span v-if="x.kind !== 'in'" class="inline-flex items-center gap-0.5 whitespace-nowrap tabular-nums">
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ async function load() {
|
||||||
const filters = [give.value, want.value]
|
const filters = [give.value, want.value]
|
||||||
const result = await props.offers(give.value, want.value)
|
const result = await props.offers(give.value, want.value)
|
||||||
// Drop answers for filters that changed meanwhile.
|
// Drop answers for filters that changed meanwhile.
|
||||||
if (filters[0] === give.value && filters[1] === want.value) list.value = result
|
if (filters[0] === give.value && filters[1] === want.value) list.value = result ?? { server_time: '', offers: [] }
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
watch([give, want], load, { immediate: true })
|
watch([give, want], load, { immediate: true })
|
||||||
|
|
@ -110,7 +110,7 @@ const mapLink = (o: WorldOffer) => ({ path: `/map/${props.worldId}`, query: { x:
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<span v-if="o.own" class="badge badge-plain">{{ $t('market.offers.own') }}</span>
|
<span v-if="o.own" class="badge badge-plain">{{ $t('market.offers.own') }}</span>
|
||||||
<span v-else class="inline-flex items-center justify-end gap-1">
|
<span v-else class="inline-flex flex-col items-end gap-0.5 @md:flex-row @md:items-center @md:gap-1">
|
||||||
<input
|
<input
|
||||||
v-model.number="counts[o.id]"
|
v-model.number="counts[o.id]"
|
||||||
type="number"
|
type="number"
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ const mapLink = (v: VillageRef) => ({ path: `/map/${props.worldId}`, query: { x:
|
||||||
<th class="w-28">{{ $t(`reports.trade.${side}`) }}</th>
|
<th class="w-28">{{ $t(`reports.trade.${side}`) }}</th>
|
||||||
<td>
|
<td>
|
||||||
<NuxtLink :to="mapLink(report[side])" class="font-semibold hover:underline">{{ villageLabel(report[side]) }}</NuxtLink>
|
<NuxtLink :to="mapLink(report[side])" class="font-semibold hover:underline">{{ villageLabel(report[side]) }}</NuxtLink>
|
||||||
<span class="text-ink-500"> {{ report[side].player?.name ?? $t('common.barbarian') }}</span>
|
<span class="ml-1 text-ink-500">{{ report[side].player?.name ?? $t('common.barbarian') }}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ const initialTarget = computed(() => (route.query.x && route.query.y ? { x: Numb
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||||
<UiSubTabs v-model="tab" :tabs="tabs" />
|
<UiSubTabs v-model="tab" :tabs="tabs" />
|
||||||
<span v-if="state?.market" class="inline-flex items-center gap-1 text-sm whitespace-nowrap text-ink-700 tabular-nums" :title="$t('market.merchants_title', { carry: state.market.carry })">
|
<span v-if="state?.market" class="inline-flex items-center gap-1 text-sm whitespace-nowrap tabular-nums" :class="state.market.free ? 'text-ink-700' : 'font-semibold text-blood-700'" :title="$t('market.merchants_title', { carry: state.market.carry })">
|
||||||
<IconUi name="cart" class="size-4" />
|
<IconUi name="cart" class="size-4" />
|
||||||
{{ $t('market.merchants_free', { free: state.market.free, merchants: state.market.merchants }) }}
|
{{ $t('market.merchants_free', { free: state.market.free, merchants: state.market.merchants }) }}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export function formatInterval(seconds: number, t: Translate) {
|
||||||
const days = Math.floor(m / 1440)
|
const days = Math.floor(m / 1440)
|
||||||
const hours = Math.floor((m % 1440) / 60)
|
const hours = Math.floor((m % 1440) / 60)
|
||||||
const minutes = m % 60
|
const minutes = m % 60
|
||||||
if (days) return t('market.interval.dh', { d: days, h: hours })
|
if (days) return hours ? t('market.interval.dh', { d: days, h: hours }) : t('market.interval.d', { d: days })
|
||||||
if (hours && minutes) return t('market.interval.hm', { h: hours, m: minutes })
|
if (hours && minutes) return t('market.interval.hm', { h: hours, m: minutes })
|
||||||
if (hours) return t('market.interval.h', { h: hours })
|
if (hours) return t('market.interval.h', { h: hours })
|
||||||
return t('market.interval.m', { m: minutes })
|
return t('market.interval.m', { m: minutes })
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ export default {
|
||||||
merchants_needed: 'Merchants needed: {needed} of {merchants} free',
|
merchants_needed: 'Merchants needed: {needed} of {merchants} free',
|
||||||
merchants_per_run: 'Merchants per run: {needed} of {merchants}',
|
merchants_per_run: 'Merchants per run: {needed} of {merchants}',
|
||||||
target: 'Target',
|
target: 'Target',
|
||||||
target_placeholder: 'x|y',
|
target_placeholder: "x{'|'}y",
|
||||||
village: 'Village',
|
village: 'Village',
|
||||||
distance: 'Distance',
|
distance: 'Distance',
|
||||||
fields: '{fields} fields',
|
fields: '{fields} fields',
|
||||||
|
|
@ -77,7 +77,7 @@ export default {
|
||||||
count: 'Times',
|
count: 'Times',
|
||||||
count_hint: 'one trade each',
|
count_hint: 'one trade each',
|
||||||
ratio: 'You ask {ratio} for each 1 you give; at most {max} times as much either way.',
|
ratio: 'You ask {ratio} for each 1 you give; at most {max} times as much either way.',
|
||||||
reserved: 'Held back while the offer is open: {amount} {resource}',
|
reserved: 'Held back while the offer is open:',
|
||||||
submit: 'Post offer',
|
submit: 'Post offer',
|
||||||
open: 'Open offers',
|
open: 'Open offers',
|
||||||
merchants: 'Merchants',
|
merchants: 'Merchants',
|
||||||
|
|
@ -115,6 +115,7 @@ export default {
|
||||||
submit: 'Create route',
|
submit: 'Create route',
|
||||||
},
|
},
|
||||||
interval: {
|
interval: {
|
||||||
|
d: '{d} d',
|
||||||
dh: '{d} d {h} h',
|
dh: '{d} d {h} h',
|
||||||
hm: '{h} h {m} min',
|
hm: '{h} h {m} min',
|
||||||
h: '{h} h',
|
h: '{h} h',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue