Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(today): merge library and tools into one products rail item (#111958)

Adam Leithdded627ff6d6
diff --git a/frontend/src/layout/today/TodayLibrarySidebar.tsx b/frontend/src/layout/today/TodayLibrarySidebar.tsx
deleted file mode 100644
index ffc842d92d58..000000000000
--- a/frontend/src/layout/today/TodayLibrarySidebar.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import { useValues } from 'kea'
-import { router } from 'kea-router'
-import { useState } from 'react'
-
-import { IconFolder } from '@posthog/icons'
-import { Text } from '@posthog/quill'
-
-import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
-import { LibraryCreateButton } from 'scenes/library/LibraryCreateButton'
-import { libraryLogic } from 'scenes/library/libraryLogic'
-import { libraryListHref, libraryTypeForPath } from 'scenes/library/libraryUtils'
-import { urls } from 'scenes/urls'
-
-import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'
-import { FileSystemIconType } from '~/queries/schema/schema-general'
-
-import { TodayPaneRow } from './TodayPaneRow'
-import { matchesPaneQuery } from './todayPaneSearch'
-import { TodayPaneSearchList } from './TodayPaneSearchList'
-
-/** The Library sub-nav: every saved object type, each opening a filtered list in the main area. */
-export function TodayLibrarySidebar(): JSX.Element {
- const { objectTypes } = useValues(libraryLogic)
- const { location } = useValues(router)
- const [query, setQuery] = useState('')
- const path = removeProjectIdIfPresent(location.pathname)
- const objectPageType = libraryTypeForPath(path)
-
- const showAll = matchesPaneQuery('All objects', query)
- const types = objectTypes.filter((type) => matchesPaneQuery(type.pluralLabel, query))
-
- return (
- <div className="TodayPane" data-quill>
- <TodayPaneSearchList
- query={query}
- onQueryChange={setQuery}
- searchLabel="Search library"
- dataAttr="today-library-search"
- >
- {!showAll && !types.length && (
- <Text size="xs" variant="muted" className="block px-2 py-1">
- Nothing in Library matches that search.
- </Text>
- )}
- {(showAll || types.length > 0) && (
- <div>
- {showAll && (
- <TodayPaneRow
- value="all"
- label="All objects"
- icon={<IconFolder />}
- to={urls.library()}
- active={path === urls.library()}
- dataAttr="today-library-all"
- />
- )}
- {types.map((type) => (
- <TodayPaneRow
- key={type.value}
- value={`type:${type.value}`}
- label={type.pluralLabel}
- icon={iconForType(type.value as FileSystemIconType)}
- to={libraryListHref(type.value) ?? urls.library(type.value)}
- active={path === urls.library(type.value) || objectPageType === type.value}
- action={<LibraryCreateButton objectType={type.value} />}
- dataAttr="today-library-type"
- />
- ))}
- </div>
- )}
- </TodayPaneSearchList>
- </div>
- )
-}
diff --git a/frontend/src/layout/today/TodayMoreSidebar.tsx b/frontend/src/layout/today/TodayMoreSidebar.tsx
deleted file mode 100644
index d7c75e40fb06..000000000000
--- a/frontend/src/layout/today/TodayMoreSidebar.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { useActions } from 'kea'
-
-import { IconChevronRight } from '@posthog/icons'
-import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemTitle } from '@posthog/quill'
-
-import { TODAY_MORE_ITEMS } from './todayRailItems'
-import { todayShellLogic } from './todayShellLogic'
-
-export function TodayMoreSidebar(): JSX.Element {
- const { pickPane } = useActions(todayShellLogic)
-
- return (
- <div className="TodayPane">
- <ItemGroup className="gap-1">
- {TODAY_MORE_ITEMS.map(({ pane, label, icon, description }) => (
- <Item
- key={pane}
- variant="outline"
- render={<button type="button" className="w-full cursor-pointer text-left" />}
- onClick={() => pickPane(pane)}
- data-attr={`today-more-${pane}`}
- >
- <ItemMedia variant="icon">{icon}</ItemMedia>
- <ItemContent>
- <ItemTitle>{label}</ItemTitle>
- <ItemDescription>{description}</ItemDescription>
- </ItemContent>
- <ItemActions>
- <IconChevronRight className="size-4 text-muted-foreground" />
- </ItemActions>
- </Item>
- ))}
- </ItemGroup>
- </div>
- )
-}
diff --git a/frontend/src/layout/today/TodayProductsSidebar.tsx b/frontend/src/layout/today/TodayProductsSidebar.tsx
new file mode 100644
index 000000000000..09a0d7713bd0
--- /dev/null
+++ b/frontend/src/layout/today/TodayProductsSidebar.tsx
@@ -0,0 +1,115 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+
+import { IconFolder } from '@posthog/icons'
+import { Text } from '@posthog/quill'
+
+import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
+import { LibraryCreateButton } from 'scenes/library/LibraryCreateButton'
+import { libraryLogic } from 'scenes/library/libraryLogic'
+import { libraryListHref, libraryTypeForPath } from 'scenes/library/libraryUtils'
+import { toolHrefForPath, toolLabel } from 'scenes/tools/toolsUtils'
+import { urls } from 'scenes/urls'
+
+import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'
+import { FileSystemIconType, FileSystemImport } from '~/queries/schema/schema-general'
+
+import { TodayPaneGroupLabel } from './TodayPaneGroupLabel'
+import { TodayPaneRow } from './TodayPaneRow'
+import { matchesPaneQuery } from './todayPaneSearch'
+import { TodayPaneSearchList } from './TodayPaneSearchList'
+import { todayToolsLogic } from './todayToolsLogic'
+
+/** The Products sub-nav: recently viewed tools, every saved object type, then the tools by category. */
+export function TodayProductsSidebar(): JSX.Element {
+ const { tools, toolGroups, recentTools, search } = useValues(todayToolsLogic)
+ const { setSearch } = useActions(todayToolsLogic)
+ const { objectTypes } = useValues(libraryLogic)
+ const { location } = useValues(router)
+ const path = removeProjectIdIfPresent(location.pathname)
+ const activeHref = toolHrefForPath(path, tools)
+ const objectPageType = libraryTypeForPath(path)
+
+ const showAllObjects = matchesPaneQuery('All objects', search)
+ const libraryTypes = objectTypes.filter((type) => matchesPaneQuery(type.pluralLabel, search))
+ const showLibrary = showAllObjects || libraryTypes.length > 0
+ const recentSection = recentTools.length ? { key: 'recent', label: 'Recently viewed', tools: recentTools } : null
+ const categorySections = toolGroups.map((group) => ({
+ key: group.category,
+ label: group.category,
+ tools: group.tools,
+ }))
+ // A tool can show in Recently viewed and in its own group, so the group keeps the two rows apart on the keyboard path.
+ const optionValue = (groupKey: string, tool: FileSystemImport): string => `${groupKey}:${tool.href ?? ''}`
+
+ const renderToolSection = (section: (typeof categorySections)[number], first: boolean): JSX.Element => (
+ <div key={section.key}>
+ <TodayPaneGroupLabel first={first}>{section.label}</TodayPaneGroupLabel>
+ {section.tools.map((tool) => {
+ const href = tool.href ?? ''
+ return (
+ <TodayPaneRow
+ key={href}
+ value={optionValue(section.key, tool)}
+ label={toolLabel(tool)}
+ icon={iconForType((tool.iconType ?? tool.type) as FileSystemIconType, tool.iconColor)}
+ to={href}
+ active={!!href && href === activeHref}
+ dataAttr={section.key === 'recent' ? 'today-tool-recent' : 'today-tool'}
+ />
+ )
+ })}
+ </div>
+ )
+
+ return (
+ <div className="TodayPane" data-quill>
+ <TodayPaneSearchList
+ query={search}
+ onQueryChange={setSearch}
+ searchLabel="Search products"
+ dataAttr="today-products-search"
+ >
+ {!recentSection && !showLibrary && !categorySections.length ? (
+ <Text size="xs" variant="muted" className="block px-2 py-1">
+ No products match that search.
+ </Text>
+ ) : (
+ <>
+ {recentSection && renderToolSection(recentSection, true)}
+ {showLibrary && (
+ <div>
+ <TodayPaneGroupLabel first={!recentSection}>Library</TodayPaneGroupLabel>
+ {showAllObjects && (
+ <TodayPaneRow
+ value="library:all"
+ label="All objects"
+ icon={<IconFolder />}
+ to={urls.library()}
+ active={path === urls.library()}
+ dataAttr="today-library-all"
+ />
+ )}
+ {libraryTypes.map((type) => (
+ <TodayPaneRow
+ key={type.value}
+ value={`library:${type.value}`}
+ label={type.pluralLabel}
+ icon={iconForType(type.value as FileSystemIconType)}
+ to={libraryListHref(type.value) ?? urls.library(type.value)}
+ active={path === urls.library(type.value) || objectPageType === type.value}
+ action={<LibraryCreateButton objectType={type.value} />}
+ dataAttr="today-library-type"
+ />
+ ))}
+ </div>
+ )}
+ {categorySections.map((section, index) =>
+ renderToolSection(section, !recentSection && !showLibrary && index === 0)
+ )}
+ </>
+ )}
+ </TodayPaneSearchList>
+ </div>
+ )
+}
diff --git a/frontend/src/layout/today/TodayShell.tsx b/frontend/src/layout/today/TodayShell.tsx
index 741eaefc2b99..96b012f7bcf1 100644
--- a/frontend/src/layout/today/TodayShell.tsx
+++ b/frontend/src/layout/today/TodayShell.tsx
@@ -3,8 +3,7 @@ import './TodayShell.scss'
import { useActions, useMountedLogic, useValues } from 'kea'
import { Suspense, useEffect, useRef } from 'react'
-import { IconChevronLeft } from '@posthog/icons'
-import { Button, Heading, Skeleton, ToastProvider } from '@posthog/quill'
+import { Heading, Skeleton, ToastProvider } from '@posthog/quill'
import 'scenes/project-homepage/today/Today.scss'
import { Resizer } from 'lib/components/Resizer/Resizer'
@@ -19,13 +18,7 @@ import { TodayPhoneHeader } from './TodayPhoneHeader'
import { TodayPreviewCardProvider } from './TodayPreviewCardProvider'
import { TodayRail } from './TodayRail'
import { todayRecentsLogic } from './todayRecentsLogic'
-import {
- TODAY_MORE_PANES,
- TODAY_RAIL_WIDTH,
- TODAY_SIDEBAR_CLOSE_THRESHOLD,
- clampSidebarWidth,
- todayShellLogic,
-} from './todayShellLogic'
+import { TODAY_RAIL_WIDTH, TODAY_SIDEBAR_CLOSE_THRESHOLD, clampSidebarWidth, todayShellLogic } from './todayShellLogic'
import { TodaySidebarFooter } from './TodaySidebarFooter'
import { TodayTabBar } from './TodayTabBar'
@@ -33,14 +26,8 @@ const TodaySpacesPane = lazyWithRetry(() => import('./TodaySpacesPane').then((m)
const TodayViewsSidebar = lazyWithRetry(() =>
import('./TodayViewsSidebar').then((m) => ({ default: m.TodayViewsSidebar }))
)
-const TodayToolsSidebar = lazyWithRetry(() =>
- import('./TodayToolsSidebar').then((m) => ({ default: m.TodayToolsSidebar }))
-)
-const TodayMoreSidebar = lazyWithRetry(() =>
- import('./TodayMoreSidebar').then((m) => ({ default: m.TodayMoreSidebar }))
-)
-const TodayLibrarySidebar = lazyWithRetry(() =>
- import('./TodayLibrarySidebar').then((m) => ({ default: m.TodayLibrarySidebar }))
+const TodayProductsSidebar = lazyWithRetry(() =>
+ import('./TodayProductsSidebar').then((m) => ({ default: m.TodayProductsSidebar }))
)
const NewSpaceDialog = lazyWithRetry(() =>
import('products/tasks/frontend/spaces/NewSpaceDialog').then((m) => ({ default: m.NewSpaceDialog }))
@@ -50,9 +37,7 @@ const PANE_LABELS = {
home: 'Today',
spaces: 'Spaces',
views: 'Views',
- library: 'Library',
- tools: 'Tools',
- more: 'More',
+ products: 'Products',
}
/** The left navigation under the Today layout: the rail, then the sidebar for the pane the rail has open. */
@@ -61,8 +46,7 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {
useValues(todayShellLogic)
// Records the tools and sessions visited while other panes are open, so each pane's Recent group is ready.
useMountedLogic(todayRecentsLogic)
- const { pickPane, setMobileSidebarOpen, setSidebarOpen, setSidebarWidth, toggleSidebar } =
- useActions(todayShellLogic)
+ const { setMobileSidebarOpen, setSidebarOpen, setSidebarWidth, toggleSidebar } = useActions(todayShellLogic)
const sidebarRef = useRef<HTMLDivElement | null>(null)
const drawerRef = useRef<HTMLElement | null>(null)
const returnFocusRef = useRef<HTMLElement | null>(null)
@@ -109,12 +93,8 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {
<TodaySpacesPane />
) : activePane === 'views' ? (
<TodayViewsSidebar />
- ) : activePane === 'library' ? (
- <TodayLibrarySidebar />
- ) : activePane === 'more' ? (
- <TodayMoreSidebar />
) : (
- <TodayToolsSidebar />
+ <TodayProductsSidebar />
)}
</Suspense>
)
@@ -153,17 +133,6 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {
{...(sidebarVisible ? {} : { inert: '' })}
>
<div className="flex min-h-14 shrink-0 items-end gap-1 px-4 pt-3">
- {TODAY_MORE_PANES.includes(activePane) && (
- <Button
- size="icon-lg"
- className="-ml-2"
- aria-label="Back to More"
- data-attr="today-more-back"
- onClick={() => pickPane('more')}
- >
- <IconChevronLeft />
- </Button>
- )}
<Heading render={<h1 />} size="2xl" className="m-0 truncate leading-10">
{PANE_LABELS[activePane]}
</Heading>
diff --git a/frontend/src/layout/today/TodayTabBar.tsx b/frontend/src/layout/today/TodayTabBar.tsx
index d3f7d0b80f89..2c56ed7e328b 100644
--- a/frontend/src/layout/today/TodayTabBar.tsx
+++ b/frontend/src/layout/today/TodayTabBar.tsx
@@ -5,8 +5,8 @@ import { cn } from '@posthog/quill'
import { commandLogic } from 'lib/components/Command/commandLogic'
-import { TODAY_TAB_BAR_ITEMS } from './todayRailItems'
-import { TODAY_MORE_PANES, todayShellLogic } from './todayShellLogic'
+import { TODAY_RAIL_ITEMS } from './todayRailItems'
+import { todayShellLogic } from './todayShellLogic'
const TAB_CLASS =
'flex min-w-0 flex-1 cursor-pointer flex-col items-center justify-center gap-0.5 rounded-md text-xxs font-medium outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-inset [&_svg]:size-5'
@@ -19,8 +19,8 @@ export function TodayTabBar(): JSX.Element {
return (
<div className="TodayTabBar" data-quill>
<nav aria-label="Main" className="flex h-14 min-w-0 flex-1 gap-1">
- {TODAY_TAB_BAR_ITEMS.map(({ pane, label, icon }) => {
- const active = activePane === pane || (pane === 'more' && TODAY_MORE_PANES.includes(activePane))
+ {TODAY_RAIL_ITEMS.map(({ pane, label, icon }) => {
+ const active = activePane === pane
return (
<button
key={pane}
diff --git a/frontend/src/layout/today/TodayToolsSidebar.tsx b/frontend/src/layout/today/TodayToolsSidebar.tsx
deleted file mode 100644
index 80e82df6f9ce..000000000000
--- a/frontend/src/layout/today/TodayToolsSidebar.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import { useActions, useValues } from 'kea'
-import { router } from 'kea-router'
-
-import { Text } from '@posthog/quill'
-
-import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
-import { toolHrefForPath, toolLabel } from 'scenes/tools/toolsUtils'
-
-import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'
-import { FileSystemIconType, FileSystemImport } from '~/queries/schema/schema-general'
-
-import { TodayPaneGroupLabel } from './TodayPaneGroupLabel'
-import { TodayPaneRow } from './TodayPaneRow'
-import { TodayPaneSearchList } from './TodayPaneSearchList'
-import { todayToolsLogic } from './todayToolsLogic'
-
-export function TodayToolsSidebar(): JSX.Element {
- const { tools, toolGroups, recentTools, search } = useValues(todayToolsLogic)
- const { setSearch } = useActions(todayToolsLogic)
- const { location } = useValues(router)
- const activeHref = toolHrefForPath(removeProjectIdIfPresent(location.pathname), tools)
- const groups = [
- ...(recentTools.length ? [{ key: 'recent', label: 'Recently viewed', tools: recentTools }] : []),
- ...toolGroups.map((group) => ({ key: group.category, label: group.category, tools: group.tools })),
- ]
- // A tool can show in Recently viewed and in its own group, so the group keeps the two rows apart on the keyboard path.
- const optionValue = (groupKey: string, tool: FileSystemImport): string => `${groupKey}:${tool.href ?? ''}`
-
- return (
- <div className="TodayPane" data-quill>
- <TodayPaneSearchList
- query={search}
- onQueryChange={setSearch}
- searchLabel="Search tools"
- dataAttr="today-tools-search"
- >
- {!groups.length ? (
- <Text size="xs" variant="muted" className="block px-2 py-1">
- No tools match that search.
- </Text>
- ) : (
- groups.map((group, index) => (
- <div key={group.key}>
- <TodayPaneGroupLabel first={index === 0}>{group.label}</TodayPaneGroupLabel>
- {group.tools.map((tool) => {
- const href = tool.href ?? ''
- return (
- <TodayPaneRow
- key={href}
- value={optionValue(group.key, tool)}
- label={toolLabel(tool)}
- icon={iconForType(
- (tool.iconType ?? tool.type) as FileSystemIconType,
- tool.iconColor
- )}
- to={href}
- active={!!href && href === activeHref}
- dataAttr={group.key === 'recent' ? 'today-tool-recent' : 'today-tool'}
- />
- )
- })}
- </div>
- ))
- )}
- </TodayPaneSearchList>
- </div>
- )
-}
diff --git a/frontend/src/layout/today/todayRailItems.tsx b/frontend/src/layout/today/todayRailItems.tsx
index 9dd54518280f..591c1d57d3b1 100644
--- a/frontend/src/layout/today/todayRailItems.tsx
+++ b/frontend/src/layout/today/todayRailItems.tsx
@@ -1,6 +1,6 @@
-import { IconBook, IconChat, IconEllipsis, IconGridMasonry, IconHome, IconWrench } from '@posthog/icons'
+import { IconApps, IconChat, IconGridMasonry, IconHome } from '@posthog/icons'
-import { TODAY_MORE_PANES, TodayRailPane } from './todayShellLogic'
+import { TodayRailPane } from './todayShellLogic'
export interface TodayRailItem {
pane: TodayRailPane
@@ -12,16 +12,5 @@ export const TODAY_RAIL_ITEMS: TodayRailItem[] = [
{ pane: 'home', label: 'Home', icon: <IconHome /> },
{ pane: 'spaces', label: 'Spaces', icon: <IconChat /> },
{ pane: 'views', label: 'Views', icon: <IconGridMasonry /> },
- { pane: 'library', label: 'Library', icon: <IconBook /> },
- { pane: 'tools', label: 'Tools', icon: <IconWrench /> },
-]
-
-export const TODAY_TAB_BAR_ITEMS: TodayRailItem[] = [
- ...TODAY_RAIL_ITEMS.filter(({ pane }) => !TODAY_MORE_PANES.includes(pane)),
- { pane: 'more', label: 'More', icon: <IconEllipsis /> },
-]
-
-export const TODAY_MORE_ITEMS: (TodayRailItem & { description: string })[] = [
- { pane: 'library', label: 'Library', icon: <IconBook />, description: 'Saved insights, flags, cohorts and more' },
- { pane: 'tools', label: 'Tools', icon: <IconWrench />, description: 'The SQL editor and product tools' },
+ { pane: 'products', label: 'Products', icon: <IconApps /> },
]
diff --git a/frontend/src/layout/today/todayShellLogic.test.ts b/frontend/src/layout/today/todayShellLogic.test.ts
index 30a6f8389ef6..1e70eef0283c 100644
--- a/frontend/src/layout/today/todayShellLogic.test.ts
+++ b/frontend/src/layout/today/todayShellLogic.test.ts
@@ -17,16 +17,16 @@ describe('todayShellLogic', () => {
test.each([
['/project/1/home', 'home'],
['/project/1/home/reports/abc', 'home'],
- ['/project/1/library', 'library'],
- ['/project/1/library/feature_flag', 'library'],
+ ['/project/1/library', 'products'],
+ ['/project/1/library/feature_flag', 'products'],
['/project/1/ai', 'spaces'],
['/project/1/ai/history', 'spaces'],
['/project/1/spaces/abc', 'spaces'],
- ['/project/1/feature_flags/920847', 'library'],
- ['/project/1/insights/abc', 'library'],
- ['/project/1/feature_flags', 'library'],
- ['/project/1/data-management/destinations', 'tools'],
- ['/project/1/sql', 'tools'],
+ ['/project/1/feature_flags/920847', 'products'],
+ ['/project/1/insights/abc', 'products'],
+ ['/project/1/feature_flags', 'products'],
+ ['/project/1/data-management/destinations', 'products'],
+ ['/project/1/sql', 'products'],
['/project/1/views', 'views'],
['/project/1/canvases/abc', 'views'],
['/project/1/canvases/new', 'views'],
@@ -52,8 +52,7 @@ describe('todayShellLogic', () => {
['home', '/home'],
['spaces', '/ai'],
['views', '/views/new'],
- ['library', '/library'],
- ['tools', '/tools'],
+ ['products', '/tools'],
] as const)('opens the %s section when its rail item is picked', (pane, pathname) => {
const logic = todayShellLogic()
logic.mount()
@@ -68,9 +67,9 @@ describe('todayShellLogic', () => {
const logic = todayShellLogic()
logic.mount()
- logic.actions.pickPane('tools')
+ logic.actions.pickPane('products')
router.actions.push('/project/1/airplane')
- expect(logic.values.activePane).toBe('tools')
+ expect(logic.values.activePane).toBe('products')
router.actions.push('/project/1/ai')
expect(logic.values.activePane).toBe('spaces')
@@ -103,7 +102,7 @@ describe('todayShellLogic', () => {
expect(logic.values.sidebarVisible).toBe(false)
logic.actions.setSidebarOpen(false)
- logic.actions.pickPane('library')
+ logic.actions.pickPane('products')
expect(logic.values.sidebarVisible).toBe(true)
expect(logic.values.sidebarOpen).toBe(false)
expect(logic.values.leftNavWidth).toBe(TODAY_RAIL_WIDTH)
@@ -115,19 +114,13 @@ describe('todayShellLogic', () => {
}
})
- it('on phone widths, drops the rail width and opens More without leaving the page', () => {
+ it('on phone widths, drops the rail width', () => {
const originalWidth = window.innerWidth
Object.defineProperty(window, 'innerWidth', { configurable: true, value: 390 })
try {
const logic = todayShellLogic()
logic.mount()
expect(logic.values.leftNavWidth).toBe(0)
-
- router.actions.push('/project/1/airplane')
- logic.actions.pickPane('more')
- expect(router.values.location.pathname).toBe('/project/1/airplane')
- expect(logic.values.activePane).toBe('more')
- expect(logic.values.sidebarVisible).toBe(true)
} finally {
Object.defineProperty(window, 'innerWidth', { configurable: true, value: originalWidth })
}
@@ -164,7 +157,7 @@ describe('todayShellLogic', () => {
const logic = todayShellLogic()
logic.mount()
- logic.actions.pickPane('tools')
+ logic.actions.pickPane('products')
router.actions.push('/project/1/sql')
expect(logic.values.phoneCanGoBack).toBe(false)
router.actions.push('/project/1/sql?open_query=abc')
@@ -180,7 +173,7 @@ describe('todayShellLogic', () => {
logic.actions.goBackOnPhone()
expect(logic.values.sidebarVisible).toBe(true)
- expect(logic.values.activePane).toBe('tools')
+ expect(logic.values.activePane).toBe('products')
} finally {
Object.defineProperty(window, 'innerWidth', { configurable: true, value: originalWidth })
}
diff --git a/frontend/src/layout/today/todayShellLogic.ts b/frontend/src/layout/today/todayShellLogic.ts
index b55122ad5636..5afb933ce1b0 100644
--- a/frontend/src/layout/today/todayShellLogic.ts
+++ b/frontend/src/layout/today/todayShellLogic.ts
@@ -14,9 +14,7 @@ import { urls } from 'scenes/urls'
import { navigationLogic } from '~/layout/navigation/navigationLogic'
-export type TodayRailPane = 'home' | 'spaces' | 'views' | 'library' | 'tools' | 'more'
-
-export const TODAY_MORE_PANES: TodayRailPane[] = ['library', 'tools']
+export type TodayRailPane = 'home' | 'spaces' | 'views' | 'products'
export const TODAY_RAIL_WIDTH = 60
export const TODAY_PHONE_MAX_WIDTH = 768
@@ -37,17 +35,16 @@ function isUnder(path: string, root: string): boolean {
return path === root || path.startsWith(`${root}/`)
}
-const RAIL_PANE_HOME: Record<Exclude<TodayRailPane, 'more'>, () => string> = {
+const RAIL_PANE_HOME: Record<TodayRailPane, () => string> = {
home: () => urls.projectHomepage(),
spaces: () => urls.ai(),
views: () => urls.viewsNew(),
- library: () => urls.library(),
- tools: () => urls.tools(),
+ products: () => urls.tools(),
}
-/** The page a rail pane opens, or undefined for panes without a page of their own. */
-export function railPaneHref(pane: TodayRailPane): string | undefined {
- return pane === 'more' ? undefined : RAIL_PANE_HOME[pane]()
+/** The page a rail pane opens. */
+export function railPaneHref(pane: TodayRailPane): string {
+ return RAIL_PANE_HOME[pane]()
}
const PHONE_PAGE_LIMIT = 50
@@ -89,11 +86,13 @@ export function railPaneForPath(pathname: string): TodayRailPane | null {
) {
return 'views'
}
- if (isUnder(path, urls.library()) || libraryTypeForPath(path)) {
- return 'library'
- }
- if (isUnder(path, urls.tools()) || toolHrefForPath(path)) {
- return 'tools'
+ if (
+ isUnder(path, urls.library()) ||
+ isUnder(path, urls.tools()) ||
+ libraryTypeForPath(path) ||
+ toolHrefForPath(path)
+ ) {
+ return 'products'
}
return null
}
@@ -169,11 +168,7 @@ export interface todayShellLogicActions {
export interface todayShellLogicMeta {
__keaTypeGenInternalSelectorTypes: {
routePane: (location: { hash: string; pathname: string; search: string }) => TodayRailPane | null
- activePane: (
- pickedPane: TodayRailPane | null,
- routePane: TodayRailPane | null,
- phoneLayout: boolean
- ) => TodayRailPane
+ activePane: (pickedPane: TodayRailPane | null, routePane: TodayRailPane | null) => TodayRailPane
leftNavWidth: (
sidebarOpen: boolean,
sidebarWidth: number,
@@ -260,9 +255,9 @@ export const todayShellLogic = kea<todayShellLogicType>([
(location: { pathname: string }): TodayRailPane | null => railPaneForPath(location.pathname),
],
activePane: [
- (s) => [s.pickedPane, s.routePane, s.phoneLayout],
- (pickedPane: TodayRailPane | null, routePane: TodayRailPane | null, phoneLayout: boolean): TodayRailPane =>
- pickedPane === 'more' && !phoneLayout ? (routePane ?? 'home') : (pickedPane ?? routePane ?? 'home'),
+ (s) => [s.pickedPane, s.routePane],
+ (pickedPane: TodayRailPane | null, routePane: TodayRailPane | null): TodayRailPane =>
+ pickedPane ?? routePane ?? 'home',
],
leftNavWidth: [
(s) => [s.sidebarOpen, s.sidebarWidth, s.mobileLayout, s.phoneLayout],
@@ -340,10 +335,7 @@ export const todayShellLogic = kea<todayShellLogicType>([
pickPane: ({ pane }) => {
// pinned: analytics event name and property. Renaming them breaks dashboards.
posthog.capture('today rail pane picked', { pane, phone_layout: values.phoneLayout })
- const href = railPaneHref(pane)
- if (href) {
- router.actions.push(href)
- }
+ router.actions.push(railPaneHref(pane))
if (values.mobileLayout) {
actions.setMobileSidebarOpen(true)
} else {