feat(front): dangerous button can be popoveritem
This commit is contained in:
parent
b8d4cb2aba
commit
69dd143486
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import Button from '~/components/ui/Button.vue'
|
import Button from '~/components/ui/Button.vue'
|
||||||
import Modal from '~/components/ui/Modal.vue'
|
import Modal from '~/components/ui/Modal.vue'
|
||||||
|
import PopoverItem from '~/components/ui/popover/PopoverItem.vue'
|
||||||
|
|
||||||
interface Events {
|
interface Events {
|
||||||
(e: 'confirm'): void
|
(e: 'confirm'): void
|
||||||
|
@ -13,7 +14,8 @@ interface Events {
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
title?: string
|
title?: string
|
||||||
action?: () => void,
|
action?: () => void,
|
||||||
confirmColor?:'success' | 'danger'
|
confirmColor?:'success' | 'danger',
|
||||||
|
popoverItem?: true
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
@ -30,9 +32,10 @@ const confirm = () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Button
|
<component :is="'popoverItem' in props ? PopoverItem : Button"
|
||||||
destructive
|
destructive
|
||||||
@click.prevent.stop="showModal = true"
|
@click.prevent.stop="showModal = true"
|
||||||
|
v-bind="$attrs"
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
|
|
||||||
|
@ -58,5 +61,5 @@ const confirm = () => {
|
||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
</Modal>
|
</Modal>
|
||||||
</Button>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { onBeforeRouteUpdate, useRoute, useRouter } from 'vue-router'
|
||||||
import { computed, ref, reactive, watch, watchEffect } from 'vue'
|
import { computed, ref, reactive, watch, watchEffect } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useStore } from '~/store'
|
import { useStore } from '~/store'
|
||||||
|
import { useModal } from '~/ui/composables/useModal.ts'
|
||||||
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ import RadioButton from '~/components/radios/Button.vue'
|
||||||
|
|
||||||
import Loader from '~/components/ui/Loader.vue'
|
import Loader from '~/components/ui/Loader.vue'
|
||||||
import Button from '~/components/ui/Button.vue'
|
import Button from '~/components/ui/Button.vue'
|
||||||
|
import Link from '~/components/ui/Link.vue'
|
||||||
import Tabs from '~/components/ui/Tabs.vue'
|
import Tabs from '~/components/ui/Tabs.vue'
|
||||||
import Tab from '~/components/ui/Tab.vue'
|
import Tab from '~/components/ui/Tab.vue'
|
||||||
import OptionsButton from '~/components/ui/button/Options.vue'
|
import OptionsButton from '~/components/ui/button/Options.vue'
|
||||||
|
@ -243,14 +245,15 @@ const updateSubscriptionCount = (delta: number) => {
|
||||||
@updated="object = $event"
|
@updated="object = $event"
|
||||||
/>
|
/>
|
||||||
<Layout flex class="header-buttons">
|
<Layout flex class="header-buttons">
|
||||||
<Button
|
<Link
|
||||||
v-if="isOwner"
|
v-if="isOwner"
|
||||||
|
solid
|
||||||
primary
|
primary
|
||||||
icon="bi-upload"
|
icon="bi-upload"
|
||||||
@click.prevent.stop="store.commit('channels/showUploadModal', {show: true, config: {channel: object}})"
|
:to="useModal('upload').to"
|
||||||
>
|
>
|
||||||
{{ t('views.channels.DetailBase.button.upload') }}
|
{{ t('views.channels.DetailBase.button.upload') }}
|
||||||
</Button>
|
</Link>
|
||||||
<PlayButton
|
<PlayButton
|
||||||
:is-playable="isPlayable"
|
:is-playable="isPlayable"
|
||||||
split
|
split
|
||||||
|
@ -306,11 +309,12 @@ const updateSubscriptionCount = (delta: number) => {
|
||||||
</PopoverItem>
|
</PopoverItem>
|
||||||
<dangerous-button
|
<dangerous-button
|
||||||
v-if="object"
|
v-if="object"
|
||||||
:title="t('views.channels.DetailBase.button.delete')"
|
popover-item
|
||||||
|
:title="t('views.channels.DetailBase.button.confirm')"
|
||||||
:is-loading="isLoading"
|
:is-loading="isLoading"
|
||||||
icon="bi-trash"
|
icon="bi-trash"
|
||||||
@confirm="remove()"
|
@confirm="remove()"
|
||||||
>
|
> {{ t('views.channels.DetailBase.button.confirm') }}
|
||||||
<template #modal-content>
|
<template #modal-content>
|
||||||
{{ t('views.channels.DetailBase.modal.delete.content.warning') }}
|
{{ t('views.channels.DetailBase.modal.delete.content.warning') }}
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue