diff --git a/server/src/services/replayEngineV2.js b/server/src/services/replayEngineV2.js index b094c74a..6649f234 100644 --- a/server/src/services/replayEngineV2.js +++ b/server/src/services/replayEngineV2.js @@ -498,43 +498,43 @@ function renderSidebarSvg({ const shapes = []; const textRows = []; - const pad = 5; + const pad = 4; const cardX = pad; const cardW = width - pad * 2; - let y = 5; + let y = pad; // Title card - const titleCardH = Math.max(42, 12 + titleParts.length * 18); + const titleCardH = Math.max(30, pad * 2 + titleParts.length * 16); shapes.push(``); - let ty = y + 18; + let ty = y + pad + 12; for (const part of titleParts) { - textRows.push(`${part}`); - ty += 18; + textRows.push(`${part}`); + ty += 16; } - y += titleCardH + 4; + y += titleCardH + pad; // Drivers card const driverLines = statLines.length ? statLines : ['No active drivers']; - const driversCardH = 20 + driverLines.length * 16 + 6; + const driversCardH = pad * 2 + 12 + driverLines.length * 14; shapes.push(``); - textRows.push(`Drivers`); - let dy = y + 32; + textRows.push(`Drivers`); + let dy = y + pad + 22; for (const line of driverLines) { - textRows.push(`${line}`); - dy += 16; + textRows.push(`${line}`); + dy += 14; } - y += driversCardH + 4; + y += driversCardH + pad; // Chat card - const chatCardH = Math.max(80, height - y - 5); + const chatCardH = Math.max(80, height - y - pad); shapes.push(``); - textRows.push(`Chat`); + textRows.push(`Chat`); - let cy = y + 22; - const bubbleX = cardX + 5; - const bubbleW = cardW - 10; + let cy = y + pad + 14; + const bubbleX = cardX + pad; + const bubbleW = cardW - pad * 2; if (!normalizedChats.length) { - textRows.push(`No chat in replay window`); + textRows.push(`No chat in replay window`); } else { for (let i = 0; i < normalizedChats.length; i += 1) { const block = normalizedChats[i]; @@ -547,33 +547,33 @@ function renderSidebarSvg({ const remainingRaw = block.wrapped.slice(firstLineRaw ? 1 : 0).map((line) => String(line || '').trim()).filter(Boolean); const fullText = (firstLine ? [firstLine, ...remainingRaw] : remainingRaw).join(' '); const inlineWrapped = wrapTextLines(fullText, Math.max(8, 26 - prefixChars)).slice(0, 4).map((line) => escapeXml(line)); - const bubbleH = 16 + inlineWrapped.length * 14; - if (cy + bubbleH + 4 > y + chatCardH - 5) break; + const bubbleH = pad * 2 + Math.max(1, inlineWrapped.length) * 12; + if (cy + bubbleH + pad > y + chatCardH - pad) break; shapes.push( ``, ); - const nameX = bubbleX + 6; - const textStartX = nameX + nameW + 4 + (block.roverId ? badgeW + badgeGap : 0); - textRows.push(`${block.nick}`); + const nameX = bubbleX + pad; + const textStartX = nameX + nameW + pad + (block.roverId ? badgeW + badgeGap : 0); + textRows.push(`${block.nick}`); if (block.fromDiscord) { - textRows.push(``); + textRows.push(``); } if (block.roverId) { - const badgeX = nameX + nameW + 4; + const badgeX = nameX + nameW + pad; const badgeTextX = badgeX + 5; shapes.push( - ``, + ``, ); - textRows.push(`${block.roverId}`); + textRows.push(`${block.roverId}`); } - let by = cy + 13; + let by = cy + pad + 8; for (let lineIdx = 0; lineIdx < inlineWrapped.length; lineIdx += 1) { const line = inlineWrapped[lineIdx]; - const lineX = lineIdx === 0 ? textStartX : bubbleX + 6; + const lineX = lineIdx === 0 ? textStartX : bubbleX + pad; textRows.push(`${line}`); - by += 14; + by += 12; } - cy += bubbleH + 4; + cy += bubbleH + pad; } }