Release NapCat / validate-version (push) Canceled after 0s
Release NapCat / Build-Framework (push) Canceled after 0s
Release NapCat / Build-Shell (push) Canceled after 0s
Release NapCat / Download-QNX64 (push) Canceled after 0s
Release NapCat / release-napcat (push) Canceled after 0s
* feat: 优化离线重连机制,增加前端登录错误提示与二维码刷新功能 - 增加全局掉线检测弹窗 - 增强登录错误解析,支持显示 serverErrorCode 和 message - 优化二维码登录 UI,错误时显示详细原因并提供大按钮重新获取 - 核心层解耦,通过事件抛出 KickedOffLine 通知 - 支持前端点击刷新二维码接口 * feat: 新增看门狗汪汪汪 * cp napcat-shell-loader/launcher-win.bat * refactor: 重构重启流程,移除旧的重启逻辑,新增基于 WebUI 的重启请求处理 * fix: 刷新二维码清楚错误信息
102 lines
2.4 KiB
TypeScript
102 lines
2.4 KiB
TypeScript
import { Button } from '@heroui/button';
|
|
import {
|
|
ModalBody,
|
|
ModalContent,
|
|
ModalFooter,
|
|
ModalHeader,
|
|
Modal as NextUIModal,
|
|
useDisclosure,
|
|
} from '@heroui/modal';
|
|
import React from 'react';
|
|
|
|
export interface ModalProps {
|
|
content: React.ReactNode;
|
|
title?: React.ReactNode;
|
|
size?: React.ComponentProps<typeof NextUIModal>['size'];
|
|
scrollBehavior?: React.ComponentProps<typeof NextUIModal>['scrollBehavior'];
|
|
onClose?: () => void;
|
|
onConfirm?: () => void;
|
|
onCancel?: () => void;
|
|
backdrop?: 'opaque' | 'blur' | 'transparent';
|
|
showCancel?: boolean;
|
|
dismissible?: boolean;
|
|
confirmText?: string;
|
|
cancelText?: string;
|
|
hideFooter?: boolean;
|
|
}
|
|
|
|
const Modal: React.FC<ModalProps> = React.memo((props) => {
|
|
const {
|
|
backdrop = 'blur',
|
|
title,
|
|
content,
|
|
showCancel = true,
|
|
dismissible,
|
|
confirmText = '确定',
|
|
cancelText = '取消',
|
|
hideFooter = false,
|
|
onClose,
|
|
onConfirm,
|
|
onCancel,
|
|
...rest
|
|
} = props;
|
|
const { onClose: onNativeClose } = useDisclosure();
|
|
|
|
return (
|
|
<NextUIModal
|
|
defaultOpen
|
|
backdrop={backdrop}
|
|
isDismissable={dismissible}
|
|
onClose={() => {
|
|
onClose?.();
|
|
onNativeClose();
|
|
}}
|
|
classNames={{
|
|
backdrop: 'z-[99] backdrop-blur-sm',
|
|
wrapper: 'z-[99]',
|
|
}}
|
|
{...rest}
|
|
>
|
|
<ModalContent>
|
|
{(nativeClose) => (
|
|
<>
|
|
{title && (
|
|
<ModalHeader className='flex flex-col gap-1'>{title}</ModalHeader>
|
|
)}
|
|
<ModalBody className='break-all'>{content}</ModalBody>
|
|
{!hideFooter && (
|
|
<ModalFooter>
|
|
{showCancel && (
|
|
<Button
|
|
color='primary'
|
|
variant='light'
|
|
onPress={() => {
|
|
onCancel?.();
|
|
nativeClose();
|
|
}}
|
|
>
|
|
{cancelText}
|
|
</Button>
|
|
)}
|
|
<Button
|
|
color='primary'
|
|
onPress={() => {
|
|
onConfirm?.();
|
|
nativeClose();
|
|
}}
|
|
>
|
|
{confirmText}
|
|
</Button>
|
|
</ModalFooter>
|
|
)}
|
|
</>
|
|
)}
|
|
</ModalContent>
|
|
</NextUIModal>
|
|
);
|
|
});
|
|
|
|
Modal.displayName = 'Modal';
|
|
|
|
export default Modal;
|