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 {
channel: Channel | null,
filter: 'podcast' | 'music'
filter: 'podcast' | 'music' | undefined,
}
interface QuotaStatus {

View File

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