fix(ui): shrink-wrap floating player bar instead of full-width strip (#969)

* fix(ui): shrink-wrap floating player bar instead of full-width strip

The bar used fixed left and right insets, which stretched its background
across the whole main column. Center it with max-content width so only
the pill-shaped controls are painted, and soften the drop shadow.

* docs: note PR #969 in changelog and settings credits
This commit is contained in:
cucadmuh
2026-06-04 00:03:24 +03:00
committed by GitHub
parent e8962c21ab
commit c9b2d140d9
7 changed files with 65 additions and 14 deletions
@@ -0,0 +1,24 @@
import type { CSSProperties } from 'react';
const HORIZONTAL_MARGIN_PX = 24;
/** Center the floating bar in the main column; shrink-wrap width instead of stretching. */
export function computeFloatingPlayerBarStyle(
sidebarRight: number,
queueLeft: number | null,
viewportWidth: number,
): CSSProperties {
const contentLeft = sidebarRight;
const contentRight = queueLeft ?? viewportWidth;
const contentWidth = Math.max(0, contentRight - contentLeft);
const maxWidth = Math.max(100, contentWidth - HORIZONTAL_MARGIN_PX * 2);
const centerX = contentLeft + contentWidth / 2;
return {
left: centerX,
right: 'auto',
transform: 'translateX(-50%)',
width: 'max-content',
maxWidth,
};
}