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 location = useLocation()
const page = useRoutes(routes) const page = useRoutes(routes)
const setTitlebar = (): void => { const setTitlebar = (): void => {
if (!useWindowFrame && platform !== 'darwin') { if (!useWindowFrame) {
const options = { height: 48 } as TitleBarOverlayOptions const options = { height: 48 } as TitleBarOverlayOptions
try { try {
if (platform !== 'darwin') {
options.color = window.getComputedStyle(document.documentElement).backgroundColor options.color = window.getComputedStyle(document.documentElement).backgroundColor
options.symbolColor = window.getComputedStyle(document.documentElement).color options.symbolColor = window.getComputedStyle(document.documentElement).color
}
setTitleBarOverlay(options) setTitleBarOverlay(options)
} catch (e) { } catch (e) {
// ignore // ignore

View File

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

View File

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

View File

@ -395,7 +395,7 @@ const Profiles: React.FC = () => {
mutateProfileConfig={mutateProfileConfig} mutateProfileConfig={mutateProfileConfig}
updateProfileItem={updateProfileItem} updateProfileItem={updateProfileItem}
info={item} info={item}
onClick={async () => { onPress={async () => {
await changeCurrentProfile(item.id) 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`} className={`w-full pt-2 ${index === groupCounts.length - 1 && !isOpen[index] ? 'pb-2' : ''} px-2`}
> >
<Card <Card
isPressable
fullWidth fullWidth
> onPress={() => {
<div
onClick={(): void => {
setIsOpen((prev) => { setIsOpen((prev) => {
const newOpen = [...prev] const newOpen = [...prev]
newOpen[index] = !prev[index] newOpen[index] = !prev[index]
return newOpen return newOpen
}) })
}} }}
className="cursor-pointer"
> >
<CardBody className="w-full"> <CardBody className="w-full">
<div className="flex justify-between"> <div className="flex justify-between">
@ -443,7 +441,6 @@ const Proxies: React.FC = () => {
</div> </div>
</div> </div>
</CardBody> </CardBody>
</div>
</Card> </Card>
</div> </div>
) : ( ) : (