mirror of
https://github.com/romancm/gamebrary
synced 2024-11-27 13:40:48 +00:00
simplify game progress logic
This commit is contained in:
parent
a17f84b49b
commit
ac032efb6d
5 changed files with 29 additions and 21 deletions
|
@ -30,7 +30,7 @@
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<b-progress
|
<b-progress
|
||||||
v-if="showGameProgress"
|
v-if="gameProgress > 0"
|
||||||
:value="gameProgress"
|
:value="gameProgress"
|
||||||
class="my-2"
|
class="my-2"
|
||||||
variant="success"
|
variant="success"
|
||||||
|
|
|
@ -26,21 +26,33 @@
|
||||||
title-tag="h6"
|
title-tag="h6"
|
||||||
>
|
>
|
||||||
{{ game.name }}
|
{{ game.name }}
|
||||||
|
|
||||||
<b-badge variant="warning" v-if="gameNotes">
|
|
||||||
<i class="far fa-sticky-note fa-fw" />
|
|
||||||
</b-badge>
|
|
||||||
</b-card-title>
|
</b-card-title>
|
||||||
|
|
||||||
<b-progress
|
<div class="game-info bg-dark">
|
||||||
v-if="showGameProgress"
|
<small class="text-muted" v-if="gameProgress > 0">
|
||||||
|
<i v-if="gameProgress == 100" class="fas fa-check fa-fw" aria-hidden />
|
||||||
|
<span v-else>{{ gameProgress }}%</span>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<b-badge variant="warning" v-if="gameNotes">
|
||||||
|
<i class="far fa-sticky-note fa-fw" />
|
||||||
|
</b-badge>
|
||||||
|
|
||||||
|
<!-- <b-progress
|
||||||
|
v-if="gameProgress > 0"
|
||||||
:value="gameProgress"
|
:value="gameProgress"
|
||||||
class="my-2"
|
class="my-2"
|
||||||
variant="success"
|
variant="success"
|
||||||
height="6px"
|
height="6px"
|
||||||
/>
|
/> -->
|
||||||
|
|
||||||
<div v-if="showGameTags">
|
<b-badge variant="primary" v-if="showGameTags">
|
||||||
|
<i class="fas fa-tags fa-fw" aria-hidden />
|
||||||
|
</b-badge>
|
||||||
|
|
||||||
|
<!-- TODO: use array filter instead of mixing v-for and v-if -->
|
||||||
|
<!-- <div v-if="showGameTags">
|
||||||
<b-badge
|
<b-badge
|
||||||
v-for="({ games, hex, tagTextColor }, name) in tags"
|
v-for="({ games, hex, tagTextColor }, name) in tags"
|
||||||
v-if="games.includes(game.id)"
|
v-if="games.includes(game.id)"
|
||||||
|
@ -52,7 +64,7 @@
|
||||||
>
|
>
|
||||||
{{ name }}
|
{{ name }}
|
||||||
</b-badge>
|
</b-badge>
|
||||||
</div>
|
</div> -->
|
||||||
</b-card-body>
|
</b-card-body>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
</b-card-title>
|
</b-card-title>
|
||||||
|
|
||||||
<b-progress
|
<b-progress
|
||||||
v-if="showGameProgress"
|
v-if="gameProgress > 0"
|
||||||
:value="gameProgress"
|
:value="gameProgress"
|
||||||
class="my-2"
|
class="my-2"
|
||||||
variant="success"
|
variant="success"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<b-progress
|
<b-progress
|
||||||
v-if="showGameProgress"
|
v-if="gameProgress > 0"
|
||||||
:value="gameProgress"
|
:value="gameProgress"
|
||||||
class="my-1"
|
class="my-1"
|
||||||
variant="success"
|
variant="success"
|
||||||
|
|
|
@ -14,15 +14,11 @@ export default {
|
||||||
...mapGetters(['gameTags']),
|
...mapGetters(['gameTags']),
|
||||||
|
|
||||||
highlightCompletedGame() {
|
highlightCompletedGame() {
|
||||||
const { settings } = this.list;
|
return this.gameProgress && Number(this.gameProgress) === 100;
|
||||||
|
|
||||||
return settings.highlightCompletedGames
|
|
||||||
&& this.gameProgress
|
|
||||||
&& Number(this.gameProgress) === 100;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showGameProgress() {
|
showGameProgress() {
|
||||||
return this.gameProgress && Number(this.gameProgress) < 100;
|
return this.gameProgress > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
showGameTags() {
|
showGameTags() {
|
||||||
|
@ -32,11 +28,11 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
gameProgress() {
|
gameProgress() {
|
||||||
const { gameId, progresses, list: { settings } } = this;
|
const { gameId, progresses } = this;
|
||||||
|
|
||||||
return settings && settings.showGameProgress && gameId && progresses[gameId]
|
return gameId && progresses[gameId]
|
||||||
? progresses[gameId]
|
? progresses[gameId]
|
||||||
: null;
|
: 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
gameNotes() {
|
gameNotes() {
|
||||||
|
|
Loading…
Reference in a new issue