diff --git a/desk/sys.kelvin b/desk/sys.kelvin index 0eb2698..86747fc 100644 --- a/desk/sys.kelvin +++ b/desk/sys.kelvin @@ -1,4 +1 @@ -[%zuse 416] -[%zuse 415] -[%zuse 414] -[%zuse 413] +[%zuse 409] diff --git a/ui/App.tsx b/ui/App.tsx index 1c7937d..9ff5801 100644 --- a/ui/App.tsx +++ b/ui/App.tsx @@ -16,6 +16,7 @@ import Buffer from './Buffer'; import { DEFAULT_SESSION, SESSION_ID_REGEX } from './constants'; import { showSlog } from './lib/blit'; import { InfoButton } from './InfoButton'; +import { SpinInfoBar } from './SpinInfoBar'; import { scrySessions, pokeTask } from './lib/utils'; const initSessions = async () => { @@ -107,6 +108,7 @@ export default function TermApp() { return ( <> +
diff --git a/ui/SpinInfoBar.tsx b/ui/SpinInfoBar.tsx new file mode 100644 index 0000000..0c3269a --- /dev/null +++ b/ui/SpinInfoBar.tsx @@ -0,0 +1,69 @@ +import React, { useEffect, useState } from 'react'; +import { useDark } from './lib/useDark'; + +export const SpinInfoBar = () => { + const [spinStack, setSpinStack] = useState([]); + const dark = useDark(); + + useEffect(() => { + console.log('spin: setting up...'); + let available = false; + const spin = new EventSource('/~_~/spin', { withCredentials: true }); + + spin.onopen = () => { + console.log('spin: opened stream'); + available = true; + }; + + spin.onmessage = (e) => { + // The data is expected to be a path like /stack3/stack2/stack1/stack0 + // We need to parse it into an array of stack names + if (e.data && typeof e.data === 'string') { + // Remove leading slash if present and split by slash + const stackPath = e.data.substring(1); + const stackArray = stackPath.split('/'); + setSpinStack(stackArray); + } + }; + + spin.onerror = (e) => { + console.error('spin: eventsource error:', e); + }; + + return () => { + spin.close(); + }; + }, []); + + if (spinStack.length === 0) { + return null; + } + + return ( +
+ Spin Stack: + {spinStack.map((stack, index) => ( + + {index > 0 && >} + + {stack} + + + ))} +
+ ); +}; diff --git a/ui/index.html b/ui/index.html index 4086ccc..0907ca7 100644 --- a/ui/index.html +++ b/ui/index.html @@ -23,16 +23,20 @@