Files
deepseek-harness/packages/client/ui-primitives/src/ConnectionBanner.tsx
T

22 lines
879 B
TypeScript
Raw Normal View History

// ConnectionBanner: top strip surfacing connection loss. The atom is pure:
// the owner subscribes to connection state and passes `reconnecting` down.
// A null/connecting state upstream should stay quiet too — only an actual
// outage (reconnect backoff in progress) shows the strip.
import css from './ConnectionBanner.module.css'
/**
* Render the reconnecting banner.
* @param props.reconnecting - true while the connection is in backoff/retry.
2026-07-30 15:56:41 +08:00
* @param props.label - banner text; the owner passes localized copy (this
* package is cordis-free, so copy arrives via props).
* @returns the banner, or null when connected.
*/
2026-07-30 15:56:41 +08:00
export function ConnectionBanner({ reconnecting, label = '连接已断开,正在重连…' }: {
reconnecting: boolean
label?: string | undefined
}) {
if (!reconnecting) return null
2026-07-30 15:56:41 +08:00
return <div className={css.banner}>{label}</div>
}