fix(front): type corrections in upload modal

This commit is contained in:
upsiflu 2025-02-24 01:27:30 +01:00
parent 824b485416
commit a1b837886d
2 changed files with 15 additions and 12 deletions

View File

@ -34,7 +34,7 @@ interface Events {
interface Props { interface Props {
channel: Channel | null, channel: Channel | null,
filter: 'podcast' | 'music' filter: 'podcast' | 'music' | undefined,
} }
interface QuotaStatus { interface QuotaStatus {

View File

@ -22,9 +22,9 @@ import LibraryWidget from '~/components/federation/LibraryWidget.vue'
const { t } = useI18n() const { t } = useI18n()
const store = useStore() const store = useStore()
onKeyboardShortcut('u', () => useModal('upload').toggle()) const { isOpen, toggle } = useModal('upload')
const isOpen = useModal('upload').isOpen onKeyboardShortcut('u', toggle)
type UploadDestination = type UploadDestination =
| { type: 'channel', channel?: Channel | null, filter?: 'podcast' | 'music' } | { type: 'channel', channel?: Channel | null, filter?: 'podcast' | 'music' }
@ -47,7 +47,7 @@ const pages = ['selectDestination', 'uploadFiles', 'uploadsInProgress'] as const
// Step 1 // Step 1
const destinationSelected = (destination: UploadDestination) => const destinationSelected = (destination: UploadDestination) =>
state.value = {...state.value, uploadDestination:destination, page:'uploadFiles' } state.value = {...state.value, uploadDestination: destination, page:'uploadFiles' }
// Wait for pablo: If no channel exists, auto-create an empty channel // Wait for pablo: If no channel exists, auto-create an empty channel
@ -76,6 +76,7 @@ const channelUpload = ref();
<Modal <Modal
:title="modalTitle" :title="modalTitle"
v-model="isOpen" v-model="isOpen"
:cancel="t('components.channels.UploadModal.button.cancel')"
> >
<!-- Page content --> <!-- Page content -->
@ -87,7 +88,7 @@ const channelUpload = ref();
solid solid
title="Music" title="Music"
icon="bi-upload" icon="bi-upload"
@click="destinationSelected('library')" @click="destinationSelected({ type: 'library' })"
> >
<template #image> <template #image>
<i class="bi bi-headphones solid secondary raised" :class="$style.icon"></i> <i class="bi bi-headphones solid secondary raised" :class="$style.icon"></i>
@ -99,7 +100,7 @@ const channelUpload = ref();
title="Music" title="Music"
solid solid
icon="bi-upload primary solid" icon="bi-upload primary solid"
@click="destinationSelected('channel')" @click="destinationSelected({ type: 'channel', filter: 'music' })"
> >
<template #image> <template #image>
<i class="bi bi-music-note-beamed solid primary" :class="$style.icon"></i> <i class="bi bi-music-note-beamed solid primary" :class="$style.icon"></i>
@ -111,7 +112,7 @@ const channelUpload = ref();
solid solid
title="Podcast" title="Podcast"
icon="bi-upload primary solid" icon="bi-upload primary solid"
@click="destinationSelected('podcast')" @click="destinationSelected({ type: 'channel', filter: 'podcast' })"
> >
<template #image> <template #image>
<i class="bi bi-mic-fill solid primary" :class="$style.icon"></i> <i class="bi bi-mic-fill solid primary" :class="$style.icon"></i>
@ -126,13 +127,18 @@ const channelUpload = ref();
<!-- --> <!-- -->
<ChannelUpload ref="channelUpload" v-if="state.uploadDestination === 'channel'" /> <ChannelUpload
ref="channelUpload"
v-if="state.uploadDestination?.type === 'channel'"
:filter="state.uploadDestination.filter"
:channel="null"
/>
<!-- --> <!-- -->
<!-- Privacy Slider --> <!-- Privacy Slider -->
<LibraryUpload <LibraryUpload
v-if="state.uploadDestination === 'library'" v-if="state.uploadDestination?.type === 'library'"
v-model="privacyLevel"> v-model="privacyLevel">
</LibraryUpload> </LibraryUpload>
{{ state.files }} {{ state.files }}
@ -145,9 +151,6 @@ const channelUpload = ref();
{{ t('components.channels.UploadModal.button.previous') }} {{ t('components.channels.UploadModal.button.previous') }}
</Button> </Button>
<Spacer h grow /> <Spacer h grow />
<Button secondary :onClick="() => { isOpen = false }">
{{ t('components.channels.UploadModal.button.cancel') }}
</Button>
<Spacer size-16 /> <Spacer size-16 />
<Button primary v-if="state.page === 'uploadFiles'"> <Button primary v-if="state.page === 'uploadFiles'">
{{ t('components.channels.UploadModal.button.finishLater') }} / {{ t('components.channels.UploadModal.button.finishLater') }} /