[WIP] refactor(front): radio pages

This commit is contained in:
ArneBo 2025-01-24 02:15:54 +01:00
parent a87305be1c
commit 6f62b92218
2 changed files with 23 additions and 13 deletions

View File

@ -13,6 +13,7 @@ interface Props {
clientOnly?: boolean clientOnly?: boolean
objectId?: ObjectId | number | string | null objectId?: ObjectId | number | string | null
radioConfig?: RadioConfig | null radioConfig?: RadioConfig | null
playOnly?: boolean
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
@ -20,7 +21,8 @@ const props = withDefaults(defineProps<Props>(), {
type: '', type: '',
clientOnly: false, clientOnly: false,
objectId: null, objectId: null,
radioConfig: null radioConfig: null,
playOnly: false
}) })
const store = useStore() const store = useStore()
@ -70,7 +72,8 @@ const toggleRadio = () => {
objectId: props.objectId, objectId: props.objectId,
customRadioId: props.customRadioId, customRadioId: props.customRadioId,
clientOnly: props.clientOnly, clientOnly: props.clientOnly,
config: props.radioConfig config: props.radioConfig,
playOnly: props.playOnly
}) })
} }
</script> </script>
@ -78,10 +81,12 @@ const toggleRadio = () => {
<template> <template>
<Button <Button
:is-active="running" :is-active="running"
solid primary :primary="!playOnly"
icon="bi-boombox-fill" :secondary="playOnly"
:round="playOnly"
icon="bi-play-fill"
@click="toggleRadio" @click="toggleRadio"
> >
{{ buttonLabel }} <div v-if="!playOnly">{{ buttonLabel }}</div>
</Button> </Button>
</template> </template>

View File

@ -7,6 +7,7 @@ import { useI18n } from 'vue-i18n'
import RadioButton from './Button.vue' import RadioButton from './Button.vue'
import Card from '~/components/ui/Card.vue' import Card from '~/components/ui/Card.vue'
import Button from '~/components/ui/Button.vue'
import Spacer from '~/components/ui/Spacer.vue' import Spacer from '~/components/ui/Spacer.vue'
interface Props { interface Props {
@ -49,23 +50,26 @@ const customRadioId = computed(() => props.customRadio?.id ?? null)
{{ radio.description }} {{ radio.description }}
</div> </div>
<Spacer /> <Spacer />
<template #topright>
<radio-button
:type="type"
:custom-radio-id="customRadioId"
:object-id="objectId"
playOnly
/>
</template>
<div class="extra content"> <div class="extra content">
<user-link <user-link
v-if="radio.user" v-if="radio.user"
:user="radio.user" :user="radio.user"
class="left floated" class="left floated"
/> />
<radio-button
class="right floated button"
:type="type"
:custom-radio-id="customRadioId"
:object-id="objectId"
/>
</div> </div>
<template #action> <template #action>
<Button <Button
v-if="store.state.auth.authenticated && type === 'custom' && radio.user.id === store.state.auth.profile?.id" v-if="store.state.auth.authenticated && type === 'custom' && radio.user.id === store.state.auth.profile?.id"
class="ui success button right floated" primary
full
:to="{name: 'library.radios.edit', params: {id: customRadioId }}" :to="{name: 'library.radios.edit', params: {id: customRadioId }}"
> >
{{ t('components.radios.Card.button.edit') }} {{ t('components.radios.Card.button.edit') }}
@ -99,7 +103,8 @@ const customRadioId = computed(() => props.customRadio?.id ?? null)
<template #action> <template #action>
<Button <Button
v-if="store.state.auth.authenticated && type === 'custom' && radio.user.id === store.state.auth.profile?.id" v-if="store.state.auth.authenticated && type === 'custom' && radio.user.id === store.state.auth.profile?.id"
class="ui success button right floated" primary
full
:to="{name: 'library.radios.edit', params: {id: customRadioId }}" :to="{name: 'library.radios.edit', params: {id: customRadioId }}"
> >
{{ t('components.radios.Card.button.edit') }} {{ t('components.radios.Card.button.edit') }}