feat: The Other Dude v9.0.1 — full-featured email system
ci: add GitHub Pages deployment workflow for docs site Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
34
frontend/src/contexts/EventStreamContext.tsx
Normal file
34
frontend/src/contexts/EventStreamContext.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { createContext, useContext } from 'react'
|
||||
import type { ReactNode } from 'react'
|
||||
import type { ConnectionState } from '@/hooks/useEventStream'
|
||||
|
||||
interface EventStreamContextValue {
|
||||
connectionState: ConnectionState
|
||||
lastConnectedAt: Date | null
|
||||
reconnect: () => void
|
||||
}
|
||||
|
||||
const EventStreamContext = createContext<EventStreamContextValue>({
|
||||
connectionState: 'disconnected',
|
||||
lastConnectedAt: null,
|
||||
reconnect: () => {},
|
||||
})
|
||||
|
||||
export function EventStreamProvider({
|
||||
connectionState,
|
||||
lastConnectedAt,
|
||||
reconnect,
|
||||
children,
|
||||
}: EventStreamContextValue & { children: ReactNode }) {
|
||||
return (
|
||||
<EventStreamContext.Provider value={{ connectionState, lastConnectedAt, reconnect }}>
|
||||
{children}
|
||||
</EventStreamContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
export function useEventStreamContext() {
|
||||
return useContext(EventStreamContext)
|
||||
}
|
||||
|
||||
export { EventStreamContext }
|
||||
Reference in New Issue
Block a user