[web] Rename formatters library

This commit is contained in:
Alain Nussbaumer
2025-05-04 12:20:26 +02:00
parent ce3db11cfd
commit ae50fe548f
17 changed files with 51 additions and 51 deletions

View File

@@ -8,7 +8,7 @@
:lines="[
item.item.name,
item.item.artist,
$filters.toDate(item.item.date_released)
$formatters.toDate(item.item.date_released)
]"
@open="open(item.item)"
@open-details="openDetails(item.item)"

View File

@@ -8,7 +8,7 @@
:lines="[
item.name,
item.artists[0]?.name,
$filters.toDate(item.release_date)
$formatters.toDate(item.release_date)
]"
@open="open(item)"
@open-details="openDetails(item)"

View File

@@ -89,13 +89,13 @@ export default {
},
{
key: 'property.release-date',
value: this.$filters.toDate(this.item.date_released)
value: this.$formatters.toDate(this.item.date_released)
},
{ key: 'property.year', value: this.item.year },
{ key: 'property.tracks', value: this.item.track_count },
{
key: 'property.duration',
value: this.$filters.toTimecode(this.item.length_ms)
value: this.$formatters.toTimecode(this.item.length_ms)
},
{
key: 'property.type',
@@ -103,7 +103,7 @@ export default {
},
{
key: 'property.added-on',
value: this.$filters.toDateTime(this.item.time_added)
value: this.$formatters.toDateTime(this.item.time_added)
}
],
uri: this.item.uri

View File

@@ -27,7 +27,7 @@ export default {
},
{
key: 'property.release-date',
value: this.$filters.toDate(this.item.release_date)
value: this.$formatters.toDate(this.item.release_date)
},
{ key: 'property.type', value: this.item.album_type }
],

View File

@@ -27,7 +27,7 @@ export default {
},
{
key: 'property.added-on',
value: this.$filters.toDateTime(this.item.time_added)
value: this.$formatters.toDateTime(this.item.time_added)
}
],
uri: this.item.uri

View File

@@ -32,7 +32,7 @@ export default {
},
{
key: 'property.duration',
value: this.$filters.toTimecode(this.item.length_ms)
value: this.$formatters.toTimecode(this.item.length_ms)
}
]
}

View File

@@ -28,7 +28,7 @@ export default {
{ key: 'property.tracks', value: this.item.track_count },
{
key: 'property.duration',
value: this.$filters.toTimecode(this.item.length_ms)
value: this.$formatters.toTimecode(this.item.length_ms)
}
]
}

View File

@@ -66,7 +66,7 @@ export default {
},
{
key: 'property.duration',
value: this.$filters.toTimecode(this.item.length_ms)
value: this.$formatters.toTimecode(this.item.length_ms)
},
{ key: 'property.path', value: this.item.path },
{

View File

@@ -42,7 +42,7 @@ export default {
{ key: 'property.composer', value: this.item.composer },
{
key: 'property.release-date',
value: this.$filters.toDate(this.item.date_released)
value: this.$formatters.toDate(this.item.date_released)
},
{ key: 'property.year', value: this.item.year },
{ key: 'property.genre', value: this.item.genre },
@@ -56,7 +56,7 @@ export default {
key: 'property.duration',
value:
this.item.length_ms > 0 &&
this.$filters.toTimecode(this.item.length_ms)
this.$formatters.toTimecode(this.item.length_ms)
},
{
key: 'property.type',
@@ -75,7 +75,7 @@ export default {
},
{
key: 'property.added-on',
value: this.$filters.toDateTime(this.item.time_added)
value: this.$formatters.toDateTime(this.item.time_added)
},
{
key: 'property.rating',

View File

@@ -34,7 +34,7 @@ export default {
},
{
key: 'property.release-date',
value: this.$filters.toDate(this.item.album.release_date)
value: this.$formatters.toDate(this.item.album.release_date)
},
{
key: 'property.position',
@@ -42,7 +42,7 @@ export default {
},
{
key: 'property.duration',
value: this.$filters.toTimecode(this.item.duration_ms)
value: this.$formatters.toTimecode(this.item.duration_ms)
},
{ key: 'property.path', value: this.item.uri }
],

View File

@@ -4,7 +4,7 @@ import i18n from '@/i18n'
const { locale } = i18n.global
const unit = ['years', 'months', 'days', 'hours', 'minutes']
export const filters = {
export default {
toDate(value) {
if (value) {
return DateTime.fromISO(value, { locale: locale.value }).toLocaleString(

View File

@@ -5,7 +5,7 @@ import VueLazyLoad from 'vue3-lazyload'
import VueProgressBar from '@aacassandra/vue3-progressbar'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { filters } from './filter'
import formatters from './lib/Formatters.js'
import i18n from './i18n'
import { icons } from './icons'
import mdiVue from 'mdi-vue/v3'
@@ -20,5 +20,5 @@ const app = createApp(App)
.use(mdiVue, { icons })
.use(i18n)
app.config.globalProperties.$filters = filters
app.config.globalProperties.$formatters = formatters
app.mount('#app')

View File

@@ -119,17 +119,19 @@ export default {
},
{
key: 'property.playtime',
value: this.$filters.toDuration(this.libraryStore.db_playtime)
value: this.$formatters.toDuration(this.libraryStore.db_playtime)
},
{
alternate: this.$filters.toDateTime(this.libraryStore.updated_at),
alternate: this.$formatters.toDateTime(this.libraryStore.updated_at),
key: 'property.updated',
value: this.$filters.toRelativeDuration(this.libraryStore.updated_at)
value: this.$formatters.toRelativeDuration(
this.libraryStore.updated_at
)
},
{
alternate: this.$filters.toDateTime(this.libraryStore.started_at),
alternate: this.$formatters.toDateTime(this.libraryStore.started_at),
key: 'property.uptime',
value: this.$filters.toDurationToNow(this.libraryStore.started_at)
value: this.$formatters.toDurationToNow(this.libraryStore.started_at)
}
]
}

View File

@@ -115,7 +115,7 @@ export default {
return this.queueStore.current
},
trackElapsedTime() {
return this.$filters.toTimecode(this.trackProgress * INTERVAL)
return this.$formatters.toTimecode(this.trackProgress * INTERVAL)
},
trackProgress: {
get() {
@@ -131,7 +131,7 @@ export default {
trackTotalTime() {
return this.$t('page.now-playing.time', this.track.length_ms, {
named: {
time: this.$filters.toTimecode(this.track.length_ms)
time: this.$formatters.toTimecode(this.track.length_ms)
}
})
}

View File

@@ -16,9 +16,7 @@
<div>
<nav class="level is-clipped">
<div class="level-left">
<div
class="level-item has-text-centered-mobile"
>
<div class="level-item has-text-centered-mobile">
<div>
<slot name="heading" />
</div>