mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 21:20:29 +08:00
group and proxy count
This commit is contained in:
parent
ccd59e1731
commit
acc9650d42
@ -29,7 +29,7 @@ const ConnectionItem: React.FC<Props> = (props) => {
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IoClose className="text-[20px]" />
|
<IoClose className="text-[24px]" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</CardBody>
|
</CardBody>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Button, Card, CardBody, CardFooter, Chip } from '@nextui-org/react'
|
import { Button, Card, CardBody, CardFooter, Chip } from '@nextui-org/react'
|
||||||
import { mihomoProxies } from '@renderer/utils/ipc'
|
import { mihomoProxies } from '@renderer/utils/ipc'
|
||||||
import { SiNginxproxymanager } from 'react-icons/si'
|
import { useMemo } from 'react'
|
||||||
|
import { MdTableChart } from 'react-icons/md'
|
||||||
import { useLocation, useNavigate } from 'react-router-dom'
|
import { useLocation, useNavigate } from 'react-router-dom'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
|
|
||||||
@ -9,6 +10,11 @@ const ProxyCard: React.FC = () => {
|
|||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const match = location.pathname.includes('/proxies')
|
const match = location.pathname.includes('/proxies')
|
||||||
const { data: proxies = { proxies: {} } } = useSWR('mihomoProxies', mihomoProxies)
|
const { data: proxies = { proxies: {} } } = useSWR('mihomoProxies', mihomoProxies)
|
||||||
|
|
||||||
|
const filtered = useMemo(() => {
|
||||||
|
return Object.keys(proxies.proxies).filter((key) => 'all' in proxies.proxies[key])
|
||||||
|
}, [proxies])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
fullWidth
|
fullWidth
|
||||||
@ -24,7 +30,7 @@ const ProxyCard: React.FC = () => {
|
|||||||
variant="flat"
|
variant="flat"
|
||||||
color="default"
|
color="default"
|
||||||
>
|
>
|
||||||
<SiNginxproxymanager
|
<MdTableChart
|
||||||
className={`${match ? 'text-white' : 'text-foreground'} text-[24px] font-bold`}
|
className={`${match ? 'text-white' : 'text-foreground'} text-[24px] font-bold`}
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
@ -44,7 +50,7 @@ const ProxyCard: React.FC = () => {
|
|||||||
variant="bordered"
|
variant="bordered"
|
||||||
className="mr-3 mt-2"
|
className="mr-3 mt-2"
|
||||||
>
|
>
|
||||||
{Object.keys(proxies.proxies).length ?? 0}
|
{filtered.length}
|
||||||
</Chip>
|
</Chip>
|
||||||
</div>
|
</div>
|
||||||
</CardBody>
|
</CardBody>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Avatar, Button, Card, CardBody } from '@nextui-org/react'
|
import { Avatar, Button, Card, CardBody, Chip } from '@nextui-org/react'
|
||||||
import BasePage from '@renderer/components/base/base-page'
|
import BasePage from '@renderer/components/base/base-page'
|
||||||
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
||||||
import { mihomoChangeProxy, mihomoProxies, mihomoProxyDelay } from '@renderer/utils/ipc'
|
import { mihomoChangeProxy, mihomoProxies, mihomoProxyDelay } from '@renderer/utils/ipc'
|
||||||
@ -134,7 +134,9 @@ const Proxies: React.FC = () => {
|
|||||||
groupCounts={groupCounts}
|
groupCounts={groupCounts}
|
||||||
groupContent={(index) => {
|
groupContent={(index) => {
|
||||||
return (
|
return (
|
||||||
<div className={`w-full pt-2 ${index === groupCounts.length - 1 ? 'pb-2' : ''} px-2`}>
|
<div
|
||||||
|
className={`w-full pt-2 ${index === groupCounts.length - 1 && !isOpen[index] ? 'pb-2' : ''} px-2`}
|
||||||
|
>
|
||||||
<Card
|
<Card
|
||||||
isPressable
|
isPressable
|
||||||
fullWidth
|
fullWidth
|
||||||
@ -171,7 +173,12 @@ const Proxies: React.FC = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex">
|
<div className="flex ">
|
||||||
|
{proxyDisplayMode === 'full' && (
|
||||||
|
<Chip size="sm" className="my-1 mr-2">
|
||||||
|
{groups[index].all.length}
|
||||||
|
</Chip>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
title="定位到当前节点"
|
title="定位到当前节点"
|
||||||
variant="light"
|
variant="light"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user