feat: seiton - sort lines
This commit is contained in:
@@ -23,11 +23,17 @@ const neededTools = computed(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const tools = computed(() => {
|
const tools = computed(() => {
|
||||||
if (isSeiriActivated.value) {
|
const toolsToUse = isSeiriActivated.value
|
||||||
return boardGameStore.tools.filter((t) => neededTools.value.has(t.id))
|
? boardGameStore.tools.filter((t) => neededTools.value.has(t.id))
|
||||||
} else {
|
: boardGameStore.tools
|
||||||
return boardGameStore.tools
|
|
||||||
}
|
return isSeitonActivated.value
|
||||||
|
? [...toolsToUse].sort(
|
||||||
|
(a, b) =>
|
||||||
|
(boardGameStore.countUsedTools[b.id] || 0) -
|
||||||
|
(boardGameStore.countUsedTools[a.id] || 0)
|
||||||
|
)
|
||||||
|
: toolsToUse
|
||||||
})
|
})
|
||||||
|
|
||||||
const toolsToDisplay = computed(() =>
|
const toolsToDisplay = computed(() =>
|
||||||
@@ -40,7 +46,7 @@ const toolsToDisplay = computed(() =>
|
|||||||
<template>
|
<template>
|
||||||
<div class="board-game-tools prose">
|
<div class="board-game-tools prose">
|
||||||
<div class="overflow-x-auto" v-if="isSeitonActivated">
|
<div class="overflow-x-auto" v-if="isSeitonActivated">
|
||||||
<table class="table table-zebra">
|
<table class="table table-md">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Tool</th>
|
<th>Tool</th>
|
||||||
@@ -48,13 +54,15 @@ const toolsToDisplay = computed(() =>
|
|||||||
<th>Used</th>
|
<th>Used</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<transition-group name="list" tag="tbody">
|
||||||
<tr v-for="tool in tools" :key="tool.reference">
|
<tr v-for="tool in tools" :key="tool.reference">
|
||||||
<td>{{ tool.name }}</td>
|
<td>{{ tool.name }}</td>
|
||||||
<td class="numeric">{{ tool.reference }}</td>
|
<td class="numeric">{{ tool.reference }}</td>
|
||||||
<td>{{ boardGameStore.countUsedTools[tool.id] }}</td>
|
<td class="numeric count">
|
||||||
|
{{ boardGameStore.countUsedTools[tool.id] }}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</transition-group>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
@@ -65,6 +73,20 @@ const toolsToDisplay = computed(() =>
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.board-game-tools {
|
.board-game-tools {
|
||||||
flex: 1;
|
.count {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-move, /* apply transition to moving elements */
|
||||||
|
.list-enter-active,
|
||||||
|
.list-leave-active {
|
||||||
|
transition: all 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-enter-from,
|
||||||
|
.list-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(30px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user