style: 美化用户隧道权限分配表单UI并统一代码格式

- 使用HeroUI Checkbox组件替换原生checkbox

- 重构隧道列表为card-based tile风格

- 添加选中/未选中/已分配状态视觉区分

- 应用eslint --fix代码格式统一

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
root
2026-02-04 02:22:28 +00:00
parent 72c2e28667
commit 6f6fececa8
31 changed files with 8080 additions and 5740 deletions
+35 -14
View File
@@ -5,9 +5,9 @@ import {
NavbarBrand,
NavbarContent,
} from "@heroui/navbar";
import { isWebViewFunc } from '@/utils/panel';
import { useNavigate } from "react-router-dom";
import { isWebViewFunc } from "@/utils/panel";
import { Logo } from "@/components/icons";
import { siteConfig, getCachedConfig } from "@/config/site";
@@ -20,21 +20,21 @@ export const Navbar = () => {
// 检测是否在WebView中运行
useEffect(() => {
setIsWebView(isWebViewFunc());
}, []);
useEffect(() => {
// 异步检查是否有更新的配置
const checkForUpdates = async () => {
try {
const cachedAppName = await getCachedConfig('app_name');
const cachedAppName = await getCachedConfig("app_name");
if (cachedAppName && cachedAppName !== appName) {
setAppName(cachedAppName);
// 同步更新siteConfig
siteConfig.name = cachedAppName;
}
} catch (error) {
console.warn('检查配置更新失败:', error);
console.warn("检查配置更新失败:", error);
}
};
@@ -44,27 +44,33 @@ export const Navbar = () => {
// 监听配置更新事件
const handleConfigUpdate = async () => {
try {
const cachedAppName = await getCachedConfig('app_name');
const cachedAppName = await getCachedConfig("app_name");
if (cachedAppName) {
setAppName(cachedAppName);
siteConfig.name = cachedAppName;
}
} catch (error) {
console.warn('更新配置失败:', error);
console.warn("更新配置失败:", error);
}
};
window.addEventListener('configUpdated', handleConfigUpdate);
window.addEventListener("configUpdated", handleConfigUpdate);
return () => {
clearTimeout(timer);
window.removeEventListener('configUpdated', handleConfigUpdate);
window.removeEventListener("configUpdated", handleConfigUpdate);
};
}, [appName]);
return (
<>
<HeroUINavbar maxWidth="xl" position="sticky" height="60px" className="shrink-0">
<HeroUINavbar
className="shrink-0"
height="60px"
maxWidth="xl"
position="sticky"
>
<NavbarContent className="basis-1/5 sm:basis-full" justify="start">
<NavbarBrand className="gap-2 max-w-fit">
<Link
@@ -83,12 +89,27 @@ export const Navbar = () => {
{isWebView && (
<button
className="p-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"
onClick={() => navigate('/settings')}
title="面板设置"
onClick={() => navigate("/settings")}
>
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<svg
className="w-5 h-5"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
/>
<path
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
/>
</svg>
</button>
)}