refacto: rename alias to reference

This commit is contained in:
Julien Calixte
2025-08-09 11:37:21 +02:00
parent 839eec1acd
commit 0db7ec94af
4 changed files with 17 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import { useBoardGameStore } from '@/modules/5s/board-game-store'
import { shuffleArray } from '@/utils'
import { computed } from 'vue'
const boardGameStore = useBoardGameStore()
@@ -8,7 +9,9 @@ const isSeitonActivated = computed(() =>
)
const rawTools = computed(() =>
boardGameStore.tools.map((t) => `${t.name} (${t.alias})`).join(', ')
shuffleArray(
boardGameStore.tools.map((t) => `${t.name} (ref: ${t.reference})`)
).join(', ')
)
</script>
@@ -24,9 +27,9 @@ const rawTools = computed(() =>
</tr>
</thead>
<tbody>
<tr v-for="tool in boardGameStore.tools" :key="tool.alias">
<tr v-for="tool in boardGameStore.tools" :key="tool.reference">
<td>{{ tool.name }}</td>
<td>{{ tool.alias }}</td>
<td>{{ tool.reference }}</td>
</tr>
</tbody>
</table>

View File

@@ -47,7 +47,7 @@ export const useBoardGameStore = defineStore('board-game', {
initGame() {
this.tools = tools.map((t) => ({
...t,
alias: randomAlias()
reference: randomAlias()
}))
this.boardGames = firstDemands
this.currentBoardGameIndex = 0
@@ -61,7 +61,7 @@ export const useBoardGameStore = defineStore('board-game', {
return
}
const tool = this.tools.find((t) => t.alias === alias)
const tool = this.tools.find((t) => t.reference === alias)
if (!tool) {
return

View File

@@ -1,14 +1,14 @@
import { Tool } from '@/modules/5s/types/workshop'
export const tools: Tool[] = [
{ name: 'Card Printer', id: 'card-printer', alias: '', cooldown: 5 },
{ name: 'Miniature Mold', id: 'mini-mold', alias: '', cooldown: 15 },
{ name: 'Dice Engraver', id: 'dice-engraver', alias: '', cooldown: 10 },
{ name: 'Board Cutter', id: 'board-cutter', alias: '', cooldown: 8 },
{ name: 'Rulebook Designer', id: 'rulebook-dzn', alias: '', cooldown: 6 },
{ name: 'Box Assembler', id: 'box-asm', alias: '', cooldown: 4 },
{ name: 'Component Painter', id: 'painter', alias: '', cooldown: 12 },
{ name: 'Lamination Machine', id: 'laminator', alias: '', cooldown: 7 }
{ name: 'Card Printer', id: 'card-printer', reference: '', cooldown: 5 },
{ name: 'Miniature Mold', id: 'mini-mold', reference: '', cooldown: 15 },
{ name: 'Dice Engraver', id: 'dice-engraver', reference: '', cooldown: 10 },
{ name: 'Board Cutter', id: 'board-cutter', reference: '', cooldown: 8 },
{ name: 'Rulebook Designer', id: 'rulebook-dzn', reference: '', cooldown: 6 },
{ name: 'Box Assembler', id: 'box-asm', reference: '', cooldown: 4 },
{ name: 'Component Painter', id: 'painter', reference: '', cooldown: 12 },
{ name: 'Lamination Machine', id: 'laminator', reference: '', cooldown: 7 }
]
export type NonEmptyArray<T> = [T, ...T[]]

View File

@@ -3,7 +3,7 @@ import { NonEmptyArray } from '@/modules/5s/types/tools'
export type Tool = {
name: string
id: string
alias: string
reference: string
cooldown: number
}