fix: remove nested button element in NextUI Card component

This commit is contained in:
pompurin404 2025-02-03 07:30:33 +08:00
parent e746ab4241
commit 77b67849ed
7 changed files with 1477 additions and 952 deletions

View File

@ -26,6 +26,7 @@
"@electron-toolkit/preload": "^3.0.1",
"@electron-toolkit/utils": "^3.0.0",
"@mihomo-party/sysproxy": "^2.0.7",
"@mihomo-party/sysproxy-darwin-arm64": "^2.0.7",
"@nextui-org/react": "2.6.10",
"@types/crypto-js": "^4.2.2",
"adm-zip": "^0.5.16",
@ -57,7 +58,7 @@
"autoprefixer": "^10.4.20",
"cron-validator": "^1.3.1",
"driver.js": "^1.3.1",
"electron": "^33.1.0",
"electron": "^33.3.2",
"electron-builder": "25.0.4",
"electron-vite": "^2.3.0",
"electron-window-state": "^5.0.3",
@ -90,5 +91,6 @@
"typescript": "^5.6.3",
"vite": "^6.0.7",
"vite-plugin-monaco-editor": "^1.1.0"
}
},
"packageManager": "pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c"
}

1777
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -221,7 +221,8 @@ export async function createWindow(): Promise<void> {
webPreferences: {
preload: join(__dirname, '../preload/index.js'),
spellcheck: false,
sandbox: false
sandbox: false,
devTools: true
}
})
mainWindowState.manage(mainWindow)
@ -282,6 +283,12 @@ export async function createWindow(): Promise<void> {
shell.openExternal(details.url)
return { action: 'deny' }
})
// 在开发模式下自动打开 DevTools
if (is.dev) {
mainWindow.webContents.openDevTools()
}
// HMR for renderer base on electron-vite cli.
// Load the remote URL for development or the local html file for production.
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {

View File

@ -73,13 +73,11 @@ const App: React.FC = () => {
const location = useLocation()
const page = useRoutes(routes)
const setTitlebar = (): void => {
if (!useWindowFrame) {
if (!useWindowFrame && platform !== 'darwin') {
const options = { height: 48 } as TitleBarOverlayOptions
try {
if (platform !== 'darwin') {
options.color = window.getComputedStyle(document.documentElement).backgroundColor
options.symbolColor = window.getComputedStyle(document.documentElement).color
}
setTitleBarOverlay(options)
} catch (e) {
// ignore

View File

@ -173,15 +173,17 @@ const ProfileItem: React.FC<Props> = (props) => {
)}
<Card
fullWidth
isPressable
onPress={() => {
className={`${isCurrent ? 'bg-primary' : ''} ${selecting ? 'blur-sm' : ''}`}
>
<div
className="w-full h-full cursor-pointer"
onClick={() => {
if (disableSelect) return
setSelecting(true)
onClick().finally(() => {
setSelecting(false)
})
}}
className={`${isCurrent ? 'bg-primary' : ''} ${selecting ? 'blur-sm' : ''}`}
>
<div ref={setNodeRef} {...attributes} {...listeners} className="w-full h-full">
<CardBody className="pb-1">
@ -309,6 +311,7 @@ const ProfileItem: React.FC<Props> = (props) => {
)}
</CardFooter>
</div>
</div>
</Card>
</div>
)

View File

@ -49,8 +49,6 @@ const ProxyItem: React.FC<Props> = (props) => {
return (
<Card
onPress={() => onSelect(group.name, proxy.name)}
isPressable
fullWidth
shadow="sm"
className={`${
@ -61,6 +59,10 @@ const ProxyItem: React.FC<Props> = (props) => {
: 'bg-content2'
}`}
radius="sm"
>
<div
onClick={() => onSelect(group.name, proxy.name)}
className="cursor-pointer"
>
<CardBody className="p-1">
{proxyDisplayMode === 'full' ? (
@ -149,6 +151,7 @@ const ProxyItem: React.FC<Props> = (props) => {
</div>
)}
</CardBody>
</div>
</Card>
)
}

View File

@ -327,15 +327,17 @@ const Proxies: React.FC = () => {
className={`w-full pt-2 ${index === groupCounts.length - 1 && !isOpen[index] ? 'pb-2' : ''} px-2`}
>
<Card
isPressable
fullWidth
onClick={() => {
>
<div
onClick={(): void => {
setIsOpen((prev) => {
const newOpen = [...prev]
newOpen[index] = !prev[index]
return newOpen
})
}}
className="cursor-pointer"
>
<CardBody className="w-full">
<div className="flex justify-between">
@ -439,6 +441,7 @@ const Proxies: React.FC = () => {
</div>
</div>
</CardBody>
</div>
</Card>
</div>
) : (