diff --git a/packages/core/src/canvas/dashboardsService.ts b/packages/core/src/canvas/dashboardsService.ts index 627db8fd58..fce36fe9b0 100644 --- a/packages/core/src/canvas/dashboardsService.ts +++ b/packages/core/src/canvas/dashboardsService.ts @@ -433,6 +433,23 @@ function useChannelRows(kind: "dashboard" | "task") { return { rows, loadMore, loading, done }; } +// Resolve the channel's display name (its folder's last path segment) at runtime +// from the baked-in id, so a renamed channel still greets correctly. Empty until +// resolved, so the header avoids a flash of a bare "#". +function useChannelName(): string { + const [name, setName] = useState(""); + useEffect(() => { + let alive = true; + void resolveChannelPath().then((path) => { + if (alive && path) setName(lastSegment(path)); + }); + return () => { + alive = false; + }; + }, []); + return name; +} + // A fixed-height, scrollable section card. A sentinel at the bottom (observed // against THIS box, not the page) fires onLoadMore as the user scrolls near the // end. Styled to match the PostHog Code app: greenish-gray neutrals, soft @@ -710,6 +727,33 @@ const STYLE_TEXT = "*::-webkit-scrollbar-thumb{background:var(--scroll-thumb);border-radius:8px;border:2px solid transparent;background-clip:padding-box}" + "*::-webkit-scrollbar-thumb:hover{background:var(--scroll-thumb-hover);background-clip:padding-box}"; +function WelcomeHeader() { + const name = useChannelName(); + return ( +
+

+ {name ? "Welcome to #" + name + "." : "Welcome to your channel."} +

+

+ This is your home for anything related to this channel. Create dashboards + & apps with Canvases. Put agents to work for you with Tasks. +

+

+ This page is a canvas itself — just click edit to tell the agent what you + want your channel homepage to show. +

+
+ ); +} + export default function ChannelHome() { return (
+