From f323f4248bc8cb165670a97f16653ed541d72cb6 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Mon, 1 Jun 2026 15:07:55 +0800 Subject: [PATCH] fix: simplify sorting UI by removing popover and integrating sort controls directly --- src/pages/Server.tsx | 196 +++++++++++++------------------------------ 1 file changed, 56 insertions(+), 140 deletions(-) diff --git a/src/pages/Server.tsx b/src/pages/Server.tsx index 5efd034..b50ba3c 100644 --- a/src/pages/Server.tsx +++ b/src/pages/Server.tsx @@ -3,7 +3,6 @@ import { ArrowsUpDownIcon, ArrowUpIcon, ChartBarSquareIcon, - CheckIcon, MapIcon, ViewColumnsIcon, } from "@heroicons/react/20/solid"; @@ -17,12 +16,7 @@ import ServerCard from "@/components/ServerCard"; import ServerCardInline from "@/components/ServerCardInline"; import ServerOverview from "@/components/ServerOverview"; import { ServiceTracker } from "@/components/ServiceTracker"; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "@/components/ui/popover"; -import { SORT_ORDERS, SORT_TYPES } from "@/context/sort-context"; +import { SORT_TYPES } from "@/context/sort-context"; import { useSort } from "@/hooks/use-sort"; import { useStatus } from "@/hooks/use-status"; import { useWebSocketContext } from "@/hooks/use-websocket-context"; @@ -43,7 +37,6 @@ export default function Servers() { const [showMap, setShowMap] = useState("0"); const [inline, setInline] = useState("0"); const containerRef = useRef(null); - const [settingsOpen, setSettingsOpen] = useState(false); const [currentGroup, setCurrentGroup] = useState("All"); const customBackgroundImage = @@ -51,12 +44,6 @@ export default function Servers() { ? window.CustomBackgroundImage : undefined; - const currentSortTypeLabel = - sortType === "default" - ? "Default" - : sortType.charAt(0).toUpperCase() + sortType.slice(1); - const _currentSortOrderLabel = sortOrder === "asc" ? "Asc" : "Desc"; - const restoreScrollPosition = useCallback(() => { const savedPosition = sessionStorage.getItem("scrollPosition"); if (savedPosition && containerRef.current) { @@ -363,133 +350,62 @@ export default function Servers() { setCurrentTab={handleTagChange} /> - - - - - + - - -
-
-

- Metric -

-
- {SORT_TYPES.map((type) => { - const isActive = sortType === type; - const label = - type === "default" - ? "Default" - : type.charAt(0).toUpperCase() + type.slice(1); - - return ( - - ); - })} -
-
-
-

- Direction -

-
- {SORT_ORDERS.map((order) => ( - - ))} -
-
-
-
-
+ {sortOrder === "asc" && sortType !== "default" ? ( + + ) : sortOrder === "desc" && sortType !== "default" ? ( + + ) : ( + + )} + + Sort + + + | + + + {sortType.charAt(0).toUpperCase() + sortType.slice(1)} + + + + {showMap === "1" && (