From a5098c095267559fdbd218daad9141e73e585097 Mon Sep 17 00:00:00 2001 From: upsiflu Date: Thu, 3 Apr 2025 17:02:39 +0200 Subject: [PATCH] fix(front): [WIP] use generated types to make the CI (`lint:tsc`) happy --- front/package.json | 3 +- front/src/components/AboutPod.vue | 36 +++---- front/src/components/admin/SettingsGroup.vue | 18 ++-- front/src/components/album/Card.vue | 2 - front/src/components/artist/Card.vue | 7 +- front/src/components/artist/Widget.vue | 2 +- .../components/audio/ArtistCreditLabel.vue | 4 + front/src/components/audio/ArtistLabel.vue | 2 +- front/src/components/audio/ChannelCard.vue | 2 - front/src/components/audio/ChannelForm.vue | 14 +++ front/src/components/audio/EmbedWizard.vue | 5 +- front/src/components/audio/PlayButton.vue | 11 +- front/src/components/audio/Player.vue | 23 ++-- front/src/components/audio/PlayerControls.vue | 3 +- front/src/components/audio/SearchBar.vue | 101 +----------------- front/src/components/audio/artist/Card.vue | 10 +- .../components/audio/podcast/MobileRow.vue | 2 +- front/src/components/audio/podcast/Modal.vue | 2 +- front/src/components/audio/podcast/Row.vue | 1 + .../src/components/audio/track/MobileRow.vue | 4 +- front/src/components/audio/track/Modal.vue | 2 +- front/src/components/audio/track/Table.vue | 4 +- front/src/components/auth/LoginForm.vue | 2 +- front/src/components/auth/SignupForm.vue | 1 - front/src/components/channels/AlbumSelect.vue | 2 +- front/src/components/channels/UploadForm.vue | 5 +- .../channels/UploadMetadataForm.vue | 1 + front/src/components/common/ActorLink.vue | 6 +- front/src/composables/audio/usePlayOptions.ts | 9 +- front/src/composables/moderation/useReport.ts | 7 +- 30 files changed, 102 insertions(+), 189 deletions(-) diff --git a/front/package.json b/front/package.json index b79415888..1ab02a45f 100644 --- a/front/package.json +++ b/front/package.json @@ -133,5 +133,6 @@ "workbox-precaching": "6.5.4", "workbox-routing": "6.5.4", "workbox-strategies": "6.5.4" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/front/src/components/AboutPod.vue b/front/src/components/AboutPod.vue index 790bf7327..f59eb6209 100644 --- a/front/src/components/AboutPod.vue +++ b/front/src/components/AboutPod.vue @@ -4,8 +4,6 @@ import { useStore } from '~/store' import { get } from 'lodash-es' import { computed } from 'vue' -import type { components } from '~/generated/types.ts' - import useMarkdown from '~/composables/useMarkdown' import { useI18n } from 'vue-i18n' @@ -40,24 +38,14 @@ const federationEnabled = computed(() => { const onDesktop = computed(() => window.innerWidth > 800) -const stats = computed(() => { - const info = nodeinfo.value ?? {} as components['schemas']['NodeInfo20'] - - const data = { - users: get(info, 'usage.users.activeMonth', null), - hours: get(info, 'metadata.content.local.hoursOfContent', null), - artists: get(info, 'metadata.content.local.artists.total', null), - albums: get(info, 'metadata.content.local.albums.total', null), - tracks: get(info, 'metadata.content.local.tracks.total', null), - listenings: get(info, 'metadata.usage.listenings.total', null) - } - - if (data.users === null || data.artists === null) { - return data - } - - return data -}) +const stats = computed(() => ({ + users: nodeinfo.value?.usage.users.activeMonth, + hours: nodeinfo.value?.metadata.content.local.hoursOfContent, + artists: nodeinfo.value?.metadata.content.local.artists, + albums: nodeinfo.value?.metadata.content.local.releases, // TODO: Check where to get 'metadata.content.local.albums.total' + tracks: nodeinfo.value?.metadata.content.local.recordings, // TODO: 'metadata.content.local.tracks.total' + listenings: nodeinfo.value?.metadata.usage?.listenings.total +})) const headerStyle = computed(() => { if (!banner.value) { @@ -341,7 +329,7 @@ const headerStyle = computed(() => { class="statistics-statistic" > - {{ stats.hours.toLocaleString(store.state.ui.momentLocale) }} + {{ stats.hours?.toLocaleString(store.state.ui.momentLocale) }}
{{ t('components.AboutPod.stat.hoursOfMusic', stats.hours) }}
@@ -351,7 +339,7 @@ const headerStyle = computed(() => { class="statistics-statistic" > - {{ stats.artists.toLocaleString(store.state.ui.momentLocale) }} + {{ stats.artists?.toLocaleString(store.state.ui.momentLocale) }}
{{ t('components.AboutPod.stat.artistsCount', stats.artists) }}
@@ -361,7 +349,7 @@ const headerStyle = computed(() => { class="statistics-statistic" > - {{ stats.albums.toLocaleString(store.state.ui.momentLocale) }} + {{ stats.albums?.toLocaleString(store.state.ui.momentLocale) }}
{{ t('components.AboutPod.stat.albumsCount', stats.albums) }}
@@ -371,7 +359,7 @@ const headerStyle = computed(() => { class="statistics-statistic" > - {{ stats.tracks.toLocaleString(store.state.ui.momentLocale) }} + {{ stats.tracks?.toLocaleString(store.state.ui.momentLocale) }}
{{ t('components.AboutPod.stat.tracksCount', stats.tracks) }}
diff --git a/front/src/components/admin/SettingsGroup.vue b/front/src/components/admin/SettingsGroup.vue index 73d79f229..6ce171e6c 100644 --- a/front/src/components/admin/SettingsGroup.vue +++ b/front/src/components/admin/SettingsGroup.vue @@ -107,6 +107,8 @@ const save = async () => {