'use client'; import { Check, Copy, ExternalLink, X } from 'lucide-react'; import { useEffect, useState } from 'react'; import { ANIMATIONS, buildOverlayUrl, DEFAULT_OPTIONS, POSITIONS, SIZES, THEMES, type OverlayOptions } from '../lib/overlayOptions'; const STORAGE_KEY = 'ytchathub.overlay'; const LABELS: Record = { bl: 'Bottom left', bc: 'Bottom center', br: 'Bottom right', tl: 'Top left', tc: 'Top center', tr: 'Top right', s: 'Small', m: 'Medium', l: 'Large', xl: 'Extra large', dark: 'Dark', light: 'Light', blueprint: 'Blueprint (light, brand)', glass: 'Glass', youtube: 'YouTube red', fade: 'Fade', slide: 'Slide', none: 'None' }; function load(): OverlayOptions { try { const raw = localStorage.getItem(STORAGE_KEY); if (raw) return { ...DEFAULT_OPTIONS, ...JSON.parse(raw) }; } catch { // storage unavailable or corrupt } return DEFAULT_OPTIONS; } export function OverlaySettings({ onClose }: { onClose: () => void }) { const [options, setOptions] = useState(DEFAULT_OPTIONS); const [origin, setOrigin] = useState(''); const [copied, setCopied] = useState(false); useEffect(() => { setOptions(load()); setOrigin(window.location.origin); }, []); useEffect(() => { try { localStorage.setItem(STORAGE_KEY, JSON.stringify(options)); } catch { // storage unavailable } }, [options]); const url = buildOverlayUrl(origin, options); const set = (key: K, value: OverlayOptions[K]) => setOptions((prev) => ({ ...prev, [key]: value })); const copy = async () => { try { await navigator.clipboard.writeText(url); setCopied(true); setTimeout(() => setCopied(false), 1500); } catch { // clipboard blocked; the URL is still selectable in the field } }; const select = (key: K, label: string, values: readonly OverlayOptions[K][]) => ( ); return (
event.stopPropagation()}>

Overlay for OBS

Add the URL below as a Browser Source. Settings are stored in the URL, so one source can have its own look.

{select('theme', 'Theme', THEMES)} {select('pos', 'Position', POSITIONS)} {select('size', 'Text size', SIZES)} {select('anim', 'Animation', ANIMATIONS)}
event.target.select()} /> Open

Recommended Browser Source size: 1920 × 1080, with “Shutdown source when not visible” off so the connection stays warm.

); }