Skip to content

Commit

Permalink
feat: Display the article views count in news detail - EXO-74549 - Me…
Browse files Browse the repository at this point in the history
  • Loading branch information
azayati committed Oct 15, 2024
1 parent 63d2d8a commit afbafaa
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@
<span>
{{ newsTitle }}
</span>
<v-tooltip bottom>
<template #activator="{ on, attrs }">
<span v-on="on" v-bind="attrs">
<v-icon size="20" >
fas fa-eye
</v-icon>
<span class="text-subtitle">
{{ newsViews }}
</span>
</span>
</template>
<span class="caption">
{{ newsViewsCount }}
</span>
</v-tooltip>
<span>
<content-translation-menu
:translations="translations"
Expand Down Expand Up @@ -193,6 +208,18 @@ export default {
newsTitle() {
return this.news && this.newsTitleContent;
},
newsViewsCount() {
return `${this.news?.viewsCount} views`;
},
newsViews() {
if (this.news?.viewsCount < 999) {
return this.news?.viewsCount;
}
if (this.news?.viewsCount < 1000000) {
return `${(this.news?.viewsCount / 1000).toFixed(1)}k`;
}
return '+999k';
},
articleUpdater() {
return this.news?.updater || this.news?.author;
},
Expand Down

0 comments on commit afbafaa

Please sign in to comment.