Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Sidebar: keep the "+" menu above the list's scroll fade

milind-soni067d191debf9
diff --git a/src/components/Sidebar.simple-layout.test.ts b/src/components/Sidebar.simple-layout.test.ts
index e23775c329..5b9de9c8c1 100644
--- a/src/components/Sidebar.simple-layout.test.ts
+++ b/src/components/Sidebar.simple-layout.test.ts
@@ -1,5 +1,6 @@
-import { Children, isValidElement, type EffectCallback, type ReactElement, type ReactNode } from "react";
+import { Children, createElement, isValidElement, type EffectCallback, type ReactElement, type ReactNode } from "react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { renderToStaticMarkup } from "react-dom/server";
import type { AppState, Bot, Group } from "@/state/store";
const fixture = vi.hoisted(() => ({
@@ -149,6 +150,19 @@ describe("Simple-mode sidebar layout", () => {
expect(advanced.root.props.className).toContain("max-md:[--scroll-fade-surface:var(--color-app)]");
});
+ it("stacks the top bar, and the + menu that drops from it, above the list's scroll fade in both modes", () => {
+ const zOf = (markup: string, attribute: string) => Number(new RegExp(`${attribute}[^>]*class="[^"]*\\bz-\\[?(\\d+)`).exec(markup)?.[1]);
+ for (const advanced of [false, true]) {
+ fixture.advanced = advanced;
+ const head = render().tree.find((node) => node.type === GlassBar && node.props.edge === "top")!;
+ const markup = renderToStaticMarkup(createElement(GlassScrollFrame, { fade: true, children: [
+ createElement(GlassBar, { key: "head", edge: "top", className: head.props.className, children: "head" }),
+ createElement(GlassScroller, { key: "list", children: "list" }),
+ ] }));
+ expect(zOf(markup, 'data-glass-bar="top"')).toBeGreaterThan(zOf(markup, 'data-scroll-fade-edge="top"'));
+ }
+ });
+
it("keeps Advanced's Pinned heading and rows, with the Chief as a row", () => {
fixture.advanced = true;
fixture.state = { ...fixture.state, bots: [bot("chief", { chiefOfStaff: true }), bot("atlas", { pinned: true }), bot("bea")] };
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 4a5f162314..e0e5780507 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -1236,7 +1236,7 @@ export const Sidebar = memo(function Sidebar({ open, onClose, collapseToIcons =
)}
>
<GlassScrollFrame className="flex-1" fade><PlaceTint />
- <GlassBar edge="top">
+ <GlassBar edge="top" className="z-20">
<div
data-sidebar-top-row={corner ? "corner" : simpleDesk ? "simple" : true}
className={cn(