Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit c217ff2

Browse files
authored
feat(ui): space lists open on five rows with an inline Show more
An opened space leads with its first five items; "Show more (n)" unfolds the rest in place and flips to "Show less". Search still shows every match uncapped, and the pinned-spaces region stays the single scroll container. Generated-By: PostHog Code Task-Id: 0331ac58-0a1c-4b4e-b884-2ff7d8e71986
1 parent 7007eac commit c217ff2

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

packages/ui/src/features/canvas/components/SpaceSection.tsx

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import { track } from "@posthog/ui/shell/analytics";
1818
import { useNavigate, useRouterState } from "@tanstack/react-router";
1919
import { type Ref, useMemo, useState } from "react";
2020

21+
const INITIAL_ROWS = 5;
22+
2123
/**
2224
* One pinned space in the static sidebar. The whole row is one click target:
2325
* it folds the space's task list open and closed (caret included — no separate
@@ -26,10 +28,11 @@ import { type Ref, useMemo, useState } from "react";
2628
* main view, where the header tabs (Feed/Context/Loops/Artifacts) live. #me
2729
* wears its lock in the same right-hand well, stepping aside on hover.
2830
*
29-
* The open list is the full list — the pinned-spaces region around these
30-
* sections is the one scroll container, so no per-space scrollbars or
31-
* "View all" hops. A search query (from the Spaces header) overrides the
32-
* fold: matching spaces open on their matches, spaces without any disappear.
31+
* An opened space leads with its first five items and a "Show more" that
32+
* unfolds the rest inline — the pinned-spaces region around these sections is
33+
* the one scroll container, so no per-space scrollbars or page hops. A search
34+
* query (from the Spaces header) overrides both the fold and the cap:
35+
* matching spaces open on all their matches, spaces without any disappear.
3336
*
3437
* Expand state is local view state in `spacesSidebarStore`; the space's
3538
* presence in the sidebar is its star, managed from the All spaces directory.
@@ -104,6 +107,12 @@ export function SpaceSection({
104107
],
105108
[visibleItems],
106109
);
110+
// "Show more" unfolds the rest of the list inline; a search always shows
111+
// every match. Transient view state — a fresh mount starts compact.
112+
const [showAll, setShowAll] = useState(false);
113+
const displayItems =
114+
searching || showAll ? sectionItems : sectionItems.slice(0, INITIAL_ROWS);
115+
const hiddenCount = sectionItems.length - displayItems.length;
107116

108117
const commandCenterAssigner = (taskId: string) => {
109118
const cellIndex = commandCenterCells.findIndex(
@@ -218,7 +227,7 @@ export function SpaceSection({
218227
{onlyMine ? "None of your tasks here" : "No tasks yet"}
219228
</div>
220229
) : (
221-
sectionItems.map((item) => (
230+
displayItems.map((item) => (
222231
<ChannelItemRow
223232
key={item.key}
224233
item={item}
@@ -261,6 +270,17 @@ export function SpaceSection({
261270
/>
262271
))
263272
)}
273+
{/* The rest unfold in place; a search already shows every match. */}
274+
{!searching && (hiddenCount > 0 || showAll) && (
275+
<Button
276+
variant="default"
277+
size="sm"
278+
className="justify-start text-[12px] text-muted-foreground"
279+
onClick={() => setShowAll((prev) => !prev)}
280+
>
281+
{showAll ? "Show less" : `Show more (${hiddenCount})`}
282+
</Button>
283+
)}
264284
</div>
265285
)}
266286
</div>

0 commit comments

Comments
 (0)