Skip to content

Commit 093b74c

Browse files
author
pompurin404
committed
group and proxy count
1 parent 739c498 commit 093b74c

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

src/renderer/src/components/connections/connection-item.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const ConnectionItem: React.FC<Props> = (props) => {
2929
})
3030
}}
3131
>
32-
<IoClose className="text-[20px]" />
32+
<IoClose className="text-[24px]" />
3333
</Button>
3434
</div>
3535
</CardBody>

src/renderer/src/components/sider/proxy-card.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Button, Card, CardBody, CardFooter, Chip } from '@nextui-org/react'
22
import { mihomoProxies } from '@renderer/utils/ipc'
3-
import { SiNginxproxymanager } from 'react-icons/si'
3+
import { useMemo } from 'react'
4+
import { MdTableChart } from 'react-icons/md'
45
import { useLocation, useNavigate } from 'react-router-dom'
56
import useSWR from 'swr'
67

@@ -9,6 +10,11 @@ const ProxyCard: React.FC = () => {
910
const location = useLocation()
1011
const match = location.pathname.includes('/proxies')
1112
const { data: proxies = { proxies: {} } } = useSWR('mihomoProxies', mihomoProxies)
13+
14+
const filtered = useMemo(() => {
15+
return Object.keys(proxies.proxies).filter((key) => 'all' in proxies.proxies[key])
16+
}, [proxies])
17+
1218
return (
1319
<Card
1420
fullWidth
@@ -24,7 +30,7 @@ const ProxyCard: React.FC = () => {
2430
variant="flat"
2531
color="default"
2632
>
27-
<SiNginxproxymanager
33+
<MdTableChart
2834
className={`${match ? 'text-white' : 'text-foreground'} text-[24px] font-bold`}
2935
/>
3036
</Button>
@@ -44,7 +50,7 @@ const ProxyCard: React.FC = () => {
4450
variant="bordered"
4551
className="mr-3 mt-2"
4652
>
47-
{Object.keys(proxies.proxies).length ?? 0}
53+
{filtered.length}
4854
</Chip>
4955
</div>
5056
</CardBody>

src/renderer/src/pages/proxies.tsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Avatar, Button, Card, CardBody } from '@nextui-org/react'
1+
import { Avatar, Button, Card, CardBody, Chip } from '@nextui-org/react'
22
import BasePage from '@renderer/components/base/base-page'
33
import { useAppConfig } from '@renderer/hooks/use-app-config'
44
import { mihomoChangeProxy, mihomoProxies, mihomoProxyDelay } from '@renderer/utils/ipc'
@@ -134,7 +134,9 @@ const Proxies: React.FC = () => {
134134
groupCounts={groupCounts}
135135
groupContent={(index) => {
136136
return (
137-
<div className={`w-full pt-2 ${index === groupCounts.length - 1 ? 'pb-2' : ''} px-2`}>
137+
<div
138+
className={`w-full pt-2 ${index === groupCounts.length - 1 && !isOpen[index] ? 'pb-2' : ''} px-2`}
139+
>
138140
<Card
139141
isPressable
140142
fullWidth
@@ -171,7 +173,12 @@ const Proxies: React.FC = () => {
171173
)}
172174
</div>
173175
</div>
174-
<div className="flex">
176+
<div className="flex ">
177+
{proxyDisplayMode === 'full' && (
178+
<Chip size="sm" className="my-1 mr-2">
179+
{groups[index].all.length}
180+
</Chip>
181+
)}
175182
<Button
176183
title="定位到当前节点"
177184
variant="light"

0 commit comments

Comments
 (0)