Feat : added and tweaked state machine
This commit is contained in:
@@ -88,6 +88,20 @@ export function StreamersPage({
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Explique, en une ligne, ce que l'automatisme fera ou pourquoi il ne fera rien.
|
||||
* Un interrupteur coché qui reste sans effet est plus déroutant qu'un
|
||||
* interrupteur absent.
|
||||
*/
|
||||
function autoRecordHint(target: WatchTarget, agent: AgentView | null): string {
|
||||
if (!target.autoRecord) return ' — dès une minute de direct';
|
||||
if (!agent) return ' — agent introuvable';
|
||||
if (!agent.online) return ` — en attente : ${agent.name} est hors-ligne`;
|
||||
if (agent.status.recording) return ` — en attente : ${agent.name} enregistre déjà`;
|
||||
if (target.state === 'public') return ' — armé, direct en cours';
|
||||
return ' — armé, en attente du prochain direct';
|
||||
}
|
||||
|
||||
function StreamerCard({
|
||||
target,
|
||||
agents,
|
||||
@@ -209,6 +223,25 @@ function StreamerCard({
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label className="checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={target.autoRecord}
|
||||
disabled={busy || !target.agentId}
|
||||
onChange={(event) =>
|
||||
void run(() => api.updateTarget(target.id, { autoRecord: event.target.checked }))
|
||||
}
|
||||
/>
|
||||
<span>
|
||||
Enregistrer automatiquement
|
||||
<span className="muted small">
|
||||
{!target.agentId
|
||||
? ' — assigne d\'abord un agent'
|
||||
: autoRecordHint(target, agent)}
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div className="actions">
|
||||
{recording ? (
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user