Lf94/pause improvements (#3032)

* Add stream idle mode as a setting (default is off)

* Add pause icon
This commit is contained in:
49fl
2024-07-16 22:45:11 -04:00
committed by GitHub
parent d9d0a72306
commit 482833c88f
11 changed files with 136 additions and 36 deletions

View File

@ -6,6 +6,7 @@ import {
EngineCommandManagerEvents,
EngineConnectionEvents,
EngineConnectionStateType,
EngineConnectionState,
ErrorType,
initialConnectingTypeGroupState,
} from '../lang/std/engineConnection'
@ -19,6 +20,7 @@ export enum NetworkHealthState {
}
export interface NetworkStatus {
immediateState: EngineConnectionState
hasIssues: boolean | undefined
overallState: NetworkHealthState
internetConnected: boolean
@ -33,6 +35,9 @@ export interface NetworkStatus {
// Must be called from one place in the application.
// We've chosen the <Router /> component for this.
export function useNetworkStatus() {
const [immediateState, setImmediateState] = useState<EngineConnectionState>({
type: EngineConnectionStateType.Disconnected,
})
const [steps, setSteps] = useState(
structuredClone(initialConnectingTypeGroupState)
)
@ -126,6 +131,7 @@ export function useNetworkStatus() {
const onConnectionStateChange = ({
detail: engineConnectionState,
}: CustomEvent) => {
setImmediateState(engineConnectionState)
setSteps((steps) => {
let nextSteps = structuredClone(steps)
@ -215,6 +221,7 @@ export function useNetworkStatus() {
}, [])
return {
immediateState,
hasIssues,
overallState,
internetConnected,