From 1e2e6ca8a60edf8c5d28189bcfaf6f9c50bfb8ec Mon Sep 17 00:00:00 2001 From: GyDi Date: Sun, 12 Dec 2021 01:02:14 +0800 Subject: [PATCH] feat: sort groups --- src/pages/proxy.tsx | 12 +++++++----- src/services/proxy.ts | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pages/proxy.tsx b/src/pages/proxy.tsx index 2bbcbcc..1c36ca7 100644 --- a/src/pages/proxy.tsx +++ b/src/pages/proxy.tsx @@ -21,11 +21,13 @@ const ProxyPage = () => { Proxy Groups - - {groups.map((group) => ( - - ))} - + {groups.length > 0 && ( + + {groups.map((group) => ( + + ))} + + )} ); }; diff --git a/src/services/proxy.ts b/src/services/proxy.ts index 452926e..6cb06d6 100644 --- a/src/services/proxy.ts +++ b/src/services/proxy.ts @@ -34,6 +34,8 @@ export async function getProxyInfo() { each.all = each.all?.map((item) => results[item]).filter((e) => e); }); + groups.sort((a, b) => b.name.localeCompare(a.name)); + return { global, groups,