refacto: rename alias to reference
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useBoardGameStore } from '@/modules/5s/board-game-store'
|
import { useBoardGameStore } from '@/modules/5s/board-game-store'
|
||||||
|
import { shuffleArray } from '@/utils'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
const boardGameStore = useBoardGameStore()
|
const boardGameStore = useBoardGameStore()
|
||||||
@@ -8,7 +9,9 @@ const isSeitonActivated = computed(() =>
|
|||||||
)
|
)
|
||||||
|
|
||||||
const rawTools = 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>
|
</script>
|
||||||
|
|
||||||
@@ -24,9 +27,9 @@ const rawTools = computed(() =>
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<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.name }}</td>
|
||||||
<td>{{ tool.alias }}</td>
|
<td>{{ tool.reference }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export const useBoardGameStore = defineStore('board-game', {
|
|||||||
initGame() {
|
initGame() {
|
||||||
this.tools = tools.map((t) => ({
|
this.tools = tools.map((t) => ({
|
||||||
...t,
|
...t,
|
||||||
alias: randomAlias()
|
reference: randomAlias()
|
||||||
}))
|
}))
|
||||||
this.boardGames = firstDemands
|
this.boardGames = firstDemands
|
||||||
this.currentBoardGameIndex = 0
|
this.currentBoardGameIndex = 0
|
||||||
@@ -61,7 +61,7 @@ export const useBoardGameStore = defineStore('board-game', {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const tool = this.tools.find((t) => t.alias === alias)
|
const tool = this.tools.find((t) => t.reference === alias)
|
||||||
|
|
||||||
if (!tool) {
|
if (!tool) {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { Tool } from '@/modules/5s/types/workshop'
|
import { Tool } from '@/modules/5s/types/workshop'
|
||||||
|
|
||||||
export const tools: Tool[] = [
|
export const tools: Tool[] = [
|
||||||
{ name: 'Card Printer', id: 'card-printer', alias: '', cooldown: 5 },
|
{ name: 'Card Printer', id: 'card-printer', reference: '', cooldown: 5 },
|
||||||
{ name: 'Miniature Mold', id: 'mini-mold', alias: '', cooldown: 15 },
|
{ name: 'Miniature Mold', id: 'mini-mold', reference: '', cooldown: 15 },
|
||||||
{ name: 'Dice Engraver', id: 'dice-engraver', alias: '', cooldown: 10 },
|
{ name: 'Dice Engraver', id: 'dice-engraver', reference: '', cooldown: 10 },
|
||||||
{ name: 'Board Cutter', id: 'board-cutter', alias: '', cooldown: 8 },
|
{ name: 'Board Cutter', id: 'board-cutter', reference: '', cooldown: 8 },
|
||||||
{ name: 'Rulebook Designer', id: 'rulebook-dzn', alias: '', cooldown: 6 },
|
{ name: 'Rulebook Designer', id: 'rulebook-dzn', reference: '', cooldown: 6 },
|
||||||
{ name: 'Box Assembler', id: 'box-asm', alias: '', cooldown: 4 },
|
{ name: 'Box Assembler', id: 'box-asm', reference: '', cooldown: 4 },
|
||||||
{ name: 'Component Painter', id: 'painter', alias: '', cooldown: 12 },
|
{ name: 'Component Painter', id: 'painter', reference: '', cooldown: 12 },
|
||||||
{ name: 'Lamination Machine', id: 'laminator', alias: '', cooldown: 7 }
|
{ name: 'Lamination Machine', id: 'laminator', reference: '', cooldown: 7 }
|
||||||
]
|
]
|
||||||
export type NonEmptyArray<T> = [T, ...T[]]
|
export type NonEmptyArray<T> = [T, ...T[]]
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { NonEmptyArray } from '@/modules/5s/types/tools'
|
|||||||
export type Tool = {
|
export type Tool = {
|
||||||
name: string
|
name: string
|
||||||
id: string
|
id: string
|
||||||
alias: string
|
reference: string
|
||||||
cooldown: number
|
cooldown: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user