Skip to content

Commit

Permalink
refactor(overview): sort by speed
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster1963 committed Dec 3, 2024
1 parent 34f2942 commit ccc875f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
8 changes: 4 additions & 4 deletions app/(main)/ClientComponents/ServerListClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ export default function ServerListClient() {
: filteredServersByStatus.filter((server) => server.tag === tag);

if (filter) {
// 根据使用流量进行从高到低排序
// 根据使用速度进行从高到低排序
filteredServers.sort((a, b) => {
return (
b.status.NetInTransfer +
b.status.NetOutTransfer -
(a.status.NetInTransfer + b.status.NetOutTransfer)
b.status.NetInSpeed +
b.status.NetOutSpeed -
(a.status.NetInSpeed + b.status.NetOutSpeed)
);
});
}
Expand Down
15 changes: 9 additions & 6 deletions app/(main)/ClientComponents/ServerOverviewClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ export default function ServerOverviewClient() {
setStatus("all");
}
}}
className={cn("cursor-pointer hover:border-blue-500 transition-all", {
"pointer-events-none": global,
})}
className={cn(
"cursor-pointer hover:border-blue-500 transition-all min-h-[94px]",
{
"pointer-events-none": global,
},
)}
>
<CardContent className="flex h-full items-center px-6 py-3">
<section className="flex flex-col gap-1">
Expand Down Expand Up @@ -83,7 +86,7 @@ export default function ServerOverviewClient() {
}
}}
className={cn(
"cursor-pointer hover:ring-green-500 ring-1 ring-transparent transition-all",
"cursor-pointer hover:ring-green-500 ring-1 ring-transparent transition-all min-h-[94px]",
{
"ring-green-500 ring-2 border-transparent": status === "online",
},
Expand Down Expand Up @@ -123,7 +126,7 @@ export default function ServerOverviewClient() {
}
}}
className={cn(
"cursor-pointer hover:ring-red-500 ring-1 ring-transparent transition-all",
"cursor-pointer hover:ring-red-500 ring-1 ring-transparent transition-all min-h-[94px]",
{
"ring-red-500 ring-2 border-transparent": status === "offline",
},
Expand Down Expand Up @@ -163,7 +166,7 @@ export default function ServerOverviewClient() {
}
}}
className={cn(
"cursor-pointer hover:ring-purple-500 ring-1 ring-transparent transition-all",
"cursor-pointer hover:ring-purple-500 ring-1 ring-transparent transition-all min-h-[94px]",
{
"ring-purple-500 ring-2 border-transparent": filter === true,
},
Expand Down
2 changes: 0 additions & 2 deletions app/(main)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { Suspense } from "react";
import ServerGlobal from "./ClientComponents/Global";
import GlobalLoading from "./ClientComponents/GlobalLoading";

export const runtime = "edge";

export default async function Home({
searchParams,
}: {
Expand Down
2 changes: 0 additions & 2 deletions app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import Link from "next/link";
import Footer from "./(main)/footer";
import Header from "./(main)/header";

export const runtime = "edge";

export default function NotFoundPage() {
const t = useTranslations("NotFoundPage");
return (
Expand Down

0 comments on commit ccc875f

Please sign in to comment.