Files
Netcatty/components/vault/MonitorNavButton.tsx
T
陈大猫 3f35872638 Refine monitoring layout, disk details and refresh controls (#3704)
* Polish monitoring panels and preserve host icons

* Simplify monitoring layout and show every disk partition

* Simplify list rows and add resizable monitoring overlays

* feat(monitor): add modal drawers, sampled hover values and faster refresh

* feat(monitor): reset run history and support saved drag ordering

* perf(monitor): stream history deltas and keep fast samples lightweight

* fix(monitor): separate chart histories across connection identities

* refine(monitor): show disk capacity on hover and use inline sidebars

* fix(monitor): omit unchanged stats from polling deltas

* test(monitor): freeze time in full-history delta checks

* perf(monitor): bound chart paths and reuse unchanged histories
2026-10-17 18:59:38 +08:00

52 lines
1.6 KiB
TypeScript

import React from "react";
import { Gauge } from "lucide-react";
import { useI18n } from "../../application/i18n/I18nProvider";
import { useMonitorSnapshot } from "../../application/state/monitorRuntimeStore";
import { cn } from "../../lib/utils";
import { RippleButton } from "../ui/ripple";
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
export function MonitorNavButton({
active,
collapsed,
onClick,
}: {
active: boolean;
collapsed: boolean;
onClick: () => void;
}) {
const { t } = useI18n();
const { count } = useMonitorSnapshot();
return (
<Tooltip>
<TooltipTrigger asChild>
<RippleButton
variant={active ? "secondary" : "ghost"}
onClick={onClick}
className={cn(
"w-full h-10",
collapsed ? "justify-center p-0" : "justify-start gap-3",
active &&
"bg-foreground/10 text-foreground hover:bg-foreground/15 border-border/40",
)}
>
<Gauge size={16} className="shrink-0" />
{!collapsed && (
<>
<span>{t("monitor.title")}</span>
{count > 0 && (
<span className="ml-auto text-xs text-primary tabular-nums">
{count}
</span>
)}
</>
)}
{collapsed && count > 0 && (
<span className="text-[10px] text-primary">{count}</span>
)}
</RippleButton>
</TooltipTrigger>
<TooltipContent side="right">{t("monitor.title")}</TooltipContent>
</Tooltip>
);
}