remove queue mentions from embed service

This commit is contained in:
legop3
2026-01-07 21:50:53 -05:00
parent 4b7c26a7b4
commit f7dd4f7b89
+6 -15
View File
@@ -65,11 +65,10 @@ function sumQueueCounts(turnQueues = {}) {
function buildEmbedCopy(state, camera) { function buildEmbedCopy(state, camera) {
const roversOnline = state?.rovers?.length || 0; const roversOnline = state?.rovers?.length || 0;
const driverCount = Object.keys(state?.activeDrivers || {}).length; const driverCount = Object.keys(state?.activeDrivers || {}).length;
const queueCount = sumQueueCounts(state?.turnQueues || {});
const mode = state?.mode || 'open'; const mode = state?.mode || 'open';
const modeLabel = { const modeLabel = {
open: 'open drive', open: 'open drive',
turns: 'queue mode', turns: 'turns mode',
admin: 'admin mode', admin: 'admin mode',
lockdown: 'locked', lockdown: 'locked',
}[mode] || mode; }[mode] || mode;
@@ -77,16 +76,12 @@ function buildEmbedCopy(state, camera) {
let title = 'Multi Roomba Rover'; let title = 'Multi Roomba Rover';
if (mode === 'lockdown') { if (mode === 'lockdown') {
title = 'Private mode is on'; title = 'Private mode is on';
} else if (driverCount > 0) {
title = 'Rover action live - take the controls';
} else if (mode === 'turns' && queueCount > 0) {
title = 'Queue moving - claim a turn';
} else if (mode === 'turns') {
title = 'Queue open - jump in';
} else if (roversOnline === 0) { } else if (roversOnline === 0) {
title = 'Rovers offline - check back soon'; title = 'Rovers offline - check back soon';
} else if (driverCount > 0) { } else if (driverCount > 0) {
title = 'Rover action live - take the controls'; title = 'Rover action live - take the controls';
} else if (mode === 'turns') {
title = 'Controls open - jump in';
} else { } else {
title = 'Controls open - drive a rover'; title = 'Controls open - drive a rover';
} }
@@ -98,9 +93,7 @@ function buildEmbedCopy(state, camera) {
} else { } else {
descriptionParts.push('no active drivers'); descriptionParts.push('no active drivers');
} }
if (mode === 'turns') { if (mode === 'lockdown') {
descriptionParts.push(`${queueCount} in queue`);
} else if (mode === 'lockdown') {
descriptionParts.push('privacy mode'); descriptionParts.push('privacy mode');
} else { } else {
descriptionParts.push(modeLabel); descriptionParts.push(modeLabel);
@@ -111,9 +104,7 @@ function buildEmbedCopy(state, camera) {
`${roversOnline} online`, `${roversOnline} online`,
driverCount > 0 ? `${driverCount} driving` : 'no drivers', driverCount > 0 ? `${driverCount} driving` : 'no drivers',
]; ];
if (mode === 'turns') { if (mode === 'lockdown') {
statsParts.push(`${queueCount} in queue`);
} else if (mode === 'lockdown') {
statsParts.push('privacy mode'); statsParts.push('privacy mode');
} else { } else {
statsParts.push(modeLabel); statsParts.push(modeLabel);
@@ -125,7 +116,7 @@ function buildEmbedCopy(state, camera) {
description, description,
subtitle: 'Control a live rover from your browser', subtitle: 'Control a live rover from your browser',
stats: statsParts.join(' | '), stats: statsParts.join(' | '),
cameraLabel: mode === 'lockdown' ? 'Room cameras hidden' : `Room camera: ${cameraLabel}`, cameraLabel: mode === 'lockdown' ? 'Room cams hidden' : `Room cam: ${cameraLabel}`,
}; };
} }