mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/mihomo-party-org/clash-party.git
synced 2026-09-20 08:03:39 +08:00
feat: add profile delete confirmation
This commit is contained in:
@@ -20,6 +20,7 @@ import { CSS } from '@dnd-kit/utilities'
|
||||
import { openFile } from '@renderer/utils/ipc'
|
||||
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import BaseConfirmModal from '../base/base-confirm-modal'
|
||||
import EditRulesModal from './edit-rules-modal'
|
||||
import EditInfoModal from './edit-info-modal'
|
||||
import EditFileModal from './edit-file-modal'
|
||||
@@ -63,6 +64,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
const [openFileEditor, setOpenFileEditor] = useState(false)
|
||||
const [openRulesEditor, setOpenRulesEditor] = useState(false)
|
||||
const [openQrCode, setOpenQrCode] = useState(false)
|
||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
|
||||
const [dropdownOpen, setDropdownOpen] = useState(false)
|
||||
const {
|
||||
attributes,
|
||||
@@ -156,8 +158,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
break
|
||||
}
|
||||
case 'delete': {
|
||||
await removeProfileItem(info.id)
|
||||
mutateProfileConfig()
|
||||
setShowDeleteConfirm(true)
|
||||
break
|
||||
}
|
||||
|
||||
@@ -240,6 +241,19 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
updateProfileItem={updateProfileItem}
|
||||
/>
|
||||
)}
|
||||
{showDeleteConfirm && (
|
||||
<BaseConfirmModal
|
||||
isOpen={showDeleteConfirm}
|
||||
title={t('profiles.deleteConfirm.title')}
|
||||
content={t('profiles.deleteConfirm.content', { name: info.name })}
|
||||
onCancel={() => setShowDeleteConfirm(false)}
|
||||
onConfirm={async () => {
|
||||
await removeProfileItem(info.id)
|
||||
mutateProfileConfig()
|
||||
setShowDeleteConfirm(false)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Card
|
||||
as="div"
|
||||
@@ -258,10 +272,10 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
onMouseUp={handleMouseUp}
|
||||
>
|
||||
<CardBody className="pb-1">
|
||||
<div className="flex justify-between h-[32px]">
|
||||
<div className="flex justify-between h-8">
|
||||
<h3
|
||||
title={info?.name}
|
||||
className={`text-ellipsis whitespace-nowrap overflow-hidden text-md font-bold leading-[32px] ${isCurrent ? 'text-primary-foreground' : 'text-foreground'}`}
|
||||
className={`text-ellipsis whitespace-nowrap overflow-hidden text-md font-bold leading-8 ${isCurrent ? 'text-primary-foreground' : 'text-foreground'}`}
|
||||
>
|
||||
{info?.name}
|
||||
</h3>
|
||||
@@ -321,7 +335,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
<Button
|
||||
size="sm"
|
||||
variant="light"
|
||||
className={`h-[20px] p-1 m-0 ${isCurrent ? 'text-primary-foreground' : 'text-foreground'}`}
|
||||
className={`h-5 p-1 m-0 ${isCurrent ? 'text-primary-foreground' : 'text-foreground'}`}
|
||||
onPress={async () => {
|
||||
await patchAppConfig({ profileDisplayDate: 'update' })
|
||||
}}
|
||||
@@ -334,7 +348,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
<Button
|
||||
size="sm"
|
||||
variant="light"
|
||||
className={`h-[20px] p-1 m-0 ${isCurrent ? 'text-primary-foreground' : 'text-foreground'}`}
|
||||
className={`h-5 p-1 m-0 ${isCurrent ? 'text-primary-foreground' : 'text-foreground'}`}
|
||||
onPress={async () => {
|
||||
await patchAppConfig({ profileDisplayDate: 'expire' })
|
||||
}}
|
||||
|
||||
@@ -576,6 +576,8 @@
|
||||
"profiles.editRules.noResolve": "Skip DNS Resolution (no-resolve)",
|
||||
"profiles.editRules.src": "Match Source IP (src)",
|
||||
"profiles.openFile": "Open File",
|
||||
"profiles.deleteConfirm.title": "Confirm Subscription Deletion",
|
||||
"profiles.deleteConfirm.content": "Delete subscription \"{{name}}\"? This action cannot be undone.",
|
||||
"profiles.qrCode.title": "Subscription QR Code",
|
||||
"profiles.qrCode.show": "Show QR Code",
|
||||
"profiles.home": "Home",
|
||||
|
||||
@@ -550,6 +550,8 @@
|
||||
"profiles.editRules.noResolve": "رد کردن تحلیل DNS (no-resolve)",
|
||||
"profiles.editRules.src": "مطابقت با IP منبع (src)",
|
||||
"profiles.openFile": "باز کردن فایل",
|
||||
"profiles.deleteConfirm.title": "تایید حذف اشتراک",
|
||||
"profiles.deleteConfirm.content": "اشتراک \"{{name}}\" حذف شود؟ این عمل قابل بازگشت نیست.",
|
||||
"profiles.qrCode.title": "کد QR اشتراک",
|
||||
"profiles.qrCode.show": "نمایش کد QR",
|
||||
"profiles.home": "خانه",
|
||||
|
||||
@@ -552,6 +552,8 @@
|
||||
"profiles.editRules.noResolve": "Пропустить DNS-резолвинг (no-resolve)",
|
||||
"profiles.editRules.src": "Сопоставить исходный IP (src)",
|
||||
"profiles.openFile": "Открыть файл",
|
||||
"profiles.deleteConfirm.title": "Подтвердить удаление подписки",
|
||||
"profiles.deleteConfirm.content": "Удалить подписку \"{{name}}\"? Это действие нельзя отменить.",
|
||||
"profiles.qrCode.title": "QR-код подписки",
|
||||
"profiles.qrCode.show": "Показать QR-код",
|
||||
"profiles.home": "Главная",
|
||||
|
||||
@@ -581,6 +581,8 @@
|
||||
"profiles.editRules.noResolve": "跳过 DNS 解析 (no-resolve)",
|
||||
"profiles.editRules.src": "匹配源 IP (src)",
|
||||
"profiles.openFile": "打开文件",
|
||||
"profiles.deleteConfirm.title": "确认删除订阅",
|
||||
"profiles.deleteConfirm.content": "确定要删除订阅“{{name}}”吗?此操作无法撤销。",
|
||||
"profiles.qrCode.title": "订阅二维码",
|
||||
"profiles.qrCode.show": "显示二维码",
|
||||
"profiles.home": "主页",
|
||||
|
||||
@@ -581,6 +581,8 @@
|
||||
"profiles.editRules.noResolve": "跳過 DNS 解析 (no-resolve)",
|
||||
"profiles.editRules.src": "匹配源 IP (src)",
|
||||
"profiles.openFile": "打開檔案",
|
||||
"profiles.deleteConfirm.title": "確認刪除訂閱",
|
||||
"profiles.deleteConfirm.content": "確定要刪除訂閱「{{name}}」嗎?此操作無法復原。",
|
||||
"profiles.qrCode.title": "訂閱二維碼",
|
||||
"profiles.qrCode.show": "顯示二維碼",
|
||||
"profiles.home": "主頁",
|
||||
|
||||
Reference in New Issue
Block a user