Abbreviating counts in filters.

This commit is contained in:
DebaucheryLibrarian 2024-03-28 01:28:41 +01:00
parent f13b6e1a03
commit 82cd0ac057
5 changed files with 16 additions and 7 deletions

View File

@ -36,14 +36,17 @@
<span <span
v-if="actor.count" v-if="actor.count"
:title="actor.count"
class="filter-count" class="filter-count"
>{{ actor.count }}</span> >{{ abbreviateNumber(actor.count) }}</span>
</span> </span>
</span> </span>
</li> </li>
</template> </template>
<script setup> <script setup>
import abbreviateNumber from '#/src/utils/abbreviate-number.js';
import Gender from '#/components/actors/gender.vue'; import Gender from '#/components/actors/gender.vue';
defineProps({ defineProps({

View File

@ -63,8 +63,9 @@
<span class="filter-details"> <span class="filter-details">
<span <span
v-if="entity.count" v-if="entity.count"
:title="entity.count"
class="filter-count" class="filter-count"
>{{ entity.count }}</span> >{{ abbreviateNumber(entity.count) }}</span>
<Icon <Icon
v-if="filters.entity?.id === entity.id" v-if="filters.entity?.id === entity.id"
@ -83,6 +84,8 @@
<script setup> <script setup>
import { ref, computed, inject } from 'vue'; import { ref, computed, inject } from 'vue';
import abbreviateNumber from '#/src/utils/abbreviate-number.js';
const props = defineProps({ const props = defineProps({
filters: { filters: {
type: Object, type: Object,

View File

@ -86,8 +86,9 @@
<span class="tag-details"> <span class="tag-details">
<span <span
v-if="tag.count" v-if="tag.count"
:title="tag.count"
class="filter-count" class="filter-count"
>{{ tag.count }}</span> >{{ abbreviateNumber(tag.count) }}</span>
</span> </span>
</span> </span>
</li> </li>
@ -99,6 +100,8 @@
<script setup> <script setup>
import { ref, computed, inject } from 'vue'; import { ref, computed, inject } from 'vue';
import abbreviateNumber from '#/src/utils/abbreviate-number.js';
const props = defineProps({ const props = defineProps({
filters: { filters: {
type: Object, type: Object,

View File

@ -126,6 +126,7 @@
import { ref, inject } from 'vue'; import { ref, inject } from 'vue';
import { del, patch } from '#/src/api.js'; import { del, patch } from '#/src/api.js';
import abbreviateNumber from '#/src/utils/abbreviate-number.js';
import Dialog from '#/components/dialog/dialog.vue'; import Dialog from '#/components/dialog/dialog.vue';
@ -150,10 +151,6 @@ const stashNameInput = ref(null);
const showRenameDialog = ref(false); const showRenameDialog = ref(false);
const done = ref(true); const done = ref(true);
function abbreviateNumber(number) {
return number?.toLocaleString('en-US', { notation: 'compact' }) || 0;
}
async function setPublic(isPublic) { async function setPublic(isPublic) {
if (done.value === false) { if (done.value === false) {
return; return;

View File

@ -0,0 +1,3 @@
export default function abbreviateNumber(number) {
return number?.toLocaleString('en-US', { notation: 'compact' }) || 0;
}