Compare commits

...

4 Commits

Author SHA1 Message Date
jeffvli 5900d41e0a handle sticky elements on new layout 2026-04-04 13:42:50 -07:00
jeffvli efe94b3a3b inset the windowbar 2026-04-04 13:25:35 -07:00
jeffvli 231b6f3865 inset the playerbar 2026-04-04 13:21:22 -07:00
jeffvli 2fbd3ab02d inset the main content / sidebars 2026-04-04 13:21:01 -07:00
19 changed files with 208 additions and 140 deletions
@@ -0,0 +1,72 @@
import { useLayoutEffect, useState } from 'react';
import { useWindowSettings } from '/@/renderer/store/settings.store';
import { Platform } from '/@/shared/types/types';
export interface ItemTableStickyLayoutOffsets {
inViewMarginTop: number;
stickyTop: number;
}
export function useItemTableStickyLayoutOffsets(): ItemTableStickyLayoutOffsets {
const { windowBarStyle } = useWindowSettings();
const isWinMac = windowBarStyle === Platform.WINDOWS || windowBarStyle === Platform.MACOS;
const [offsets, setOffsets] = useState(() => ({
inViewMarginTop: getFallbackInViewMargin(windowBarStyle),
stickyTop: getFallbackStickyTop(windowBarStyle),
}));
useLayoutEffect(() => {
const read = () => {
const topVar = isWinMac
? '--item-table-sticky-top-win-mac'
: '--item-table-sticky-top-default';
const marginVar = isWinMac
? '--item-table-sticky-inview-margin-win-mac'
: '--item-table-sticky-inview-margin-default';
setOffsets({
inViewMarginTop: resolveRootCssMarginLeftVar(
marginVar,
getFallbackInViewMargin(windowBarStyle),
),
stickyTop: resolveRootCssWidthVar(topVar, getFallbackStickyTop(windowBarStyle)),
});
};
read();
window.addEventListener('resize', read);
return () => window.removeEventListener('resize', read);
}, [isWinMac, windowBarStyle]);
return offsets;
}
function getFallbackInViewMargin(windowBarStyle: Platform): number {
return windowBarStyle === Platform.WINDOWS || windowBarStyle === Platform.MACOS ? -130 : -100;
}
function getFallbackStickyTop(windowBarStyle: Platform): number {
return windowBarStyle === Platform.WINDOWS || windowBarStyle === Platform.MACOS ? 95 : 65;
}
function resolveRootCssMarginLeftVar(varName: string, fallback: number): number {
if (typeof document === 'undefined') return fallback;
const el = document.createElement('div');
el.style.cssText = `position:fixed;left:0;top:0;margin-left:var(${varName});width:1px;height:0;margin-top:0;margin-right:0;margin-bottom:0;padding:0;border:none;visibility:hidden;pointer-events:none;`;
document.body.appendChild(el);
const raw = getComputedStyle(el).marginLeft;
el.remove();
const v = parseFloat(raw);
return Number.isFinite(v) ? v : fallback;
}
function resolveRootCssWidthVar(varName: string, fallback: number): number {
if (typeof document === 'undefined') return fallback;
const el = document.createElement('div');
el.style.cssText = `position:fixed;left:-99999px;top:0;width:var(${varName});height:0;margin:0;padding:0;border:none;visibility:hidden;pointer-events:none;`;
document.body.appendChild(el);
const w = el.getBoundingClientRect().width;
el.remove();
return Number.isFinite(w) && w > 0 ? w : fallback;
}
@@ -1,9 +1,8 @@
import type { ItemTableStickyLayoutOffsets } from '/@/renderer/components/item-list/item-table-list/hooks/use-item-table-sticky-layout-offsets';
import { useInView } from 'motion/react';
import { useEffect, useMemo, useState } from 'react';
import { useWindowSettings } from '/@/renderer/store/settings.store';
import { Platform } from '/@/shared/types/types';
export interface GroupRowInfo {
groupIndex: number;
rowIndex: number;
@@ -18,6 +17,7 @@ export const useStickyTableGroupRows = ({
mainGridRef,
shouldShowStickyHeader,
stickyHeaderTop,
stickyLayout,
}: {
containerRef: React.RefObject<HTMLDivElement | null>;
enabled: boolean;
@@ -27,17 +27,14 @@ export const useStickyTableGroupRows = ({
mainGridRef: React.RefObject<HTMLDivElement | null>;
shouldShowStickyHeader?: boolean;
stickyHeaderTop?: number;
stickyLayout: ItemTableStickyLayoutOffsets;
}) => {
const { windowBarStyle } = useWindowSettings();
const { inViewMarginTop, stickyTop: layoutStickyTop } = stickyLayout;
const [stickyGroupIndex, setStickyGroupIndex] = useState<null | number>(null);
const topMargin =
windowBarStyle === Platform.WINDOWS || windowBarStyle === Platform.MACOS
? '-130px'
: '-100px';
const groupRowsInViewMargin = `${inViewMarginTop}px 0px 0px 0px`;
const isTableInView = useInView(containerRef, {
margin: `${topMargin} 0px 0px 0px`,
margin: groupRowsInViewMargin as NonNullable<Parameters<typeof useInView>[1]>['margin'],
});
const stickyTop = useMemo(() => {
@@ -46,8 +43,8 @@ export const useStickyTableGroupRows = ({
if (shouldShowStickyHeader && stickyHeaderTop !== undefined) {
return stickyHeaderTop + headerHeight + 1;
}
return windowBarStyle === Platform.WINDOWS || windowBarStyle === Platform.MACOS ? 95 : 65;
}, [windowBarStyle, shouldShowStickyHeader, stickyHeaderTop, headerHeight]);
return layoutStickyTop;
}, [layoutStickyTop, shouldShowStickyHeader, stickyHeaderTop, headerHeight]);
// Calculate group row indexes
const groupRowIndexes = useMemo(() => {
@@ -1,9 +1,8 @@
import type { ItemTableStickyLayoutOffsets } from '/@/renderer/components/item-list/item-table-list/hooks/use-item-table-sticky-layout-offsets';
import { useInView } from 'motion/react';
import { RefObject, useEffect, useMemo, useRef } from 'react';
import { useWindowSettings } from '/@/renderer/store/settings.store';
import { Platform } from '/@/shared/types/types';
export const useStickyTableHeader = ({
containerRef,
enabled,
@@ -12,6 +11,7 @@ export const useStickyTableHeader = ({
pinnedLeftColumnRef,
pinnedRightColumnRef,
stickyHeaderMainRef,
stickyLayout,
}: {
containerRef: RefObject<HTMLDivElement | null>;
enabled: boolean;
@@ -20,8 +20,9 @@ export const useStickyTableHeader = ({
pinnedLeftColumnRef?: RefObject<HTMLDivElement | null>;
pinnedRightColumnRef?: RefObject<HTMLDivElement | null>;
stickyHeaderMainRef?: RefObject<HTMLDivElement | null>;
stickyLayout: ItemTableStickyLayoutOffsets;
}) => {
const { windowBarStyle } = useWindowSettings();
const { inViewMarginTop, stickyTop } = stickyLayout;
const isScrollingRef = useRef({
main: false,
pinnedLeft: false,
@@ -29,27 +30,20 @@ export const useStickyTableHeader = ({
stickyHeader: false,
});
const topMargin =
windowBarStyle === Platform.WINDOWS || windowBarStyle === Platform.MACOS
? '-130px'
: '-100px';
const inViewRootMargin = `${inViewMarginTop}px 0px 0px 0px`;
const isTableHeaderInView = useInView(headerRef, {
margin: `${topMargin} 0px 0px 0px`,
});
const inViewOptions = { margin: inViewRootMargin } as {
margin: NonNullable<Parameters<typeof useInView>[1]>['margin'];
};
const isTableInView = useInView(containerRef, {
margin: `${topMargin} 0px 0px 0px`,
});
const isTableHeaderInView = useInView(headerRef, inViewOptions);
const isTableInView = useInView(containerRef, inViewOptions);
const shouldShowStickyHeader = useMemo(() => {
return enabled && !isTableHeaderInView && isTableInView;
}, [enabled, isTableHeaderInView, isTableInView]);
const stickyTop = useMemo(() => {
return windowBarStyle === Platform.WINDOWS || windowBarStyle === Platform.MACOS ? 95 : 65;
}, [windowBarStyle]);
// Sync scroll between sticky header and main grid/pinned columns
useEffect(() => {
if (!shouldShowStickyHeader || !stickyHeaderMainRef?.current || !mainGridRef?.current) {
@@ -52,7 +52,7 @@
.item-table-pinned-rows-grid-container.header-fixed {
position: fixed !important;
top: 65px;
top: var(--item-table-sticky-top-default);
z-index: 15;
background-color: var(--theme-bg-primary);
box-shadow: 0 -1px 0 0 var(--theme-colors-border);
@@ -60,7 +60,7 @@
}
.item-table-pinned-rows-grid-container.header-window-bar {
top: 95px;
top: var(--item-table-sticky-top-win-mac);
}
.item-table-list-container.header-fixed-margin {
@@ -31,6 +31,7 @@ import { parseTableColumns } from '/@/renderer/components/item-list/helpers/pars
import { useListHotkeys } from '/@/renderer/components/item-list/helpers/use-list-hotkeys';
import { useContainerWidthTracking } from '/@/renderer/components/item-list/item-table-list/hooks/use-container-width-tracking';
import { useRowInteractionDelegate } from '/@/renderer/components/item-list/item-table-list/hooks/use-row-interaction-delegate';
import { useItemTableStickyLayoutOffsets } from '/@/renderer/components/item-list/item-table-list/hooks/use-item-table-sticky-layout-offsets';
import { useStickyGroupRowPositioning } from '/@/renderer/components/item-list/item-table-list/hooks/use-sticky-group-row-positioning';
import { useStickyHeaderPositioning } from '/@/renderer/components/item-list/item-table-list/hooks/use-sticky-header-positioning';
import { useStickyTableGroupRows } from '/@/renderer/components/item-list/item-table-list/hooks/use-sticky-table-group-rows';
@@ -829,6 +830,8 @@ const ItemTableListStickyUI = memo(
const stickyHeaderMainRef = useRef<HTMLDivElement | null>(null);
const stickyHeaderRightRef = useRef<HTMLDivElement | null>(null);
const stickyLayout = useItemTableStickyLayoutOffsets();
const { shouldShowStickyHeader, stickyTop } = useStickyTableHeader({
containerRef,
enabled: enableHeader && enableStickyHeader,
@@ -837,6 +840,7 @@ const ItemTableListStickyUI = memo(
pinnedLeftColumnRef,
pinnedRightColumnRef,
stickyHeaderMainRef,
stickyLayout,
});
useStickyHeaderPositioning({
@@ -858,6 +862,7 @@ const ItemTableListStickyUI = memo(
mainGridRef: rowRef,
shouldShowStickyHeader,
stickyHeaderTop: stickyTop,
stickyLayout,
});
const shouldRenderStickyGroupRow = shouldShowStickyGroupRow;
@@ -1,7 +1,6 @@
.container {
width: 100vw;
width: 100%;
height: 100%;
border-top: 1px solid alpha(var(--theme-colors-border), 0.5);
}
.controls-grid {
+20 -6
View File
@@ -4,8 +4,10 @@
'window-bar'
'main-content'
'player';
grid-template-rows: 0 calc(100vh - 90px) 90px;
grid-template-rows: 0 calc(100dvh - 90px) 90px;
grid-template-rows:
0 calc(100vh - 90px - var(--theme-spacing-md)) calc(90px + var(--theme-spacing-md));
grid-template-rows:
0 calc(100dvh - 90px - var(--theme-spacing-md)) calc(90px + var(--theme-spacing-md));
grid-template-columns: 1fr;
gap: 0;
height: 100%;
@@ -13,11 +15,23 @@
}
.windows {
grid-template-rows: 30px calc(100vh - 120px) 90px;
grid-template-rows: 30px calc(100dvh - 120px) 90px;
grid-template-rows:
calc(30px + var(--theme-spacing-md))
calc(100vh - 120px - 2 * var(--theme-spacing-md))
calc(90px + var(--theme-spacing-md));
grid-template-rows:
calc(30px + var(--theme-spacing-md))
calc(100dvh - 120px - 2 * var(--theme-spacing-md))
calc(90px + var(--theme-spacing-md));
}
.macos {
grid-template-rows: 30px calc(100vh - 120px) 90px;
grid-template-rows: 30px calc(100dvh - 120px) 90px;
grid-template-rows:
calc(30px + var(--theme-spacing-md))
calc(100vh - 120px - 2 * var(--theme-spacing-md))
calc(90px + var(--theme-spacing-md));
grid-template-rows:
calc(30px + var(--theme-spacing-md))
calc(100dvh - 120px - 2 * var(--theme-spacing-md))
calc(90px + var(--theme-spacing-md));
}
@@ -1,6 +1,7 @@
.container {
position: relative;
grid-area: sidebar;
overflow: hidden;
background: var(--theme-colors-background-alternate);
border-right: 1px solid alpha(var(--theme-colors-border), 0.5);
border-radius: var(--theme-radius-lg);
}
@@ -1,10 +1,12 @@
.main-content-container {
position: relative;
box-sizing: border-box;
display: grid;
grid-area: main-content;
grid-template-areas: 'sidebar . right-sidebar';
grid-template-areas: 'sidebar main';
grid-template-rows: 1fr;
gap: 0;
gap: var(--theme-spacing-sm);
padding: var(--theme-spacing-md);
background: var(--theme-colors-background);
}
@@ -21,6 +23,7 @@
}
.main-content-container.right-expanded {
grid-template-areas: 'sidebar main right-sidebar';
grid-template-columns: var(--sidebar-width) 1fr var(--right-sidebar-width);
}
@@ -30,7 +33,7 @@
.main-content-container.vertical-layout {
grid-template-areas:
'sidebar .'
'sidebar main'
'sidebar right-sidebar';
grid-template-rows: minmax(0, 1fr) var(--right-sidebar-height);
grid-template-columns: var(--sidebar-width) 1fr;
@@ -40,17 +43,15 @@
grid-template-columns: 80px 1fr;
}
.main-content-container.vertical-layout #sidebar-queue {
border-top: 1px solid alpha(var(--theme-colors-border), 0.5);
border-left: 0;
}
.main-content-body {
display: flex;
flex: 1;
flex-direction: column;
grid-area: main;
min-height: 0;
overflow: hidden;
background: var(--theme-colors-background);
border-radius: var(--theme-radius-lg);
}
.main-content-body-scroll {
@@ -1,6 +1,21 @@
.container {
.wrapper {
z-index: 200;
box-sizing: border-box;
display: flex;
grid-area: player;
height: 100%;
padding: 0 var(--theme-spacing-md) var(--theme-spacing-md);
background: var(--theme-colors-background);
}
.bar {
display: flex;
flex: 1;
width: 100%;
min-height: 0;
overflow: hidden;
border-radius: var(--theme-radius-lg);
transition: background 0.5s;
@mixin light {
background: darken(var(--theme-colors-background), 5%);
@@ -9,12 +24,8 @@
@mixin dark {
background: darken(var(--theme-colors-background), 10%);
}
transition: background 0.5s;
}
.open-drawer {
&:hover {
background: darken(var(--theme-colors-background), 20%);
}
.open-drawer .bar:hover {
background: darken(var(--theme-colors-background), 20%);
}
@@ -10,13 +10,14 @@ export const PlayerBar = () => {
return (
<div
className={clsx({
[styles.container]: true,
className={clsx(styles.wrapper, {
[styles.openDrawer]: playerbarOpenDrawer,
})}
id="player-bar"
>
<Playerbar />
<div className={styles.bar}>
<Playerbar />
</div>
</div>
);
};
@@ -7,18 +7,13 @@
min-height: 0;
overflow: hidden;
background: var(--theme-colors-background-alternate);
border-left: 1px solid alpha(var(--theme-colors-border), 0.5);
border-radius: var(--theme-radius-lg);
.current-song-cell:not(.current-playlist-song-cell) svg {
display: none;
}
}
.right-sidebar-container.vertical-layout {
border-top: 1px solid alpha(var(--theme-colors-border), 0.5);
border-left: 0;
}
.queue-drawer {
border-radius: var(--theme-radius-lg);
}
@@ -1,4 +1,3 @@
import clsx from 'clsx';
import { forwardRef, Ref } from 'react';
import styles from './right-sidebar.module.css';
@@ -64,9 +63,7 @@ export const RightSidebar = forwardRef(
<>
{rightExpanded && sideQueueType === 'sideQueue' && (
<aside
className={clsx(styles.rightSidebarContainer, {
[styles.verticalLayout]: isVerticalLayout,
})}
className={styles.rightSidebarContainer}
id="sidebar-queue"
key="queue-sidebar"
>
@@ -5,8 +5,10 @@
'window-bar'
'main-content'
'player';
grid-template-rows: 0 calc(100vh - 90px) 90px;
grid-template-rows: 0 calc(100dvh - 90px) 90px;
grid-template-rows:
0 calc(100vh - 90px - var(--theme-spacing-md)) calc(90px + var(--theme-spacing-md));
grid-template-rows:
0 calc(100dvh - 90px - var(--theme-spacing-md)) calc(90px + var(--theme-spacing-md));
grid-template-columns: 1fr;
gap: 0;
width: 100vw;
@@ -18,14 +20,20 @@
.windows,
.macos {
grid-template-rows: 30px calc(100vh - 120px) 90px;
grid-template-rows: 30px calc(100dvh - 120px) 90px;
grid-template-rows:
calc(30px + var(--theme-spacing-md))
calc(100vh - 120px - 2 * var(--theme-spacing-md))
calc(90px + var(--theme-spacing-md));
grid-template-rows:
calc(30px + var(--theme-spacing-md))
calc(100dvh - 120px - 2 * var(--theme-spacing-md))
calc(90px + var(--theme-spacing-md));
}
.drawer-button {
position: absolute;
bottom: calc(90px + 0.75rem);
left: 0.75rem;
bottom: calc(90px + var(--theme-spacing-md) + 0.75rem);
left: var(--theme-spacing-md);
z-index: 100;
background: color-mix(in srgb, var(--theme-colors-background) 90%, transparent);
border: 1px solid var(--theme-colors-border);
+16 -6
View File
@@ -1,6 +1,20 @@
.window-bar {
.wrapper {
box-sizing: border-box;
display: flex;
grid-area: window-bar;
height: 30px;
height: 100%;
padding: var(--theme-spacing-md) var(--theme-spacing-md) 0;
background: var(--theme-colors-background);
}
.bar {
display: flex;
flex: 1;
width: 100%;
min-height: 0;
overflow: hidden;
background: var(--theme-colors-background);
border-radius: var(--theme-radius-lg);
}
.windows-container {
@@ -9,8 +23,6 @@
align-items: center;
width: 100%;
height: 100%;
background: var(--theme-colors-background);
border-bottom: 1px solid alpha(var(--theme-colors-border), 0.5);
-webkit-app-region: drag;
}
@@ -95,8 +107,6 @@
justify-content: center;
width: 100%;
height: 100%;
background: var(--theme-colors-background);
border-bottom: 1px solid alpha(var(--theme-colors-border), 0.5);
-webkit-app-region: drag;
}
+15 -13
View File
@@ -205,19 +205,21 @@ export const WindowBar = () => {
}
return (
<div className={styles.windowBar}>
{windowBarStyle === Platform.WINDOWS && (
<WindowsControls
controls={{ handleClose, handleMaximize, handleMinimize }}
title={title}
/>
)}
{windowBarStyle === Platform.MACOS && (
<MacOsControls
controls={{ handleClose, handleMaximize, handleMinimize }}
title={title}
/>
)}
<div className={styles.wrapper}>
<div className={styles.bar}>
{windowBarStyle === Platform.WINDOWS && (
<WindowsControls
controls={{ handleClose, handleMaximize, handleMinimize }}
title={title}
/>
)}
{windowBarStyle === Platform.MACOS && (
<MacOsControls
controls={{ handleClose, handleMaximize, handleMinimize }}
title={title}
/>
)}
</div>
</div>
);
};
-43
View File
@@ -1,43 +0,0 @@
.ag-header-fixed {
position: fixed !important;
top: 65px;
z-index: 15;
padding: 0 2rem;
margin: 0 -2rem;
box-shadow: 0 -1px 0 0 #181818;
transition: position 0.2s ease-in-out;
}
.ag-header-window-bar {
top: 95px;
}
.ag-header {
z-index: 5;
}
.window-frame {
top: 95px;
}
.ag-header-transparent {
--ag-header-background-color: rgb(0 0 0 / 0%) !important;
}
.ag-header-fixed-margin {
margin-top: 36px !important;
}
.ag-header-cell-comp-wrapper {
margin: 0 0.5rem;
}
.ag-header-cell,
.ag-header-group-cell {
padding-right: 0.5rem;
padding-left: 0.5rem;
}
.ag-header-cell-resize {
background-color: transparent;
}
+4
View File
@@ -283,6 +283,10 @@ button {
--theme-spacing-xs: var(--mantine-spacing-xs);
--theme-spacing-sm: var(--mantine-spacing-sm);
--theme-spacing-md: var(--mantine-spacing-md);
--item-table-sticky-top-win-mac: calc(95px + 2 * var(--theme-spacing-md));
--item-table-sticky-top-default: calc(65px + var(--theme-spacing-md));
--item-table-sticky-inview-margin-win-mac: calc(-130px - 2 * var(--theme-spacing-md));
--item-table-sticky-inview-margin-default: calc(-100px - var(--theme-spacing-md));
--theme-spacing-lg: var(--mantine-spacing-lg);
--theme-spacing-xl: var(--mantine-spacing-xl);
--theme-spacing-2xl: var(--mantine-spacing-2xl);
@@ -1,5 +1,5 @@
/* stylelint-disable selector-class-pattern */
.fs-player-bar-module-container {
.fs-player-bar-module-bar {
background: rgb(0 0 0 / 40%) !important;
backdrop-filter: blur(2rem);
}
@@ -125,8 +125,8 @@ table {
height: 100vh;
}
:has(.fs-window-bar-module-window-bar) .fs-main-content-module-main-content-container {
height: calc(100vh - 30px);
:has(.fs-window-bar-module-wrapper) .fs-main-content-module-main-content-container {
height: calc(100vh - 30px - var(--theme-spacing-md));
}
.mantine-Tabs-root {