(t0)
| 20 | defaultTab: 'Status' | 'Config' | 'Usage' | 'Gates'; |
| 21 | }; |
| 22 | export function Settings(t0) { |
| 23 | const $ = _c(25); |
| 24 | const { |
| 25 | onClose, |
| 26 | context, |
| 27 | defaultTab |
| 28 | } = t0; |
| 29 | const [selectedTab, setSelectedTab] = useState(defaultTab); |
| 30 | const [tabsHidden, setTabsHidden] = useState(false); |
| 31 | const [configOwnsEsc, setConfigOwnsEsc] = useState(false); |
| 32 | const [gatesOwnsEsc, setGatesOwnsEsc] = useState(false); |
| 33 | const insideModal = useIsInsideModal(); |
| 34 | const { |
| 35 | rows |
| 36 | } = useModalOrTerminalSize(useTerminalSize()); |
| 37 | const contentHeight = insideModal ? rows + 1 : Math.max(15, Math.min(Math.floor(rows * 0.8), 30)); |
| 38 | const [diagnosticsPromise] = useState(_temp2); |
| 39 | useExitOnCtrlCDWithKeybindings(); |
| 40 | let t1; |
| 41 | if ($[0] !== onClose || $[1] !== tabsHidden) { |
| 42 | t1 = () => { |
| 43 | if (tabsHidden) { |
| 44 | return; |
| 45 | } |
| 46 | onClose("Status dialog dismissed", { |
| 47 | display: "system" |
| 48 | }); |
| 49 | }; |
| 50 | $[0] = onClose; |
| 51 | $[1] = tabsHidden; |
| 52 | $[2] = t1; |
| 53 | } else { |
| 54 | t1 = $[2]; |
| 55 | } |
| 56 | const handleEscape = t1; |
| 57 | const t2 = !tabsHidden && !(selectedTab === "Config" && configOwnsEsc) && !(selectedTab === "Gates" && gatesOwnsEsc); |
| 58 | let t3; |
| 59 | if ($[3] !== t2) { |
| 60 | t3 = { |
| 61 | context: "Settings", |
| 62 | isActive: t2 |
| 63 | }; |
| 64 | $[3] = t2; |
| 65 | $[4] = t3; |
| 66 | } else { |
| 67 | t3 = $[4]; |
| 68 | } |
| 69 | useKeybinding("confirm:no", handleEscape, t3); |
| 70 | let t4; |
| 71 | if ($[5] !== context || $[6] !== diagnosticsPromise) { |
| 72 | t4 = <Tab key="status" title="Status"><Status context={context} diagnosticsPromise={diagnosticsPromise} /></Tab>; |
| 73 | $[5] = context; |
| 74 | $[6] = diagnosticsPromise; |
| 75 | $[7] = t4; |
| 76 | } else { |
| 77 | t4 = $[7]; |
| 78 | } |
| 79 | let t5; |
nothing calls this directly
no test coverage detected