mirror of
https://github.com/yusufipk/YTChatHub.git
synced 2026-09-11 10:56:17 +00:00
Backend: one SSE stream for messages, selection, poll and connection status; reconnect with backoff; no on-disk Innertube session cache; mock only with MOCK_CHAT=1; binds to 127.0.0.1; serves client/out so production runs on one port. Full URLs for links YouTube truncates in chat. Client: components split out, Lucide icons, stream title and status, on-air strip, search, pause, keyboard shortcuts, overlay settings dialog. Overlay themes, position, size, animation and auto-hide via URL, sized for 1080p and scaled with the source. New blueprint theme for the brand background. Removed Tailwind, better-sqlite3, zod, the timezone helpers, Cline memory bank and AGENTS.md. Added ESLint, node:test tests and CI.
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
'use client';
|
|
|
|
import { Radio } from 'lucide-react';
|
|
import { useState, type FormEvent } from 'react';
|
|
|
|
type Props = {
|
|
busy: boolean;
|
|
error?: string | null;
|
|
onConnect: (liveId: string) => void;
|
|
};
|
|
|
|
export function ConnectForm({ busy, error, onConnect }: Props) {
|
|
const [value, setValue] = useState('');
|
|
|
|
const submit = (event: FormEvent) => {
|
|
event.preventDefault();
|
|
if (value.trim()) onConnect(value.trim());
|
|
};
|
|
|
|
return (
|
|
<div className="connect">
|
|
<form className="connect__card" onSubmit={submit}>
|
|
<span className="connect__icon">
|
|
<Radio size={22} />
|
|
</span>
|
|
<h1>Connect to a live stream</h1>
|
|
<p>Paste the video URL or the 11 character video id of a stream that is live now.</p>
|
|
<input
|
|
autoFocus
|
|
value={value}
|
|
onChange={(event) => setValue(event.target.value)}
|
|
placeholder="https://youtube.com/watch?v=…"
|
|
disabled={busy}
|
|
spellCheck={false}
|
|
/>
|
|
{error && <p className="connect__error">{error}</p>}
|
|
<button type="submit" className="btn btn--primary" disabled={busy || !value.trim()}>
|
|
{busy ? 'Connecting…' : 'Connect'}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
);
|
|
}
|