fix: profiles cannot click

This commit is contained in:
pompurin404 2025-02-04 11:04:15 +08:00
parent 9acab62d1f
commit a69d24b29c
5 changed files with 322 additions and 329 deletions

View File

@ -80,11 +80,13 @@ const App: React.FC = () => {
const location = useLocation()
const page = useRoutes(routes)
const setTitlebar = (): void => {
if (!useWindowFrame && platform !== 'darwin') {
if (!useWindowFrame) {
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

@ -30,7 +30,7 @@ interface Props {
updateProfileItem: (item: IProfileItem) => Promise<void>
removeProfileItem: (id: string) => Promise<void>
mutateProfileConfig: () => void
onClick: () => Promise<void>
onPress: () => Promise<void>
}
interface MenuItem {
@ -48,7 +48,7 @@ const ProfileItem: React.FC<Props> = (props) => {
removeProfileItem,
mutateProfileConfig,
updateProfileItem,
onClick,
onPress,
isCurrent
} = props
const extra = info?.extra
@ -175,17 +175,15 @@ const ProfileItem: React.FC<Props> = (props) => {
)}
<Card
fullWidth
className={`${isCurrent ? 'bg-primary' : ''} ${selecting ? 'blur-sm' : ''}`}
>
<div
className="w-full h-full cursor-pointer"
onClick={() => {
isPressable
onPress={() => {
if (disableSelect) return
setSelecting(true)
onClick().finally(() => {
onPress().finally(() => {
setSelecting(false)
})
}}
className={`${isCurrent ? 'bg-primary' : ''} ${selecting ? 'blur-sm' : ''}`}
>
<div ref={setNodeRef} {...attributes} {...listeners} className="w-full h-full">
<CardBody className="pb-1">
@ -314,7 +312,6 @@ const ProfileItem: React.FC<Props> = (props) => {
)}
</CardFooter>
</div>
</div>
</Card>
</div>
)

View File

@ -51,6 +51,8 @@ const ProxyItem: React.FC<Props> = (props) => {
return (
<Card
onPress={() => onSelect(group.name, proxy.name)}
isPressable
fullWidth
shadow="sm"
className={`${
@ -61,10 +63,6 @@ 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' ? (
@ -153,7 +151,6 @@ const ProxyItem: React.FC<Props> = (props) => {
</div>
)}
</CardBody>
</div>
</Card>
)
}

View File

@ -395,7 +395,7 @@ const Profiles: React.FC = () => {
mutateProfileConfig={mutateProfileConfig}
updateProfileItem={updateProfileItem}
info={item}
onClick={async () => {
onPress={async () => {
await changeCurrentProfile(item.id)
}}
/>

View File

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