Files
Netcatty/components/vault/MonitorNavButton.tsx
T
陈大猫 bace30578c feat: add synced custom host monitoring panels (#3703)
* feat: add synced custom host monitoring panels

* fix: preserve shared monitoring demand and complete terminal stats

* fix: transfer queued monitoring prompts when a window closes

* fix: keep reused hosts sampling while authentication is queued

* docs: record monitoring acceptance evidence

* fix: transfer pending monitoring auth after panel stop

* fix: release monitor owners in direct SSH runtime

* fix: keep worker monitoring sender compatibility

* fix: include monitoring configuration in automatic sync

* fix: disambiguate independent synced monitoring panel names

* test: assert existing panel order after cloud merge

* test: model browser locks and await monitoring state on Node 22
2026-10-17 15:05:30 +08:00

52 lines
1.6 KiB
TypeScript

import React from "react";
import { Activity } 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",
)}
>
<Activity 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>
);
}