The rail keeps scan, Model Doctor and Current node (ui_rail_tools.js, which replaces ui_toolbox.js). The tools the toolbox held now sit where their things are: - Workflow share codes (AMB0/AMB1 import / export): the Workflows page's top bar, in place of the disabled "import" button. - Prompt Studio and Prompt Notes: the Material Library's top bar. - Model Sources: the end of the type chips on Models (library) and "where to download" in Model Doctor (the open workflow). Removed with it: the toolbox popover, its tool catalog and custom-item hook (no plugin used it), the generic tool dispatch (Home opens the doctor directly), the tour step, its styles and the toolbox and old "planned tools" strings. The scan button's tooltip no longer says "wizard". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.7 KiB
JavaScript
36 lines
1.7 KiB
JavaScript
/**
|
|
* The rail's tool buttons under the pages: scan, Model Doctor and Current node; settings
|
|
* at the rail's foot. Each opens its tool page; labels follow the language (the settings
|
|
* hub renders them again when it changes). The other tools live on their pages.
|
|
*/
|
|
|
|
import { translate as t } from './locales.js';
|
|
import { TOOL_ICONS } from './tool_registry.js';
|
|
import { setScanButtonState } from './scan_runner.js';
|
|
|
|
const TOOLS = Object.freeze([
|
|
{ id: 'anomalous-scan-btn', nameKey: 'sidebarScan', open: owner => owner.openScanPage() },
|
|
{ id: 'anomalous-doctor-btn', nameKey: 'sidebarDoctor', icon: TOOL_ICONS.DOCTOR, open: owner => owner.openDoctorPage() },
|
|
{ id: 'anomalous-assistant-btn', nameKey: 'sidebarAssistant', icon: TOOL_ICONS.ASSISTANT, open: owner => owner.openCurrentNode() },
|
|
]);
|
|
|
|
/** Fills `owner.railTools` and `owner.railFoot`; `isScanning()` sets the scan button's state. */
|
|
export function renderRailTools(owner, { isScanning, settingsButton }) {
|
|
owner.railTools.replaceChildren(...TOOLS.map((tool) => {
|
|
const button = document.createElement('button');
|
|
button.id = tool.id;
|
|
button.className = 'anomalous-tooltip-target';
|
|
button.setAttribute('aria-label', t(tool.nameKey));
|
|
button.setAttribute('data-tooltip', t(tool.nameKey));
|
|
button.setAttribute('data-tooltip-pos', 'right');
|
|
if (tool.icon) button.innerHTML = tool.icon; // static markup only
|
|
else setScanButtonState(button, isScanning());
|
|
button.onclick = (event) => {
|
|
event.stopPropagation();
|
|
tool.open(owner);
|
|
};
|
|
return button;
|
|
}));
|
|
owner.railFoot.replaceChildren(settingsButton);
|
|
}
|