Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 18 additions & 28 deletions apps/web/src/shell/contextual-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Column 2: route-aware contextual panel with three bands.
//
// 1. Page band — title, settings entry, quick actions, canvas toggle.
// 2. Global pins — user-curated, same on every page.
// 3. Page-specific — contribution content for the current route.
// 2. Global pins — user-curated, same on every page (hidden when empty).
// 3. Page-specific — contribution content for the current route (omitted when null).
//
// Live activity lives here (left), never in the right canvas. Clicking a
// list item navigates to the full surface for that entity.

import { Button, EmptyState, SidebarItemRow } from "@corbits/react-ui";
import { Pin as PinIcon, Settings } from "lucide-react";
import { Button, SidebarItemRow } from "@corbits/react-ui";
import { Settings } from "lucide-react";
import { useState } from "react";

import { CanvasToggle } from "./canvas-column";
Expand Down Expand Up @@ -95,13 +95,9 @@ export function ContextualPanel({
) : null}
</section>

<section className="panel-band panel-band-pins" aria-label="Pinned">
<h3 className="panel-band-heading">Pinned</h3>
{pins.length === 0 ? (
<p className="panel-muted">
Pin channels, agents, or routines to keep them here on every page.
</p>
) : (
{pins.length > 0 ? (
<section className="panel-band panel-band-pins" aria-label="Pinned">
<h3 className="panel-band-heading">Pinned</h3>
<div className="panel-stack">
{pins.map((pin) => (
<SidebarItemRow
Expand All @@ -112,26 +108,20 @@ export function ContextualPanel({
/>
))}
</div>
)}
</section>
</section>
) : null}

<NotificationsBand />

<section
className="panel-band panel-band-page-specific"
aria-label={`${pageBand.title} details`}
>
<h3 className="panel-band-heading">{pageBand.title}</h3>
{pageSpecific ?? (
<EmptyState
title="Nothing here yet"
description="Page-specific activity will show in this band."
/>
)}
</section>
{pageSpecific !== null ? (
<section
className="panel-band panel-band-page-specific"
aria-label={`${pageBand.title} details`}
>
<h3 className="panel-band-heading">{pageBand.title}</h3>
{pageSpecific}
</section>
) : null}
</aside>
);
}

// PinIcon kept for future pin-toggle affordances in rows.
void PinIcon;
7 changes: 4 additions & 3 deletions apps/web/test/contextual-panel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ describe("ContextualPanel", () => {
expect(markup).not.toContain(">Pages<");
});

test("renders the three panel bands", () => {
test("renders the page and page-specific bands, hides empty pins", () => {
const markup = renderPanel("/");
expect(markup).toContain("panel-band-page");
expect(markup).toContain("panel-band-pins");
expect(markup).toContain("panel-band-page-specific");
expect(markup).toContain("Pinned");
// Pins default to empty (no localStorage entries) so the band hides.
expect(markup).not.toContain("panel-band-pins");
expect(markup).not.toContain("Pinned");
});

test("shows an honest empty state once no bench resolves", async () => {
Expand Down
Loading