mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 01:13:44 +08:00
chore: hide delay for preset outbound
This commit is contained in:
parent
e7c359a2e7
commit
8bd8e149cf
@ -21,6 +21,8 @@ export const ProxyItemMini = (props: Props) => {
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const presetList = ["DIRECT", "REJECT", "REJECT-DROP", "PASS", "COMPATIBLE"];
|
||||
const isPreset = presetList.includes(proxy.name);
|
||||
// -1/<=0 为 不显示
|
||||
// -2 为 loading
|
||||
const [delay, setDelay] = useState(-1);
|
||||
@ -28,6 +30,7 @@ export const ProxyItemMini = (props: Props) => {
|
||||
const timeout = verge?.default_latency_timeout || 10000;
|
||||
|
||||
useEffect(() => {
|
||||
if (isPreset) return;
|
||||
delayManager.setListener(proxy.name, group.name, setDelay);
|
||||
|
||||
return () => {
|
||||
@ -160,7 +163,9 @@ export const ProxyItemMini = (props: Props) => {
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
<Box sx={{ ml: 0.5, color: "primary.main" }}>
|
||||
<Box
|
||||
sx={{ ml: 0.5, color: "primary.main", display: isPreset ? "none" : "" }}
|
||||
>
|
||||
{delay === -2 && (
|
||||
<Widget>
|
||||
<BaseLoading />
|
||||
|
@ -46,12 +46,15 @@ const TypeBox = styled(Box)(({ theme }) => ({
|
||||
export const ProxyItem = (props: Props) => {
|
||||
const { group, proxy, selected, showType = true, sx, onClick } = props;
|
||||
|
||||
const presetList = ["DIRECT", "REJECT", "REJECT-DROP", "PASS", "COMPATIBLE"];
|
||||
const isPreset = presetList.includes(proxy.name);
|
||||
// -1/<=0 为 不显示
|
||||
// -2 为 loading
|
||||
const [delay, setDelay] = useState(-1);
|
||||
const { verge } = useVerge();
|
||||
const timeout = verge?.default_latency_timeout || 10000;
|
||||
useEffect(() => {
|
||||
if (isPreset) return;
|
||||
delayManager.setListener(proxy.name, group.name, setDelay);
|
||||
|
||||
return () => {
|
||||
@ -131,7 +134,11 @@ export const ProxyItem = (props: Props) => {
|
||||
/>
|
||||
|
||||
<ListItemIcon
|
||||
sx={{ justifyContent: "flex-end", color: "primary.main" }}
|
||||
sx={{
|
||||
justifyContent: "flex-end",
|
||||
color: "primary.main",
|
||||
display: isPreset ? "none" : "",
|
||||
}}
|
||||
>
|
||||
{delay === -2 && (
|
||||
<Widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user