Refactor global styles and enhance MITM functionality

- Updated global CSS to implement a new brand color palette and improve light/dark theme consistency.
- Enhanced the MitmServerCard component to provide clearer user feedback regarding admin privileges.
- Filtered LLM combos in the CombosPage to ensure only relevant data is displayed.
- Improved APIPageClient layout for better usability and visual consistency.
- Added functionality to save and load DNS tool states in the MITM manager.
- Updated OAuth configuration URLs for Qwen to reflect the new endpoint structure.
- Refined tunnel management logic to improve reliability and user experience.
This commit is contained in:
decolua 2026-05-03 18:00:35 +07:00
parent 1686adc704
commit 6cdf40b44e
40 changed files with 1029 additions and 762 deletions

View file

@ -13,6 +13,7 @@ export default function Modal({
size = "md",
closeOnOverlay = true,
showCloseButton = true,
showTrafficLights = true,
className,
}) {
const sizes = {
@ -23,24 +24,18 @@ export default function Modal({
full: "max-w-4xl",
};
// Lock body scroll when modal is open
useEffect(() => {
if (isOpen) {
document.body.style.overflow = "hidden";
} else {
document.body.style.overflow = "";
}
return () => {
document.body.style.overflow = "";
};
return () => { document.body.style.overflow = ""; };
}, [isOpen]);
// Handle escape key
useEffect(() => {
const handleEscape = (e) => {
if (e.key === "Escape" && isOpen) {
onClose();
}
if (e.key === "Escape" && isOpen) onClose();
};
document.addEventListener("keydown", handleEscape);
return () => document.removeEventListener("keydown", handleEscape);
@ -52,7 +47,7 @@ export default function Modal({
<div className="fixed inset-0 z-50 flex items-center justify-center p-4">
{/* Overlay */}
<div
className="absolute inset-0 bg-black/30 backdrop-blur-sm"
className="absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in"
onClick={closeOnOverlay ? onClose : undefined}
/>
@ -60,32 +55,32 @@ export default function Modal({
<div
className={cn(
"relative w-full bg-surface",
"border border-black/10 dark:border-white/10",
"rounded-xl shadow-2xl",
"animate-in fade-in zoom-in-95 duration-200",
"border border-border-subtle",
"rounded-[14px] shadow-[var(--shadow-elev)]",
"fade-in",
sizes[size],
className
)}
>
{/* Header */}
{(title || showCloseButton) && (
<div className="flex items-center justify-between p-2 border-b border-black/5 dark:border-white/5">
<div className="flex items-center justify-between p-2 border-b border-border-subtle">
<div className="flex items-center">
<div className="flex items-center gap-2 mr-4">
<div className="w-3 h-3 rounded-full bg-[#FF5F56]" />
<div className="w-3 h-3 rounded-full bg-[#FFBD2E]" />
<div className="w-3 h-3 rounded-full bg-[#27C93F]" />
</div>
{showTrafficLights && (
<div className="flex items-center gap-2 mr-4 ml-2">
<div className="w-3 h-3 rounded-full bg-[#FF5F56]" />
<div className="w-3 h-3 rounded-full bg-[#FFBD2E]" />
<div className="w-3 h-3 rounded-full bg-[#27C93F]" />
</div>
)}
{title && (
<h2 className="text-lg font-semibold text-text-main">
{title}
</h2>
<h2 className="text-lg font-semibold text-text-main">{title}</h2>
)}
</div>
{showCloseButton && (
<button
onClick={onClose}
className="p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors"
className="p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors"
>
<span className="material-symbols-outlined text-[20px]">close</span>
</button>
@ -94,11 +89,11 @@ export default function Modal({
)}
{/* Body */}
<div className="p-6 max-h-[calc(85vh-100px)] overflow-y-auto">{children}</div>
<div className="p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar">{children}</div>
{/* Footer */}
{footer && (
<div className="flex items-center justify-end gap-3 p-6 border-t border-black/5 dark:border-white/5">
<div className="flex items-center justify-end gap-3 p-6 border-t border-border-subtle">
{footer}
</div>
)}
@ -107,7 +102,6 @@ export default function Modal({
);
}
// Confirm Modal helper
export function ConfirmModal({
isOpen,
onClose,
@ -140,4 +134,3 @@ export function ConfirmModal({
</Modal>
);
}