fix(ui): [WIP] import TagsList explicitly

This commit is contained in:
upsiflu 2024-12-09 14:24:52 +01:00
parent c5307fcdcc
commit ebc85d2a19
18 changed files with 60 additions and 44 deletions

View File

@ -2,6 +2,10 @@
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import PlayButton from '~/components/ui/button/Play.vue'
import OptionsButton from '~/components/ui/button/Options.vue'
import Card from '~/components/ui/Card.vue'
import TagsList from '~/components/tags/List.vue'
import type { Album } from '~/types' import type { Album } from '~/types'
@ -19,21 +23,24 @@ const { album } = props
let navigate = (to: 'artist' | 'album') => {} let navigate = (to: 'artist' | 'album') => {}
const artist_credit = album.artist_credit || []
const firstArtist = artist_credit.length > 0 ? artist_credit[0].artist : null
if (import.meta.env.PROD) { if (import.meta.env.PROD) {
const router = useRouter() const router = useRouter()
navigate = (to: 'artist' | 'album') => to === 'album' navigate = (to: 'artist' | 'album') => to === 'album'
? router.push({ name: 'library.albums.detail', params: { id: album.id } }) ? router.push({ name: 'library.albums.detail', params: { id: album.id } })
: router.push({ name: 'library.artists.detail', params: { id: album.artist_credit.artist.id } }) : router.push({ name: 'library.artists.detail', params: { id: firstArtist?.id } })
} }
</script> </script>
<template> <template>
<fw-card <Card
:title="album.title" :title="album.title"
:image="album.cover?.urls.original" :image="album.cover?.urls.original"
class="album-card" class="album-card"
> >
<fw-play-button @play="play(album)" /> <PlayButton @play="play(album)" />
<a <a
v-for="ac in album.artist_credit" v-for="ac in album.artist_credit"
@ -45,7 +52,7 @@ if (import.meta.env.PROD) {
{{ ac.joinphrase }} {{ ac.joinphrase }}
</a> </a>
<tags-list <TagsList
label-classes="tiny" label-classes="tiny"
:truncate-size="20" :truncate-size="20"
:limit="2" :limit="2"
@ -62,23 +69,23 @@ if (import.meta.env.PROD) {
<template #footer> <template #footer>
{{ t('components.audio.album.Card.meta.tracks', album.tracks?.length || 0) }} {{ t('components.audio.album.Card.meta.tracks', album.tracks?.length || 0) }}
<fw-options-button /> <OptionsButton />
</template> </template>
</fw-card> </Card>
</template> </template>
<style scoped> <style scoped>
.funkwhale { .funkwhale {
&.card.album-card { &.card.album-card {
--fw-border-radius: 12px; --fw-border-radius: 12px;
--fw-card-width: 208px; --Card-width: 208px;
--fw-card-image-width: var(--fw-card-width); --Card-image-width: var(--Card-width);
--fw-card-padding: 16px; --Card-padding: 16px;
> .card-image { > .card-image {
border-radius: 0 !important; border-radius: 0 !important;
width: var(--fw-card-image-width); width: var(--Card-image-width);
margin: calc(-1 * var(--fw-card-padding)) calc(-1 * var(--fw-card-padding)) 0; margin: calc(-1 * var(--Card-padding)) calc(-1 * var(--Card-padding)) 0;
} }
> .card-title { > .card-title {

View File

@ -4,6 +4,7 @@ import { computed } from 'vue'
import { useStore } from '~/store' import { useStore } from '~/store'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import TagsList from '~/components/tags/List.vue'
import type { Artist } from '~/types' import type { Artist } from '~/types'
@ -50,7 +51,7 @@ const imageUrl = computed(() => cover.value?.urls.original
> >
<fw-play-button @play="play(artist)" /> <fw-play-button @play="play(artist)" />
<tags-list <TagsList
label-classes="tiny" label-classes="tiny"
:truncate-size="20" :truncate-size="20"
:limit="2" :limit="2"

View File

@ -75,7 +75,7 @@ const updatedAgo = computed(() => moment(props.object.artist?.modification_date)
<span v-else> <span v-else>
{{ t('components.audio.ChannelCard.meta.tracks', object.artist?.tracks_count ?? 0) }} {{ t('components.audio.ChannelCard.meta.tracks', object.artist?.tracks_count ?? 0) }}
</span> </span>
<tags-list <TagsList
label-classes="tiny" label-classes="tiny"
:truncate-size="20" :truncate-size="20"
:limit="2" :limit="2"

View File

@ -1,13 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Artist } from '~/types' import type { Artist } from '~/types'
import PlayButton from '~/components/audio/PlayButton.vue'
import TagsList from '~/components/tags/List.vue'
import { computed } from 'vue' import { computed } from 'vue'
import { useStore } from '~/store' import { useStore } from '~/store'
import { truncate } from '~/utils/filters' import { truncate } from '~/utils/filters'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import PlayButton from '~/components/audio/PlayButton.vue'
import TagsList from '~/components/tags/List.vue'
interface Props { interface Props {
artist: Artist artist: Artist
} }
@ -56,7 +57,7 @@ const imageUrl = computed(() => cover.value?.urls.original
</router-link> </router-link>
</strong> </strong>
<tags-list <TagsList
label-classes="tiny" label-classes="tiny"
:truncate-size="20" :truncate-size="20"
:limit="2" :limit="2"

View File

@ -162,7 +162,7 @@ watch(() => props.websocketHandlers.includes('Listen'), (to) => {
<span v-if="ac.joinphrase">{{ ac.joinphrase }}</span> <span v-if="ac.joinphrase">{{ ac.joinphrase }}</span>
</span> </span>
</div> </div>
<tags-list <TagsList
label-classes="tiny" label-classes="tiny"
:truncate-size="20" :truncate-size="20"
:limit="2" :limit="2"

View File

@ -186,7 +186,7 @@ const remove = async () => {
</div> </div>
</div> </div>
<div class="ui column right aligned"> <div class="ui column right aligned">
<tags-list <TagsList
v-if="object.tags && object.tags.length > 0" v-if="object.tags && object.tags.length > 0"
:tags="object.tags" :tags="object.tags"
/> />
@ -309,7 +309,7 @@ const remove = async () => {
<div class="ui divider" /> <div class="ui divider" />
<div class="ui small hidden divider" /> <div class="ui small hidden divider" />
<template v-if="object.tags && object.tags.length > 0"> <template v-if="object.tags && object.tags.length > 0">
<tags-list :tags="object.tags" /> <TagsList :tags="object.tags" />
<div class="ui small hidden divider" /> <div class="ui small hidden divider" />
</template> </template>
<rendered-description <rendered-description

View File

@ -8,17 +8,17 @@ import { getDomain } from '~/utils'
import { useStore } from '~/store' import { useStore } from '~/store'
import axios from 'axios' import axios from 'axios'
import useReport from '~/composables/moderation/useReport'
import useLogger from '~/composables/useLogger'
import EmbedWizard from '~/components/audio/EmbedWizard.vue' import EmbedWizard from '~/components/audio/EmbedWizard.vue'
import SemanticModal from '~/components/semantic/Modal.vue' import SemanticModal from '~/components/semantic/Modal.vue'
import PlayButton from '~/components/audio/PlayButton.vue' import PlayButton from '~/components/audio/PlayButton.vue'
import RadioButton from '~/components/radios/Button.vue' import RadioButton from '~/components/radios/Button.vue'
import TagsList from '~/components/tags/List.vue'
import Popover from '~/components/ui/Popover.vue' import Popover from '~/components/ui/Popover.vue'
import PopoverItem from '~/components/ui/popover/PopoverItem.vue' import PopoverItem from '~/components/ui/popover/PopoverItem.vue'
import TagsList from '~/components/tags/List.vue'
import useReport from '~/composables/moderation/useReport'
import useLogger from '~/composables/useLogger'
interface Props { interface Props {
id: number id: number
@ -123,7 +123,7 @@ watch(() => props.id, fetchData, { immediate: true })
</div> </div>
</div> </div>
</h2> </h2>
<tags-list <TagsList
v-if="object.tags && object.tags.length > 0" v-if="object.tags && object.tags.length > 0"
:tags="object.tags" :tags="object.tags"
/> />

View File

@ -156,7 +156,7 @@ watchEffect(() => {
</div> </div>
<div class="ten wide column"> <div class="ten wide column">
<template v-if="track.tags && track.tags.length > 0"> <template v-if="track.tags && track.tags.length > 0">
<tags-list :tags="track.tags" /> <TagsList :tags="track.tags" />
<div class="ui hidden divider" /> <div class="ui hidden divider" />
</template> </template>

View File

@ -1,25 +1,28 @@
<script setup lang="ts"> <script setup lang="ts">
import { FwCard, FwOptionsButton } from '~/components'
import { useTimeAgo } from '@vueuse/core' import { useTimeAgo } from '@vueuse/core'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import type { Podcast } from '~/types/models' import type { Channel } from '~/types'
const podcast = defineProp<Podcast>('podcast', { required: true }) import OptionsButton from '~/components/ui/button/Options.vue'
import Card from '~/components/ui/Card.vue'
const timeAgo = useTimeAgo(new Date(podcast.value.artist.modification_date)) const { podcast } = defineProps<{ podcast: Channel }>()
const timeAgo = useTimeAgo(new Date(podcast.artist?.modification_date ?? new Date()))
let navigate = () => {} let navigate = () => {}
if (import.meta.env.PROD) { if (import.meta.env.PROD) {
const router = useRouter() const router = useRouter()
navigate = () => router.push({ name: 'library.artists.detail', params: { id: podcast.value.artist.id } }) navigate = () => router.push({ name: 'library.artists.detail', params: { id: podcast.artist?.id } })
} }
</script> </script>
<template> <template>
<fw-card <Card
:title="podcast.name" :title="podcast.uuid"
:image="podcast.artist.cover.urls.original" :image="podcast.artist?.cover?.urls.original"
@click="navigate" @click="navigate"
class="podcast-card" class="podcast-card"
> >
@ -27,14 +30,14 @@ if (import.meta.env.PROD) {
@click.stop="navigate" @click.stop="navigate"
class="funkwhale link" class="funkwhale link"
> >
{{ podcast.artist.name }} {{ podcast.artist?.name }}
</a> </a>
<template #footer> <template #footer>
{{ timeAgo }} {{ timeAgo }}
<fw-options-button /> <OptionsButton />
</template> </template>
</fw-card> </Card>
</template> </template>
<style lang="scss"> <style lang="scss">

View File

@ -37,7 +37,8 @@ const classes = computed(() => [
</script> </script>
<template> <template>
<Modal <!-- TODO: Replace this file with `components/ui/Modal` -->
<!-- <Modal
:model-value="show" :model-value="show"
@update:model-value="(value) => emit('update:show', value)" @update:model-value="(value) => emit('update:show', value)"
:class="classes" :class="classes"
@ -45,7 +46,8 @@ const classes = computed(() => [
@deny="emit('deny')" @deny="emit('deny')"
@show="emit('show')" @show="emit('show')"
@hide="emit('hide')" @hide="emit('hide')"
> >
<slot /> <slot />
</Modal> </Modal> -->
</template> </template>

View File

@ -3,6 +3,8 @@ import { truncate } from '~/utils/filters'
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import TagsList from '~/components/tags/List.vue'
interface Props { interface Props {
tags: string[] tags: string[]
showMore?: boolean showMore?: boolean

View File

@ -352,7 +352,7 @@ const radioConfig = computed(() => {
:custom-radio="radio" :custom-radio="radio"
/> />
</div> </div>
<tags-list <TagsList
v-else-if="type === 'tags'" v-else-if="type === 'tags'"
:truncate-size="200" :truncate-size="200"
:limit="paginateBy" :limit="paginateBy"

View File

@ -116,7 +116,7 @@ const getQuery = (field: string, value: string) => `${field}:"${value}"`
</div> </div>
</h2> </h2>
<template v-if="object.artist.tags && object.artist.tags.length > 0"> <template v-if="object.artist.tags && object.artist.tags.length > 0">
<tags-list <TagsList
:limit="5" :limit="5"
detail-route="manage.library.tags.detail" detail-route="manage.library.tags.detail"
:tags="object.artist.tags" :tags="object.artist.tags"

View File

@ -117,7 +117,7 @@ const getQuery = (field: string, value: string) => `${field}:"${value}"`
</h2> </h2>
<template v-if="object.tags && object.tags.length > 0"> <template v-if="object.tags && object.tags.length > 0">
<tags-list <TagsList
:limit="5" :limit="5"
detail-route="manage.library.tags.detail" detail-route="manage.library.tags.detail"
:tags="object.tags" :tags="object.tags"

View File

@ -116,7 +116,7 @@ const getQuery = (field: string, value: string) => `${field}:"${value}"`
</div> </div>
</h2> </h2>
<template v-if="object.tags && object.tags.length > 0"> <template v-if="object.tags && object.tags.length > 0">
<tags-list <TagsList
:limit="5" :limit="5"
detail-route="manage.library.tags.detail" detail-route="manage.library.tags.detail"
:tags="object.tags" :tags="object.tags"

View File

@ -117,7 +117,7 @@ const getQuery = (field: string, value: string) => `${field}:"${value}"`
</h2> </h2>
<template v-if="track.tags && track.tags.length > 0"> <template v-if="track.tags && track.tags.length > 0">
<tags-list <TagsList
:limit="5" :limit="5"
detail-route="manage.library.tags.detail" detail-route="manage.library.tags.detail"
:tags="track.tags" :tags="track.tags"

View File

@ -159,7 +159,7 @@ const updateSubscriptionCount = (delta: number) => {
/> />
</div> </div>
<div class="ui column right aligned"> <div class="ui column right aligned">
<tags-list <TagsList
v-if="object.artist?.tags && object.artist?.tags.length > 0" v-if="object.artist?.tags && object.artist?.tags.length > 0"
:tags="object.artist.tags" :tags="object.artist.tags"
/> />

View File

@ -57,7 +57,7 @@ const updatedAgo = computed(() => moment(props.channel.artist?.modification_date
> >
{{ t('components.audio.ChannelCard.meta.tracks', channel.artist?.tracks_count ?? 0) }} {{ t('components.audio.ChannelCard.meta.tracks', channel.artist?.tracks_count ?? 0) }}
</span> </span>
<tags-list <TagsList
style="pointer-events:none;" style="pointer-events:none;"
label-classes="tiny" label-classes="tiny"
:truncate-size="20" :truncate-size="20"