Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): keep mobile sidebar controls sticky

Gus965aa00b4398
diff --git a/src/web/src/components/community/channels/dm-sidebar.prefetch.test.ts b/src/web/src/components/community/channels/dm-sidebar.prefetch.test.ts
index 8c01c5e41..19f8de09c 100644
--- a/src/web/src/components/community/channels/dm-sidebar.prefetch.test.ts
+++ b/src/web/src/components/community/channels/dm-sidebar.prefetch.test.ts
@@ -7,6 +7,33 @@ import { DmSidebar } from "./dm-sidebar"
;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
describe("DmSidebar navigation intent", () => {
+ it("keeps shortcuts outside the independently scrolling DM list", async () => {
+ let renderer!: ReactTestRenderer
+
+ await act(async () => {
+ renderer = TestRenderer.create(createElement(DmSidebar, {
+ dms: [],
+ activeDm: null,
+ onPickDm: vi.fn(),
+ onShowFriends: vi.fn(),
+ onShowMachines: vi.fn(),
+ onShowBots: vi.fn(),
+ }))
+ })
+
+ const aside = renderer.root.findByType("aside")
+ expect(aside.props.className).toContain("min-h-0")
+ const shortcuts = renderer.root.findByProps({ "data-slot": "dm-sidebar-shortcuts" })
+ const dmList = renderer.root.findByProps({ "data-slot": "dm-sidebar-list" })
+ expect(shortcuts.props.className).toContain("shrink-0")
+ expect(shortcuts.props.className).not.toContain("overflow-y-auto")
+ expect(dmList.props.className).toContain("min-h-0")
+ expect(dmList.props.className).toContain("flex-1")
+ expect(dmList.props.className).toContain("overflow-y-auto")
+
+ act(() => renderer.unmount())
+ })
+
it("prefetches the fixed destinations on pointer and keyboard intent", async () => {
const onPrefetchFriends = vi.fn()
const onPrefetchMachines = vi.fn()
diff --git a/src/web/src/components/community/channels/dm-sidebar.tsx b/src/web/src/components/community/channels/dm-sidebar.tsx
index eb83ab58a..345f184b4 100644
--- a/src/web/src/components/community/channels/dm-sidebar.tsx
+++ b/src/web/src/components/community/channels/dm-sidebar.tsx
@@ -30,8 +30,8 @@ export const DmSidebar = memo(function DmSidebar({
}) {
const isFriendsActive = friendsActive ?? (activeDm === null && !machinesActive && !botsActive)
return (
- <aside className="flex min-w-0 flex-1 flex-col">
- <div className="flex-1 overflow-y-auto thin-scrollbar px-2 py-4">
+ <aside className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <div data-slot="dm-sidebar-shortcuts" className="shrink-0 px-2 pt-4">
<button
onClick={onShowFriends}
onPointerEnter={onPrefetchFriends}
@@ -70,6 +70,8 @@ export const DmSidebar = memo(function DmSidebar({
</button>
)}
<div className="my-2 h-px bg-border" />
+ </div>
+ <div data-slot="dm-sidebar-list" className="min-h-0 flex-1 overflow-y-auto thin-scrollbar px-2 pb-4">
<div className="mb-2 px-2 text-xs font-semibold text-muted-foreground">
Direct Messages
</div>
diff --git a/src/web/src/components/community/shell/shell-frame-view.test.ts b/src/web/src/components/community/shell/shell-frame-view.test.ts
index 0a558b4e7..2b603384e 100644
--- a/src/web/src/components/community/shell/shell-frame-view.test.ts
+++ b/src/web/src/components/community/shell/shell-frame-view.test.ts
@@ -183,6 +183,15 @@ describe("ShellFrameView", () => {
})
expect(renderer.root.findAllByType("server-rail")).toHaveLength(1)
expect(renderer.root.findAllByType("user-bar")).toHaveLength(1)
+ const mobileSidebarPanel = renderer.root.findAllByType("panel")[0]!
+ expect(mobileSidebarPanel.props.className).toContain("pb-15")
+ const mobileUserBarOverlay = renderer.root.findByProps({
+ "data-slot": "community-user-bar-overlay",
+ })
+ expect(mobileUserBarOverlay.props.style).toEqual({
+ width: "calc(100% + 56px)",
+ marginLeft: -56,
+ })
const mobileSurface = renderer.root.findByType("app-surface")
expect(mobileSurface.props.className).toContain("rounded-tl-xl")
expect(mobileSurface.props.className).toContain("border-l")
@@ -212,6 +221,7 @@ describe("ShellFrameView", () => {
})
expect(renderer.root.findAllByType("server-rail")).toHaveLength(0)
expect(renderer.root.findAllByType("user-bar")).toHaveLength(0)
+ expect(renderer.root.findAllByProps({ "data-slot": "community-user-bar-overlay" })).toHaveLength(0)
expect(renderer.root.findAllByType("app-surface")).toHaveLength(1)
expect(renderer.root.findByType("app-surface").props.className).toContain("rounded-none")
expect(renderer.root.findAllByType("main-content")).toHaveLength(1)
diff --git a/src/web/src/components/community/shell/shell-frame-view.tsx b/src/web/src/components/community/shell/shell-frame-view.tsx
index 853fc64bf..9286696e6 100644
--- a/src/web/src/components/community/shell/shell-frame-view.tsx
+++ b/src/web/src/components/community/shell/shell-frame-view.tsx
@@ -117,22 +117,11 @@ export function ShellFrameView({
data-mobile-active={isMobileList || undefined}
className={cn(
"flex flex-col bg-sidebar",
- isDesktop && "pb-15",
+ (isDesktop || isMobileList) && "pb-15",
)}
>
<div ref={sidebarPanelRef} className="flex min-h-0 min-w-0 flex-1 flex-col">
{!isMobileDetail && (isDesktop ? sidebar() : sidebar({ noHeader: false }))}
- {isMobileList && (
- <UserBar
- user={user}
- onOpenProfile={profile.openProfile}
- onEditProfile={profile.openUserSettings}
- inbox={inboxElement}
- hasUnread={inbox.hasUnread}
- inboxOpen={inbox.open}
- onInboxOpenChange={inbox.onOpenChange}
- />
- )}
</div>
</ResizablePanel>
<ResizableHandle className={cn("bg-transparent", !isDesktop && "hidden")} />
@@ -150,13 +139,19 @@ export function ShellFrameView({
</ResizablePanelGroup>
</AppSurface>
- {isDesktop && (
+ {(isDesktop || isMobileList) && (
<div
+ data-slot="community-user-bar-overlay"
className="absolute bottom-0 left-0 z-10"
- style={{
- width: desktopUserBarOverlayWidth(sidebarWidth),
- marginLeft: -COMMUNITY_RAIL_WIDTH,
- }}
+ style={isDesktop
+ ? {
+ width: desktopUserBarOverlayWidth(sidebarWidth),
+ marginLeft: -COMMUNITY_RAIL_WIDTH,
+ }
+ : {
+ width: `calc(100% + ${COMMUNITY_RAIL_WIDTH}px)`,
+ marginLeft: -COMMUNITY_RAIL_WIDTH,
+ }}
>
<UserBar
user={user}