import type { PiWebPlugin } from "@jmfederico/pi-web/plugin-api"; import { RELAYS_ROOT } from "./relayDiscovery.js"; import { defineRelaysPanelElement } from "./relaysPanelElement.js"; const plugin: PiWebPlugin = { apiVersion: 1, name: "Relays", activate: ({ pluginId, html, svg }) => { defineRelaysPanelElement(); return { contributions: { actions: [ { id: "workspace.open-relays", title: "Open Workspace Relays", description: `Open the workspace Relays tab. Relays live in ${RELAYS_ROOT}.`, group: "Workspace", enabled: (context) => context.state.selectedWorkspace !== undefined, run: (context) => { if (context.state.selectedWorkspace === undefined) return; context.selectWorkspaceTool(`${pluginId}:workspace.relays`); }, }, ], workspacePanels: [ { id: "workspace.relays", title: "Relays", icon: svg` `, order: 50, render: (context) => html``, }, ], }, }; }, }; export default plugin;