From 7911b7476e89e5e1bfbb4f52bfda5e8bcc2cde8d Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sun, 30 Nov 2025 18:20:09 -0500 Subject: [PATCH] refactor: supporter row centering and SVG dimension extraction Simplifies calculation of supporter row starting X position in contribkit.config.ts by using a local variable. Updates svg-utils.ts to ignore unused viewBox values when extracting SVG dimensions, improving code clarity. --- configs/sponsors/contribkit.config.ts | 4 +--- configs/sponsors/svg-utils.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configs/sponsors/contribkit.config.ts b/configs/sponsors/contribkit.config.ts index ecc4cd7..49db84a 100644 --- a/configs/sponsors/contribkit.config.ts +++ b/configs/sponsors/contribkit.config.ts @@ -176,7 +176,6 @@ export default defineConfig({ compose.addSpan(30); const padding = 20; // Padding between supporters - let currentX = padding; const supporters = [...specialSupporters]; while (supporters.length) { @@ -199,8 +198,7 @@ export default defineConfig({ } // Center row horizontally - const startX = (config.width! - rowWidth + padding) / 2; - currentX = startX; + let currentX = (config.width! - rowWidth + padding) / 2; // Add supporters in row for (const supporter of row) { diff --git a/configs/sponsors/svg-utils.ts b/configs/sponsors/svg-utils.ts index 813d51e..81a98ad 100644 --- a/configs/sponsors/svg-utils.ts +++ b/configs/sponsors/svg-utils.ts @@ -11,7 +11,7 @@ export function extractSvgDimensions(svgContent: string): { width: number; heigh // Try to get dimensions from viewBox first const viewBoxMatch = svgContent.match(/viewBox=['"]([^'"]*)['"]/); if (viewBoxMatch) { - const [minX, minY, width, height] = viewBoxMatch[1].split(/\s+/).map(Number); + const [, , width, height] = viewBoxMatch[1].split(/\s+/).map(Number); // Check that both width and height are valid numbers (not NaN and not undefined) if (!Number.isNaN(width) && !Number.isNaN(height) && width !== undefined && height !== undefined) { return { width, height };