베팅 금액 입력을 장수별로 독립시키고 공용 설정 제거

This commit is contained in:
2026-09-12 02:20:08 +00:00
parent 21d10d5dfc
commit e55c653e40
2 changed files with 11 additions and 30 deletions
@@ -1106,14 +1106,16 @@ for (const width of [1365, 390]) {
const second = bracket.locator('.betting-candidate').nth(1);
const input = first.getByRole('spinbutton');
await expect(input).toHaveValue('10');
await page.getByLabel('기본 지정 금액').selectOption('20');
await expect(input).toHaveValue('20');
await expect(page.locator('input[type=number]:visible')).toHaveCount(16);
await expect(page.getByRole('region', { name: '베팅 한도' }).getByRole('spinbutton')).toHaveCount(0);
await first.getByRole('combobox').selectOption('50');
await expect(input).toHaveValue('50');
await expect(second.getByRole('spinbutton')).toHaveValue('20');
await expect(second.getByRole('spinbutton')).toHaveValue('10');
await input.fill('37');
await second.getByRole('spinbutton').fill('23');
await page.getByRole('button', { name: '갱신', exact: true }).click();
await expect(input).toHaveValue('37');
await expect(second.getByRole('spinbutton')).toHaveValue('23');
for (const invalid of ['', '9', '10.5', '841']) {
await input.fill(invalid);
await expect(first.getByRole('button', { name: '관우에게 베팅하기' })).toBeDisabled();
+6 -27
View File
@@ -12,13 +12,12 @@ import { trpc } from '../utils/trpc';
const tournamentPages = useTournamentPagesStore();
const { snapshot, betting: summary, rankings, loading, error } = storeToRefs(tournamentPages);
const defaultAmount = ref<number | string>(10);
const amounts = ref<Record<number, number | string>>({});
const pendingBets = ref<Record<number, number>>({});
const betMessages = ref<Record<number, { text: string; error: boolean }>>({});
const presetAmounts = [10, 20, 50, 100, 200, 500, 1000];
const activeRankingPrefix = ref('tt');
const amountFor = (id: number): number | string => amounts.value[id] ?? defaultAmount.value;
const amountFor = (id: number): number | string => amounts.value[id] ?? 10;
const remainingAmount = computed(() => Math.max(0, 1000 - myAmount.value));
const availableAmount = computed(() =>
Math.max(0, remainingAmount.value - Object.values(pendingBets.value).reduce((sum, amount) => sum + amount, 0))
@@ -105,15 +104,7 @@ const placeBet = async (target: TournamentBracketSlot) => {
<small>(전체 금액 : {{ totalAmount }} / 투자 금액 : {{ myAmount }})</small>
</section>
<section class="bet-settings bg0" aria-label="베팅 금액 설정">
<label
>기본 금액
<input v-model.number="defaultAmount" type="number" min="10" max="1000" step="1" inputmode="numeric" />
</label>
<select v-model.number="defaultAmount" aria-label="기본 지정 금액">
<option v-if="!presetAmounts.includes(Number(defaultAmount))" :value="defaultAmount">직접 입력</option>
<option v-for="amount in presetAmounts" :key="amount" :value="amount">{{ amount }}</option>
</select>
<section class="bet-budget bg0" aria-label="베팅 한도">
<span>남은 한도 {{ remainingAmount.toLocaleString('ko-KR') }}</span>
<small
> 장수에게 추가할 금액입니다. 예상 환수금은 해당 장수 우승 금액이며, 최종 배당에 따라
@@ -378,7 +369,7 @@ select:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.bet-settings {
.bet-budget {
display: flex;
flex-wrap: wrap;
align-items: center;
@@ -386,16 +377,7 @@ select:disabled {
padding: 8px;
text-align: left;
}
.bet-settings label {
display: flex;
align-items: center;
gap: 8px;
}
.bet-settings input,
.bet-settings select {
width: 90px;
}
.bet-settings small {
.bet-budget small {
flex-basis: 100%;
color: #c9c1b2;
}
@@ -407,9 +389,7 @@ select:disabled {
}
.inline-bet input,
.inline-bet select,
.inline-bet button,
.bet-settings input,
.bet-settings select {
.inline-bet button {
box-sizing: border-box;
min-width: 0;
height: 44px;
@@ -425,8 +405,7 @@ select:disabled {
background: #59400e;
font-weight: 700;
}
.inline-bet input:focus-visible,
.bet-settings input:focus-visible {
.inline-bet input:focus-visible {
outline: 2px solid #f39c12;
outline-offset: 1px;
}