Parse like and dislike count to add comma separator (#1796)
* Parse like and dislike count to add comma separator * Use user locale with fallback for like count
This commit is contained in:
parent
7a3aa8ff20
commit
dc26141338
|
@ -198,6 +198,24 @@ export default Vue.extend({
|
||||||
return this.likeCount + this.dislikeCount
|
return this.likeCount + this.dislikeCount
|
||||||
},
|
},
|
||||||
|
|
||||||
|
parsedLikeCount: function () {
|
||||||
|
if (this.hideVideoLikesAndDislikes) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const locale = this.currentLocale.replace('_', '-')
|
||||||
|
return this.likeCount.toLocaleString([locale, 'en'])
|
||||||
|
},
|
||||||
|
|
||||||
|
parsedDislikeCount: function () {
|
||||||
|
if (this.hideVideoLikesAndDislikes) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const locale = this.currentLocale.replace('_', '-')
|
||||||
|
return this.dislikeCount.toLocaleString([locale, 'en'])
|
||||||
|
},
|
||||||
|
|
||||||
likePercentageRatio: function () {
|
likePercentageRatio: function () {
|
||||||
return parseInt(this.likeCount / this.totalLikeCount * 100)
|
return parseInt(this.likeCount / this.totalLikeCount * 100)
|
||||||
},
|
},
|
||||||
|
|
|
@ -56,8 +56,8 @@
|
||||||
:style="{ background: `linear-gradient(to right, var(--accent-color) ${likePercentageRatio}%, #9E9E9E ${likePercentageRatio}%` }"
|
:style="{ background: `linear-gradient(to right, var(--accent-color) ${likePercentageRatio}%, #9E9E9E ${likePercentageRatio}%` }"
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
<span class="likeCount"><font-awesome-icon icon="thumbs-up" /> {{ likeCount }}</span>
|
<span class="likeCount"><font-awesome-icon icon="thumbs-up" /> {{ parsedLikeCount }}</span>
|
||||||
<span class="dislikeCount"><font-awesome-icon icon="thumbs-down" /> {{ dislikeCount }}</span>
|
<span class="dislikeCount"><font-awesome-icon icon="thumbs-down" /> {{ parsedDislikeCount }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue