Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ En el panel, la página «Fuentes del programa de emisión» lista todas con su
| Agradecimientos | `http://127.0.0.1:4500/widget/thanks` | 900×200 |
| Entrevista | `http://127.0.0.1:4500/widget/interview` | 1920×1080 |

**Últimos y ticker.** Son dos widgets separados en **Widgets**. «Últimos» muestra el último apoyo de cada tipo marcado (seguidor, sub, bits, raid, Super Chat, miembro o cualquier evento), con una etiqueta opcional (`widgets.latest.label`; vacía no se muestra, clase `.label`). El ticker, en cambio, recorre los eventos más recientes de sus tipos, así que pueden salir varias subs seguidas. Usa los tipos de «Últimos» hasta que eliges los suyos (`widgets.ticker.items`, mismos valores).

**Entrevista.** Capa a pantalla completa para el ítem activo y aprobado de la entrevista activa (ver `docs/entrevista-formato.md`): la pregunta en una tarjeta inferior sobre su imagen, vídeo local, reproductor de YouTube (desde el minuto guardado) o tarjeta de post, con la fuente en cada ítem que lleve media. Sin ítem activo la capa queda vacía. En **Widgets › Se manejan en directo › Entrevista** creas o importas entrevistas, editas y ordenas rondas y preguntas y pulsas **Guardar** para aplicar el borrador. La cabecera del detalle elige o para la entrevista activa y controla la capa; el dock también permite pararla sin borrarla. `POST /api/interviews/stop` hace lo mismo y se puede repetir sin riesgo. En **Capa** están la URL y la vista previa de ejemplo. Las notas privadas nunca salen en la capa. Pruébala con `?demo`.

**Agradecimientos sin conexión.** Esta capa muestra un seguidor pendiente cada vez y puede terminar con el recuento anónimo de YouTube. En Widgets › Agradecimientos eliges plataformas, todo el tiempo / desde el último directo archivado / un número de días, máximo de nombres e intervalo. Las fechas desconocidas se incluyen; si no hay directos archivados, la ventana desde el último no tiene corte. Sin pendientes la capa queda transparente. Las acciones individuales y en bloque con confirmación se aplican al momento; el bloque marca solo los nombres y registros anónimos seleccionados con los ajustes guardados, no los demás pendientes.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ In the panel, the «Fuentes del programa de emisión» page lists all of them wi
| Interview | `http://127.0.0.1:4500/widget/interview` | 1920×1080 |
| On-screen messages | `http://127.0.0.1:4500/widget/rotator` | 1200×120 |

**Latest and ticker.** They are separate widgets in **Widgets**. «Latest» shows the last supporter of each selected type (follower, sub, bits, raid, Super Chat, member or any event), with an optional label (`widgets.latest.label`; empty shows none, class `.label`). The ticker scrolls the most recent events of its types instead, so several subs can appear at once. It uses the «Latest» types until you pick its own (`widgets.ticker.items`, same values).

**Preview in your broadcast program:** in **Widgets › Chat**, «Simular mensajes en Meld» makes every real chat source (the default chat, its variants and custom overlay slots) play the same sample messages as the panel preview for 2 minutes, then return to the real chat. A source loaded during the simulation joins it. Nothing is added to the chat, the history or the metrics. API: `POST /api/chat/preview` with `{ "on": true }` (optional `"seconds"`, 1–600) or `{ "on": false }`; `GET /api/chat/preview` returns `{ on, until }`. MCP: `vista_previa_chat`.

**Interview.** Fullscreen layer for the active, approved item of the active interview (see `docs/entrevista-formato.md`): the question on a card at the bottom over its image, local video, YouTube player (starting at the saved minute) or social post card, with the source shown on every item that has media. Without an active item the layer is empty. In **Widgets › Se manejan en directo › Entrevista**, create or import interviews, edit and reorder rounds and questions, and press **Guardar** to save the draft. The detail header selects or stops the active interview and controls the live layer; the dock can also stop it without deleting it. `POST /api/interviews/stop` does the same and is safe to repeat. **Capa** has its URL and demo preview. Private notes never appear on the layer. Try it with `?demo`.
Expand Down
2 changes: 1 addition & 1 deletion app/src/panel/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function Sidebar({ current }: { current: string }) {
const live = (t: string, label?: string) => <span className="nav-n is-live" aria-label={label}>{t}</span>;
const warns = alertWarnings(s).length;
const widgetTail = I.vote && I.giveaway?.open ? live('2 activos', 'votación en curso y sorteo abierto')
: I.vote ? live('votando', 'votación en curso') : I.giveaway?.open ? live('sorteo', 'sorteo abierto') : num(12);
: I.vote ? live('votando', 'votación en curso') : I.giveaway?.open ? live('sorteo', 'sorteo abierto') : num(13);
const groups: [string, string, Item[]][] = [
['directo', 'En directo', [
{ href: '#/directo', label: 'Directo', tail: s.status?.meld?.streaming ? live('●', 'en directo') : null },
Expand Down
39 changes: 23 additions & 16 deletions app/src/panel/views/Widgets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ import { InterviewSettings } from './InterviewWidget';
export const origin = () => location.origin;
const INFO: Record<string, { title: string; path: string; size: string; w: number; h: number; desc: string }> = {
chat: { title: 'Chat en pantalla', path: '/widget/chat', size: '600×900', w: 600, h: 900, desc: 'El chat de Twitch y YouTube juntos, con tu estilo. Ideal para la escena de solo cámara.' },
latest: { title: 'Últimos y ticker', path: '/widget/latest', size: '1400×200', w: 1400, h: 260, desc: 'Último seguidor, sub, bits… y una banda que recorre los últimos apoyos.' },
latest: { title: 'Últimos', path: '/widget/latest', size: '1400×200', w: 1400, h: 260, desc: 'El último seguidor, sub, bits… de cada tipo que marques.' },
ticker: { title: 'Ticker', path: '/widget/ticker', size: '1920×64', w: 1920, h: 120, desc: 'Una banda que recorre los apoyos más recientes de los tipos que elijas.' },
viewers: { title: 'Espectadores', path: '/widget/viewers', size: '900×160', w: 900, h: 160, desc: 'Espectadores a la vez en Twitch y YouTube, por separado y en total. Se actualiza solo mientras emites.' },
rotator: { title: 'Mensajes en pantalla', path: '/widget/rotator', size: '1200×120', w: 1200, h: 120, desc: 'Una lista de mensajes que van rotando en pantalla cada cierto tiempo, en orden o al azar. Son distintos de los mensajes programados del chat.' },
thanks: { title: 'Agradecimientos', path: '/widget/thanks', size: '900×200', w: 900, h: 200, desc: 'Agradece a quienes te siguieron mientras antena estaba cerrada.' },
interview: { title: 'Entrevista', path: '/widget/interview', size: '1920×1080', w: 1920, h: 1080, desc: 'La pregunta de la entrevista a pantalla completa, con su imagen, vídeo, YouTube o post y la fuente.' },
credits: { title: 'Créditos', path: '/widget/credits', size: '1920×1080', w: 1920, h: 1080, desc: 'Créditos finales con todos los que han apoyado en el directo.' },
};
const SUPPORT_TYPES: [string, string][] = [['follow', 'Seguidor'], ['sub', 'Suscripción'], ['cheer', 'Bits'], ['raid', 'Raid'], ['superchat', 'Super Chat'], ['member', 'Miembro'], ['any', 'Cualquier evento']];
const q = (p: string, mode: string) => `${p}${p.includes('?') ? '&' : '?'}${mode}`;

function WField({ w, f, label, type = 'text', ...rest }: { w: string; f: string; label: ReactNode; type?: string; [k: string]: unknown }) {
Expand All @@ -35,8 +37,13 @@ function WField({ w, f, label, type = 'text', ...rest }: { w: string; f: string;
if (type === 'css') return <label>{label}<textarea className="code" spellCheck={false} value={val === undefined ? '' : String(val)} onKeyDown={codeTab} {...rest} onChange={e => patchWidgets({ [w]: { [f]: e.target.value } })} /></label>;
return <label>{label}<input value={val === undefined ? '' : String(val)} {...rest} onChange={e => patchWidgets({ [w]: { [f]: e.target.value } })} /></label>;
}
function ListChecks({ w, f, items }: { w: string; f: string; items: [string, string][] }) {
const cur = useLive(s => ((((s.config.widgets as WidgetSection | undefined)?.[w] as WidgetSection | undefined)?.[f]) as string[] | undefined) || []);
/** Checkboxes for a list field. With `fallback`, an unset field shows that other field's values;
* the first change saves the whole list into this field. */
function ListChecks({ w, f, items, fallback }: { w: string; f: string; items: [string, string][]; fallback?: [string, string] }) {
const field = (s: any, ww: string, ff: string) => ((s.config.widgets as WidgetSection | undefined)?.[ww] as WidgetSection | undefined)?.[ff] as string[] | undefined;
const own = useLive(s => field(s, w, f));
const inherited = useLive(s => (fallback ? field(s, fallback[0], fallback[1]) : undefined));
const cur = own || inherited || [];
return <>{items.map(([k, l]) => <label className="check" key={k}><input type="checkbox" checked={cur.includes(k)} onChange={e => patchWidgets({ [w]: { [f]: e.target.checked ? [...cur, k] : cur.filter(x => x !== k) } })} /> {l}</label>)}</>;
}

Expand All @@ -52,12 +59,13 @@ export function Widget({ name }: { name: string }) {
if (name === 'chat') return <ChatWidget info={info} anims={CHAT_ANIM_OPTIONS} />;
let form: ReactNode = null;
if (name === 'latest') form = <>
<h3 className="sub-h">Últimos</h3>
<div className="row lead"><ListChecks w="latest" f="items" items={[['follow', 'Seguidor'], ['sub', 'Suscripción'], ['cheer', 'Bits'], ['raid', 'Raid'], ['superchat', 'Super Chat'], ['member', 'Miembro'], ['any', 'Cualquier evento']]} /></div>
<WField w="latest" f="label" label="Etiqueta" placeholder="Últimos (vacía = sin etiqueta)" />
<div className="lbl">Tipos de apoyo<div className="row field-ctl"><ListChecks w="latest" f="items" items={SUPPORT_TYPES} /></div></div>
<WField w="latest" f="css" label="CSS de «últimos»" type="css" placeholder=".item .big { font-size: 34px; }" />
<p className="css-help">Clases: <code>.root</code> <code>.root.col</code> <code>.item</code> <code>.item-{'<tipo>'}</code> <code>.item.empty</code> <code>.item.flash</code> <code>.kick</code> <code>.big</code> <code>.extra</code></p>
<h3 className="sub-h">Ticker</h3>
<p className="hint">Muestra los mismos tipos de apoyo que marcas arriba para «Últimos».</p>
<p className="css-help">Clases: <code>.root</code> <code>.root.col</code> <code>.label</code> <code>.item</code> <code>.item-{'<tipo>'}</code> <code>.item.empty</code> <code>.item.flash</code> <code>.kick</code> <code>.big</code> <code>.extra</code></p></>;
if (name === 'ticker') form = <>
<div className="lbl">Tipos de apoyo<div className="row field-ctl"><ListChecks w="ticker" f="items" items={SUPPORT_TYPES} fallback={['latest', 'items']} /></div></div>
<p className="hint">Hasta que los cambies, usa los mismos tipos que «Últimos». Recorre los eventos más recientes de esos tipos.</p>
<div className="row3">
<WField w="ticker" f="label" label="Etiqueta" />
<WField w="ticker" f="count" label="Eventos" type="number" min={1} max={30} />
Expand Down Expand Up @@ -85,11 +93,8 @@ export function Widget({ name }: { name: string }) {
return <Slide crumb={<><a href="#/widgets">Widgets</a> › {info.title}</>} title={info.title} desc={info.desc} back="#/widgets" wide
foot={<SaveBar />}>
<WidgetLayout
source={<BrowserSource url={origin() + info.path} size={info.size} label={name === 'latest' ? 'Últimos' : undefined} also={name === 'latest' ? [{ url: origin() + '/widget/ticker', size: '1920×64', label: 'Ticker' }] : []} />}
preview={<>
<Stage eyebrow={name === 'latest' ? 'Vista previa · Últimos' : 'Vista previa'} aside={<span>Datos de ejemplo</span>} src={q(info.path, 'demo')} w={info.w} h={info.h} />
{name === 'latest' && <Stage eyebrow="Vista previa · Ticker" aside={<span>Datos de ejemplo</span>} src="/widget/ticker?demo" w={1920} h={120} />}
</>}>
source={<BrowserSource url={origin() + info.path} size={info.size} />}
preview={<Stage eyebrow="Vista previa" aside={<span>Datos de ejemplo</span>} src={q(info.path, 'demo')} w={info.w} h={info.h} />}>
<Panel>{form}</Panel>
</WidgetLayout>
</Slide>;
Expand Down Expand Up @@ -216,16 +221,18 @@ export function Widgets({ parts }: { parts: string[] }) {
<PageHead crumb={`Configurar · ${Object.keys(INFO).length + 5} widgets`} title="Widgets"
desc="Cada uno es una fuente de navegador para el programa de emisión (sus URL también están en Fuentes del programa de emisión). Cuando la app trae un widget nuevo, aparece aquí como una tarjeta más." />
<div className="lv-groups">
<CardGroup tour="widgets-catalog" title="Capas de pantalla" count={7} note="Se ajustan aquí y se dejan puestas en el programa de emisión" wide>
<CardGroup tour="widgets-catalog" title="Capas de pantalla" count={8} note="Se ajustan aquí y se dejan puestas en el programa de emisión" wide>
{fixed('chat', <div className="lv-wchat"><i style={{ width: '62%' }} /><i style={{ width: '80%' }} /><i style={{ width: '48%' }} /><i style={{ width: '72%' }} /><i style={{ width: '56%' }} /></div>,
[...((w.chat?.platforms || ['twitch', 'youtube']) as string[]).map(p => ({ t: p === 'youtube' ? 'YouTube' : 'Twitch' })), ...css(w.chat?.css)])}
<Card href="#/widgets/objetivos" label="Abrir Objetivos" open={open === 'objetivos'} title="Objetivos" aside={<span className="lv-cmeta">1 capa por objetivo</span>}
thumb={<div className="lv-wgoal">{(goals.flatMap(g => g.bars).slice(0, 3).length ? goals.flatMap(g => g.bars).slice(0, 3) : [null, null]).map((b, i) => <i key={i}><b style={{ width: [70, 55, 38][i] + '%', background: b && b.visible === false ? '#8a8f98' : undefined }} /></i>)}</div>}
foot={<>{url('/widget/goal?id=…')}<span className="sp" /><a className="eg-btn eg-btn--ghost eg-btn--sm" href="#/widgets/objetivos">{goals.length ? 'Ver objetivos' : 'Crear el primero'}</a></>}>
<Tags items={goals.length ? [{ t: goals.length === 1 ? '1 objetivo' : `${goals.length} objetivos`, on: true }, { t: `${shownGoals} en pantalla` }, { t: bars === 1 ? '1 barra' : `${bars} barras` }] : [{ t: 'Sin objetivos todavía' }]} />
</Card>
{fixed('latest', <><div className="lv-wbar"><i /><i /><i /></div><div className="lv-wtick" /></>,
[{ t: (w.latest?.items || []).length ? `${(w.latest.items as string[]).length} tipos de apoyo` : 'Últimos apoyos' }, { t: 'con ticker' }, ...css(w.latest?.css || w.ticker?.css)])}
{fixed('latest', <div className="lv-wbar"><i /><i /><i /></div>,
[{ t: (w.latest?.items || []).length ? `${(w.latest.items as string[]).length} tipos de apoyo` : 'Últimos apoyos' }, ...css(w.latest?.css)])}
{fixed('ticker', <div className="lv-wtick" />,
[{ t: w.ticker?.items ? `${(w.ticker.items as string[]).length} tipos propios` : 'Tipos de «Últimos»' }, ...css(w.ticker?.css)])}
{fixed('viewers', <div className="lv-wbar"><i /><i /></div>,
[...((w.viewers?.platforms || ['twitch', 'youtube']) as string[]).map(p => ({ t: p === 'youtube' ? 'YouTube' : 'Twitch' })), ...(w.viewers?.showTotal === false ? [] : [{ t: 'con total' }]), ...css(w.viewers?.css)])}
{fixed('thanks', <div className="lv-wcred"><b>GRACIAS</b><i /><i /></div>,
Expand Down
8 changes: 4 additions & 4 deletions docs/ui-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@ by what the neighbouring view did: the same data gets the same control in every
## Widget pages

Every page reached from the «Widgets» catalog (Preguntas, Teleprompter, Tier list, Sorteo, Chat en pantalla,
Objetivos, Últimos y ticker, Créditos) uses one layout, `WidgetLayout`, below the header (and below the
Objetivos, Últimos, Ticker, Créditos) uses one layout, `WidgetLayout`, below the header (and below the
`ItemTabs` when the page has them):

- Two columns: the left one is everything you configure or operate, the right one is the preview. Below
1180 px they stack and the preview goes first.
- The left column always starts with `BrowserSource`: a section titled «Fuente de navegador» with
the URL (`CopyUrl`), its size and a program-neutral usage hint. Pass `hint` for
widget-specific parameters such as `?nocount`. Never build this block by hand or give it another name.
A page with two widgets lists both URLs in the same block with a `label` each (Últimos y ticker); a page
with one source per object renders the block inside each object's tab (Objetivos).
A page with two widgets lists both URLs in the same block with a `label` each (prefer one widget per
page); a page with one source per object renders the block inside each object's tab (Objetivos).
- The right column holds only previews, each one a `Stage` (or the same `figure.eg-stage` markup when it
needs its own toolbar, as in Teleprompter) with an eyebrow: «Vista previa» for example data or the object
being edited, «En pantalla» for what the widget shows right now. Status or the data source goes in the
Expand All @@ -158,7 +158,7 @@ Objetivos, Últimos y ticker, Créditos) uses one layout, `WidgetLayout`, below
- A section's introduction is the first child: `p.hint.lead`. Hints about a single field go right after
that field as `p.hint`.
- Use `.sub-h` headings only to name a group of content that has no section of its own (for example
«Últimos» and «Ticker» inside one form).
two related groups of settings inside one form).

## Forms

Expand Down
4 changes: 3 additions & 1 deletion public/widgets/latest.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
.item.flash{animation:flash 1.2s ease-out}
@keyframes flash{0%{box-shadow:0 0 0 1px color-mix(in srgb,var(--red-2) calc(90% * var(--glow,1)),transparent),0 0 60px var(--red)}100%{}}
.empty{opacity:.45}
.root>.label{flex-basis:100%;margin:0;font:800 18px/1 var(--f-cond);letter-spacing:.14em;text-transform:uppercase;color:var(--red)}
}
</style></head>
<body><div class="root" id="root"></div>
Expand All @@ -27,7 +28,8 @@
const cfg = s.widgets?.latest || {};
setCss(cfg.css);
const items = (qs.get('items')?.split(',') || cfg.items || ['follow', 'sub', 'cheer', 'superchat']).filter(k => LABELS[k]);
root.innerHTML = items.map(k => {
// Optional label (widgets.latest.label): empty shows nothing.
root.innerHTML = (cfg.label ? `<p class="label">${esc(cfg.label)}</p>` : '') + items.map(k => {
const e = s.latest?.[k];
const changed = e && prev[k] && prev[k] !== e.user + e.at;
return `<div class="item eg-card soft ${e ? '' : 'empty'} ${changed ? 'flash' : ''} item-${k}"><p class="kick">${LABELS[k]}</p><p class="big">${e ? esc(e.user) : '—'}</p>${e && extra(k, e) ? `<p class="extra">${esc(extra(k, e))}</p>` : ''}</div>`;
Expand Down
4 changes: 2 additions & 2 deletions public/widgets/ticker.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
const cfg = s.widgets?.ticker || {};
setCss(cfg.css);
document.getElementById('label').textContent = cfg.label || 'Gracias a';
// Same event types as the «Últimos» block (widgets.latest.items); the groups mirror session.latest().
const kinds = s.widgets?.latest?.items || ['follow', 'sub', 'cheer', 'superchat'];
// Own event types (widgets.ticker.items); without them, the «Últimos» types. The groups mirror session.latest().
const kinds = cfg.items || s.widgets?.latest?.items || ['follow', 'sub', 'cheer', 'superchat'];
const types = kinds.includes('any') ? null : new Set(kinds.flatMap(k => LATEST_TYPES[k] || []));
const items = (s.recent || []).filter(e => !types || types.has(e.type)).slice(0, Number(cfg.count) || 15);
const html = items.length
Expand Down
Loading
Loading