/* eslint-disable react-refresh/only-export-components */ /* eslint-disable react-hooks/exhaustive-deps */ import { toast } from "sonner"; import { useTranslation } from "react-i18next"; import { Separator } from "@/components/separator"; import { Button } from "@/components/button"; import { Sheet, SheetContent } from "@/components/sheet"; import { ChevronLeft, ChevronRight, Maximize2 } from "lucide-react"; import { useState, useRef, useCallback, useEffect, createRef, lazy, Suspense, } from "react"; import { createPortal } from "react-dom"; import { useIsMobile } from "@/hooks/use-mobile"; import { MobileBottomBar } from "@/shell/MobileBottomBar"; import { AppRail } from "@/sidebar/AppRail"; import type { RailView } from "@/sidebar/AppRail"; import { SplitView } from "@/shell/SplitView"; import { renderTabContent } from "@/shell/tabUtils"; import { TabBar } from "@/shell/TabBar"; // Shell surfaces that are not needed for first paint. const CommandPalette = lazy(() => import("@/shell/CommandPalette").then((m) => ({ default: m.CommandPalette, })), ); const HostsPanel = lazy(() => import("@/sidebar/HostsPanel").then((m) => ({ default: m.HostsPanel })), ); const QuickConnectPanel = lazy(() => import("@/sidebar/QuickConnectPanel").then((m) => ({ default: m.QuickConnectPanel, })), ); const SerialPanel = lazy(() => import("@/sidebar/SerialPanel").then((m) => ({ default: m.SerialPanel })), ); const SplitScreenPanel = lazy(() => import("@/sidebar/SplitScreenPanel").then((m) => ({ default: m.SplitScreenPanel, })), ); const AlertManager = lazy(() => import("@/dashboard/panels/alerts/AlertManager").then((m) => ({ default: m.AlertManager, })), ); // Secondary rail panels — load on first open, not with the shell critical path. const SshToolsPanel = lazy(() => import("@/sidebar/SshToolsPanel").then((m) => ({ default: m.SshToolsPanel })), ); const SnippetsPanel = lazy(() => import("@/sidebar/SnippetsPanel").then((m) => ({ default: m.SnippetsPanel })), ); const HistoryPanel = lazy(() => import("@/sidebar/HistoryPanel").then((m) => ({ default: m.HistoryPanel })), ); const SessionLogsPanel = lazy(() => import("@/sidebar/SessionLogsPanel").then((m) => ({ default: m.SessionLogsPanel, })), ); const UserProfilePanel = lazy(() => import("@/sidebar/UserProfilePanel").then((m) => ({ default: m.UserProfilePanel, })), ); const AdminSettingsPanel = lazy(() => import("@/sidebar/AdminSettingsPanel").then((m) => ({ default: m.AdminSettingsPanel, })), ); const AlertsPanel = lazy(() => import("@/sidebar/AlertsPanel").then((m) => ({ default: m.AlertsPanel })), ); const CredentialsPanel = lazy(() => import("@/sidebar/CredentialsPanel").then((m) => ({ default: m.CredentialsPanel, })), ); const TermixIdPanel = lazy(() => import("@/sidebar/TermixIdPanel").then((m) => ({ default: m.TermixIdPanel })), ); const ConnectionsPanel = lazy(() => import("@/sidebar/ConnectionsPanel").then((m) => ({ default: m.ConnectionsPanel, })), ); function SidebarPanelFallback() { return (