// Copyright (c) 2026 Ivan Vasilev // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. import { type NodeInfo, genLabel } from '../lib/shared'; import { IcoRefresh, IcoPlus, IcoTrash, IcoCopy } from './icons'; // Сервер-бар: карточки серверов (core-локальный и ноды) + «Добавить сервер» и // (на мобильной) перезапуск AWG под ними. Общий для вкладок — показывает // серверы, между которыми переключается содержимое вкладки (пиры / абоненты). export default function ServerBar({ nodes, serverId, hubEnabled, onSelect, onAdd, onJoin, onDelete, onRestartAwg, restarting, showRestart = true, }: { nodes: NodeInfo[]; serverId: number | null; hubEnabled: boolean; onSelect: (id: number) => void; onAdd: () => void; onJoin: (n: NodeInfo) => void; onDelete: (n: NodeInfo) => void; onRestartAwg: () => void; restarting: boolean; showRestart?: boolean; }) { return (
{nodes.map(n => { const h = n.health; const active = n.id === serverId; return (
onSelect(n.id)} onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onSelect(n.id); } }} > {/* toggle — виден на мобильном вместо чипа */} ); })} {/* Перезапуск AWG — только на мобильной (на десктопе кнопка в углу). */} {showRestart && serverId !== null && ( )}
); }