Skip to content

Commit

Permalink
add more details to proxy-item
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Feb 1, 2025
1 parent 749ac64 commit 1799154
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 8 deletions.
67 changes: 59 additions & 8 deletions src/renderer/src/components/proxies/proxy-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,70 @@ const ProxyItem: React.FC<Props> = (props) => {
isPressable
fullWidth
shadow="sm"
className={`${fixed ? 'bg-secondary/30' : selected ? 'bg-primary/30' : 'bg-content2'}`}
className={`${
fixed
? 'bg-secondary/30 border-r-2 border-r-secondary border-l-2 border-l-secondary'
: selected
? 'bg-primary/30 border-r-2 border-r-primary border-l-2 border-l-primary'
: 'bg-content2'
}`}
radius="sm"
>
<CardBody className="p-2">
<div className="flex justify-between items-center">
<CardBody className="p-1">
{proxyDisplayMode === 'full' ? (
<div className="flex flex-col gap-1">
<div className="flex justify-between items-center pl-1">
<div className="text-ellipsis overflow-hidden whitespace-nowrap" title={proxy.name}>
{proxy.name}
</div>
{fixed && (
<Button
isIconOnly
title="取消固定"
color="danger"
onPress={async () => {
await mihomoUnfixedProxy(group.name)
mutateProxies()
}}
variant="light"
className="h-[20px] p-0 text-sm"
>
<FaMapPin className="text-md le" />
</Button>
)}
</div>
<div className="flex justify-between items-center pl-1">
<div className="flex gap-1 items-center">
<div className="text-foreground-400 text-xs bg-default-100 px-1 py-0.5 rounded-md">
{proxy.type}
</div>
{['tfo', 'udp', 'xudp', 'mptcp', 'smux'].map(protocol =>
proxy[protocol as keyof IMihomoProxy] && (
<div key={protocol} className="text-foreground-400 text-xs bg-default-100 px-1 py-0.5 rounded-md">
{protocol}
</div>
)
)}
</div>
<Button
isIconOnly
title={proxy.type}
isLoading={loading}
color={delayColor(delay)}
onPress={onDelay}
variant="light"
className="h-full text-sm ml-auto -mt-0.5"
>
{delayText(delay)}
</Button>
</div>
</div>
) : (
<div className="flex justify-between items-center pl-1 p-1">
<div className="text-ellipsis overflow-hidden whitespace-nowrap">
<div className="flag-emoji inline" title={proxy.name}>
{proxy.name}
</div>
{proxyDisplayMode === 'full' && (
<div className="inline ml-2 text-foreground-500" title={proxy.type}>
{proxy.type}
</div>
)}
</div>
<div className="flex justify-end">
{fixed && (
Expand Down Expand Up @@ -97,6 +147,7 @@ const ProxyItem: React.FC<Props> = (props) => {
</Button>
</div>
</div>
)}
</CardBody>
</Card>
)
Expand Down
2 changes: 2 additions & 0 deletions src/shared/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ interface IMihomoProxy {
type: MihomoProxyType
udp: boolean
xudp: boolean
mptcp: boolean
smux: boolean
}

interface IMihomoGroup {
Expand Down

0 comments on commit 1799154

Please sign in to comment.