swarm-ui: a hide debug output toggle in the header's settings menu
The row moves from the per-agent page into @hive/shared so both pages mount the same one. The terminal's debug rows now follow the preference as it changes, so rows already on screen hide or show at once instead of only the rows that arrive after the toggle.
This commit is contained in:
parent
f2e2ff82e9
commit
be6036b216
9 changed files with 88 additions and 36 deletions
26
frontend/packages/shared/src/settings/HideDebugSetting.tsx
Normal file
26
frontend/packages/shared/src/settings/HideDebugSetting.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Settings-menu row: "hide debug output". Rendered as a `<SettingsMenu>`
|
||||
// child (`./SettingsMenu.js`) by each page that has a terminal, the
|
||||
// per-agent page and the swarm UI, rather than as a prop on the menu: the
|
||||
// caller owns its row. Both read the same preference (`../prefs.js`), which
|
||||
// `../terminal/Row.tsx` follows as it changes — mara: "add a setting to not
|
||||
// display verbose output... like the grey colored debug stuff."
|
||||
import { useState } from "preact/hooks";
|
||||
import { getHideDebugPref, setHideDebugPref } from "../prefs.js";
|
||||
|
||||
export function HideDebugSetting() {
|
||||
const [hideDebug, setHideDebugState] = useState(() => getHideDebugPref());
|
||||
return (
|
||||
<label class="settings-menu-row">
|
||||
<span>hide debug output</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={hideDebug}
|
||||
onChange={(e) => {
|
||||
const v = (e.target as HTMLInputElement).checked;
|
||||
setHideDebugPref(v);
|
||||
setHideDebugState(v);
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue