feat: add post deletion confirm dialog (#818)
Co-authored-by: 三咲智子 <sxzz@sxzz.moe>
This commit is contained in:
parent
2ff46bb8cb
commit
d76e4bfaa5
6 changed files with 78 additions and 8 deletions
|
@ -1,7 +1,10 @@
|
|||
import type { Attachment, Status, StatusEdit } from 'masto'
|
||||
import type { Draft } from '~/types'
|
||||
import type { ConfirmDialogChoice, ConfirmDialogLabel, Draft } from '~/types'
|
||||
import { STORAGE_KEY_FIRST_VISIT } from '~/constants'
|
||||
|
||||
export const confirmDialogChoice = ref<ConfirmDialogChoice>()
|
||||
export const confirmDialogLabel = ref<ConfirmDialogLabel>()
|
||||
|
||||
export const mediaPreviewList = ref<Attachment[]>([])
|
||||
export const mediaPreviewIndex = ref(0)
|
||||
|
||||
|
@ -18,6 +21,7 @@ export const isMediaPreviewOpen = ref(false)
|
|||
export const isEditHistoryDialogOpen = ref(false)
|
||||
export const isPreviewHelpOpen = ref(isFirstVisit.value)
|
||||
export const isCommandPanelOpen = ref(false)
|
||||
export const isConfirmDialogOpen = ref(false)
|
||||
|
||||
export const lastPublishDialogStatus = ref<Status | null>(null)
|
||||
|
||||
|
@ -25,6 +29,16 @@ export function openSigninDialog() {
|
|||
isSigninDialogOpen.value = true
|
||||
}
|
||||
|
||||
export async function openConfirmDialog(label: ConfirmDialogLabel | string): Promise<ConfirmDialogChoice> {
|
||||
confirmDialogLabel.value = typeof label === 'string' ? { title: label } : label
|
||||
confirmDialogChoice.value = undefined
|
||||
isConfirmDialogOpen.value = true
|
||||
|
||||
await until(isConfirmDialogOpen).toBe(false)
|
||||
|
||||
return confirmDialogChoice.value!
|
||||
}
|
||||
|
||||
export async function openPublishDialog(draftKey = 'dialog', draft?: Draft, overwrite = false): Promise<void> {
|
||||
dialogDraftKey.value = draftKey
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue