Feat : Handling idle state
This commit is contained in:
@@ -10,6 +10,18 @@ const STATE_LABELS: Record<StreamState, { text: string; tone: string }> = {
|
||||
unknown: { text: '…', tone: 'offline' },
|
||||
};
|
||||
|
||||
/**
|
||||
* `idle` et `private` partagent le même état normalisé — les deux mettent
|
||||
* l'enregistrement en pause sans le clore — mais ne veulent pas dire la même
|
||||
* chose à l'écran : le premier est une absence, le second un show payant.
|
||||
*/
|
||||
function stateLabel(target: WatchTarget): { text: string; tone: string } {
|
||||
if (target.state === 'private' && target.rawStatus === 'idle') {
|
||||
return { text: 'revient bientôt', tone: 'warn' };
|
||||
}
|
||||
return STATE_LABELS[target.state];
|
||||
}
|
||||
|
||||
interface Props {
|
||||
targets: WatchTarget[];
|
||||
agents: AgentView[];
|
||||
@@ -114,7 +126,7 @@ function StreamerCard({
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [avatarBroken, setAvatarBroken] = useState(false);
|
||||
|
||||
const state = STATE_LABELS[target.state];
|
||||
const state = stateLabel(target);
|
||||
const agent = agents.find((candidate) => candidate.id === target.agentId) ?? null;
|
||||
const recording = agent?.status.recording ?? false;
|
||||
const isLive = target.state === 'public';
|
||||
@@ -171,7 +183,9 @@ function StreamerCard({
|
||||
<span className="muted small">@{target.username}</span>
|
||||
</div>
|
||||
|
||||
<span className={`badge ${state.tone}`}>{state.text}</span>
|
||||
<span className={`badge ${state.tone}`} title={`statut brut « ${target.rawStatus ?? '?'} »`}>
|
||||
{state.text}
|
||||
</span>
|
||||
</header>
|
||||
|
||||
<dl className="streamer-facts">
|
||||
|
||||
Reference in New Issue
Block a user