[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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ export default {
}, },
{ {
key: 'property.release-date', 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 } { key: 'property.type', value: this.item.album_type }
], ],

View File

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

View File

@ -32,7 +32,7 @@ export default {
}, },
{ {
key: 'property.duration', 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.tracks', value: this.item.track_count },
{ {
key: 'property.duration', 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', 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 }, { key: 'property.path', value: this.item.path },
{ {

View File

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

View File

@ -34,7 +34,7 @@ export default {
}, },
{ {
key: 'property.release-date', 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', key: 'property.position',
@ -42,7 +42,7 @@ export default {
}, },
{ {
key: 'property.duration', 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 } { key: 'property.path', value: this.item.uri }
], ],

View File

@ -4,7 +4,7 @@ import i18n from '@/i18n'
const { locale } = i18n.global const { locale } = i18n.global
const unit = ['years', 'months', 'days', 'hours', 'minutes'] const unit = ['years', 'months', 'days', 'hours', 'minutes']
export const filters = { export default {
toDate(value) { toDate(value) {
if (value) { if (value) {
return DateTime.fromISO(value, { locale: locale.value }).toLocaleString( 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 VueProgressBar from '@aacassandra/vue3-progressbar'
import { createApp } from 'vue' import { createApp } from 'vue'
import { createPinia } from 'pinia' import { createPinia } from 'pinia'
import { filters } from './filter' import formatters from './lib/Formatters.js'
import i18n from './i18n' import i18n from './i18n'
import { icons } from './icons' import { icons } from './icons'
import mdiVue from 'mdi-vue/v3' import mdiVue from 'mdi-vue/v3'
@ -20,5 +20,5 @@ const app = createApp(App)
.use(mdiVue, { icons }) .use(mdiVue, { icons })
.use(i18n) .use(i18n)
app.config.globalProperties.$filters = filters app.config.globalProperties.$formatters = formatters
app.mount('#app') app.mount('#app')

View File

@ -119,17 +119,19 @@ export default {
}, },
{ {
key: 'property.playtime', 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', 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', 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 return this.queueStore.current
}, },
trackElapsedTime() { trackElapsedTime() {
return this.$filters.toTimecode(this.trackProgress * INTERVAL) return this.$formatters.toTimecode(this.trackProgress * INTERVAL)
}, },
trackProgress: { trackProgress: {
get() { get() {
@ -131,7 +131,7 @@ export default {
trackTotalTime() { trackTotalTime() {
return this.$t('page.now-playing.time', this.track.length_ms, { return this.$t('page.now-playing.time', this.track.length_ms, {
named: { named: {
time: this.$filters.toTimecode(this.track.length_ms) time: this.$formatters.toTimecode(this.track.length_ms)
} }
}) })
} }

View File

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