feat(front): back button in upload modal on topleft

This commit is contained in:
upsiflu 2025-03-27 10:56:05 +01:00
parent 0c0a02fcd5
commit 1a9245dfec
2 changed files with 20 additions and 11 deletions

View File

@ -89,10 +89,7 @@ onKeyboardShortcut('escape', () => { isOpen.value = false })
section-heading
:class="{'destructive-header': destructive}"
/>
<Spacer
v-if="!$slots.topleft"
grow
/>
<Spacer grow />
<Button
icon="bi-x-lg"
ghost

View File

@ -46,10 +46,18 @@ const state = ref<State>(init())
const pages = ['selectDestination', 'uploadFiles', 'uploadsInProgress'] as const
const goBack = computed(() =>
state.value.page === 'selectDestination'
? undefined
: () => { state.value.page = pages[pages.indexOf(state.value.page) - 1] }
)
// Step 1
const destinationSelected = (destination: UploadDestination) =>
state.value = { ...state.value, uploadDestination: destination, page: 'uploadFiles' }
// Wait for pablo: If no channel exists, auto-create an empty channel
// Step 1.1
@ -71,6 +79,17 @@ const channelUpload = ref()
:cancel="t('components.channels.UploadModal.button.close')"
:title="modalTitle"
>
<template
v-if="goBack"
#topleft
>
<Button
icon="bi-chevron-compact-left"
:title="t('components.channels.UploadModal.button.previous')"
@click="goBack"
/>
<Spacer grow />
</template>
<!-- Page content -->
<!-- Page 1 -->
@ -147,13 +166,6 @@ const channelUpload = ref()
</Layout>
<template #actions>
<Button
v-if="state.page !== pages[0]"
secondary
:on-click="() => { state.page = pages[(pages.indexOf(state.page) || 1) - 1] }"
>
{{ t('components.channels.UploadModal.button.previous') }}
</Button>
<Spacer
h
grow