2018-10-25 06:33:15 +00:00
|
|
|
<!-- eslint-disable -->
|
2018-10-19 05:15:28 +00:00
|
|
|
<template lang="html">
|
2018-11-24 20:49:49 +00:00
|
|
|
<div :class="['game-rating', ratingClass, { 'small': small, dark: settings && settings.nightMode }]">
|
2018-10-25 06:33:15 +00:00
|
|
|
<span class="rating">
|
|
|
|
{{ formattedRating }}
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="4 3 91 111">
|
|
|
|
<path d="M49 3L4 29v52l45 26 46-26V29zm0 95L12 77V34l37-21 38 21v43zm0 0" />
|
|
|
|
</svg>
|
2018-10-19 05:15:28 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-11-02 01:42:43 +00:00
|
|
|
import { mapState } from 'vuex';
|
|
|
|
|
2018-10-19 05:15:28 +00:00
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
rating: Number,
|
|
|
|
small: Boolean,
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2018-11-02 01:42:43 +00:00
|
|
|
...mapState([
|
|
|
|
'settings',
|
|
|
|
]),
|
|
|
|
|
2018-10-19 05:15:28 +00:00
|
|
|
ratingClass() {
|
|
|
|
const gameRating = Number(this.rating);
|
2018-10-25 06:33:15 +00:00
|
|
|
if (gameRating === 100) { return 'master'; }
|
|
|
|
if (gameRating >= 90) { return 'amazing'; }
|
|
|
|
if (gameRating >= 80) { return 'great'; }
|
|
|
|
if (gameRating >= 70) { return 'good'; }
|
|
|
|
if (gameRating >= 60) { return 'okay'; }
|
|
|
|
return 'bad';
|
|
|
|
},
|
|
|
|
|
|
|
|
formattedRating() {
|
|
|
|
return isNaN(this.rating)
|
|
|
|
? '?'
|
|
|
|
: parseInt(this.rating, 10);
|
2018-10-19 05:15:28 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" rel="stylesheet/scss" scoped>
|
|
|
|
@import "~styles/styles.scss";
|
|
|
|
|
2018-10-25 06:33:15 +00:00
|
|
|
.game-rating {
|
2018-10-19 05:15:28 +00:00
|
|
|
width: 100px;
|
2018-10-25 06:33:15 +00:00
|
|
|
height: 115px;
|
|
|
|
position: relative;
|
2018-10-19 05:15:28 +00:00
|
|
|
|
|
|
|
&.small {
|
2018-11-24 20:49:49 +00:00
|
|
|
margin-top: $gp / 2;
|
2018-10-25 06:33:15 +00:00
|
|
|
width: 34px;
|
|
|
|
height: 39px;
|
2018-10-19 05:15:28 +00:00
|
|
|
|
2018-10-25 06:33:15 +00:00
|
|
|
.rating {
|
|
|
|
font-size: 20px;
|
2018-10-19 05:15:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-25 06:33:15 +00:00
|
|
|
&.master { fill: #0e9246; color: #0e9246; }
|
|
|
|
&.amazing { fill: #7dbb42; color: #7dbb42; }
|
|
|
|
&.great { fill: #fecc09; color: #fecc09; }
|
|
|
|
&.good { fill: #f68e1e; color: #f68e1e; }
|
|
|
|
&.okay { fill: #ee4723; color: #ee4723; }
|
|
|
|
&.bad { fill: #bc2025; color: #bc2025; }
|
2018-10-19 05:15:28 +00:00
|
|
|
|
2018-11-02 01:42:43 +00:00
|
|
|
&.dark {
|
|
|
|
fill: $color-dark-gray !important;
|
|
|
|
color: $color-dark-gray !important;
|
|
|
|
}
|
|
|
|
|
2018-10-25 06:33:15 +00:00
|
|
|
.rating {
|
2018-10-19 05:15:28 +00:00
|
|
|
position: absolute;
|
2018-10-25 06:33:15 +00:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
font-size: 48px;
|
|
|
|
font-weight: bold;
|
2018-10-19 05:15:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|