mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-26 23:30:09 +08:00
fix: align backup dialogs with in-app modal behavior
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
} from '@mui/material'
|
||||
import { useEffect } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
interface Props {
|
||||
open: boolean
|
||||
title: string
|
||||
message: string
|
||||
onClose: () => void
|
||||
onConfirm: () => void
|
||||
}
|
||||
|
||||
export const ConfirmViewer = (props: Props) => {
|
||||
const { open, title, message, onClose, onConfirm } = props
|
||||
|
||||
const { t } = useTranslation()
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
}, [open])
|
||||
|
||||
return (
|
||||
<Dialog open={open} onClose={onClose} maxWidth="xs" fullWidth>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
|
||||
<DialogContent sx={{ pb: 1, userSelect: 'text' }}>
|
||||
{message}
|
||||
</DialogContent>
|
||||
|
||||
<DialogActions>
|
||||
<Button onClick={onClose} variant="outlined">
|
||||
{t('shared.actions.cancel')}
|
||||
</Button>
|
||||
<Button onClick={onConfirm} variant="contained">
|
||||
{t('shared.actions.confirm')}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import dayjs from 'dayjs'
|
||||
import { useCallback, useEffect, useReducer, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import { ConfirmViewer } from '@/components/profile/confirm-viewer'
|
||||
import { BaseDialog } from '@/components/base'
|
||||
import { EditorViewer } from '@/components/profile/editor-viewer'
|
||||
import { GroupsEditorViewer } from '@/components/profile/groups-editor-viewer'
|
||||
import { RulesEditorViewer } from '@/components/profile/rules-editor-viewer'
|
||||
@@ -990,16 +990,23 @@ export const ProfileItem = (props: Props) => {
|
||||
/>
|
||||
)}
|
||||
|
||||
<ConfirmViewer
|
||||
<BaseDialog
|
||||
title={t('profiles.modals.confirmDelete.title')}
|
||||
message={t('profiles.modals.confirmDelete.message')}
|
||||
open={confirmOpen}
|
||||
okBtn={t('shared.actions.confirm')}
|
||||
cancelBtn={t('shared.actions.cancel')}
|
||||
contentSx={{ width: { xs: 320, sm: 420 }, userSelect: 'text' }}
|
||||
onCancel={() => setConfirmOpen(false)}
|
||||
onClose={() => setConfirmOpen(false)}
|
||||
onConfirm={() => {
|
||||
onOk={() => {
|
||||
onDelete()
|
||||
setConfirmOpen(false)
|
||||
}}
|
||||
/>
|
||||
>
|
||||
<Typography variant="body2" sx={{ wordBreak: 'break-word' }}>
|
||||
{t('profiles.modals.confirmDelete.message')}
|
||||
</Typography>
|
||||
</BaseDialog>
|
||||
{qrOpen && itemData.url && (
|
||||
<QrViewer
|
||||
open={true}
|
||||
|
||||
Reference in New Issue
Block a user