fixed display of proxy groups and emoji on windows

This commit is contained in:
coolcoala
2025-07-11 04:26:01 +03:00
parent 7dec9cbe9b
commit 87ee07d481
2 changed files with 16 additions and 7 deletions

View File

@@ -29,6 +29,7 @@ interface IProxyGroup {
name: string;
type: string;
now: string;
hidden: boolean;
all: (string | { name: string })[];
}
@@ -37,7 +38,7 @@ function getDelayBadgeVariant(delayValue: number): 'default' | 'secondary' | 'de
if (delayValue < 0) return 'secondary';
if (delayValue >= 10000) return 'destructive';
if (delayValue >= 500) return 'destructive';
if (delayValue >= 200) return 'outline';
if (delayValue >= 150) return 'destructive';
return 'default';
}
@@ -74,7 +75,7 @@ const ProxySelectItem = ({ proxyName, groupName }: { proxyName: string, groupNam
isJustUpdated && "bg-primary/20 border-primary/50"
)}
>
{delay < 0 ? '---' : delay}
{(delay < 0) || (delay > 10000) ? '---' : delay}
</Badge>
</div>
</SelectItem>
@@ -172,9 +173,16 @@ export const ProxySelectors: React.FC = () => {
const selectorGroups = useMemo(() => {
if (!proxies?.groups) return [];
return proxies.groups.filter((g: IProxyGroup) => g.type === 'Selector');
const allowedTypes = ["Selector", "URLTest", "Fallback"];
return proxies.groups.filter((g: IProxyGroup) =>
allowedTypes.includes(g.type) &&
!g.hidden
);
}, [proxies]);
const proxyOptions = useMemo(() => {
let options: { name: string }[] = [];
if (isDirectMode) return [{ name: "DIRECT" }];
@@ -202,11 +210,11 @@ export const ProxySelectors: React.FC = () => {
return (
<TooltipProvider>
<div className="flex justify-center flex-col md:flex-row gap-2 md:items-end">
<div className="flex justify-center flex-col gap-2 md:items-end">
<div className="flex flex-col items-start gap-2">
<label className="text-sm font-medium text-muted-foreground">{t("Group")}</label>
<Select value={selectedGroup} onValueChange={handleGroupChange} disabled={isGlobalMode || isDirectMode}>
<SelectTrigger className="w-48">
<SelectTrigger className="w-100">
<Tooltip>
<TooltipTrigger asChild>
<span className="truncate">
@@ -227,7 +235,7 @@ export const ProxySelectors: React.FC = () => {
</div>
<div className="flex flex-col items-start gap-2">
<div className="flex justify-between items-center w-48">
<div className="flex justify-between items-center w-100">
<label className="text-sm font-medium text-muted-foreground">{t("Proxy")}</label>
<Button variant="ghost" size="sm" onClick={handleSortChange} disabled={isDirectMode}>
{sortType === 'default' && <ChevronsUpDown className="h-4 w-4" />}
@@ -236,7 +244,7 @@ export const ProxySelectors: React.FC = () => {
</Button>
</div>
<Select value={selectedProxy} onValueChange={handleProxyChange} disabled={isDirectMode}>
<SelectTrigger className="w-48">
<SelectTrigger className="w-100">
<Tooltip>
<TooltipTrigger asChild>
<span className="truncate">

View File

@@ -74,6 +74,7 @@
--sidebar-accent-foreground: oklch(0.208 0.042 265.755);
--sidebar-border: oklch(0.929 0.013 255.508);
--sidebar-ring: oklch(0.704 0.04 256.788);
--font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}
.dark {