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): phone section tabs for the spaces pane (#111486)

Shy Altere2bcd81702e0
diff --git a/frontend/src/layout/today/TodaySpacesSectionTabs.tsx b/frontend/src/layout/today/TodaySpacesSectionTabs.tsx
new file mode 100644
index 000000000000..d75511981661
--- /dev/null
+++ b/frontend/src/layout/today/TodaySpacesSectionTabs.tsx
@@ -0,0 +1,49 @@
+import { ReactNode } from 'react'
+
+import { Tabs, TabsList, TabsTrigger } from '@posthog/quill'
+
+import { TodayWorkSectionId } from './todaySpacesLogic'
+
+const SECTIONS: { id: TodayWorkSectionId; label: string }[] = [
+ { id: 'pinned', label: 'Pinned' },
+ { id: 'recent', label: 'Recent' },
+ { id: 'spaces', label: 'Spaces' },
+]
+
+interface TodaySpacesSectionTabsProps {
+ value: TodayWorkSectionId
+ onChange: (section: TodayWorkSectionId) => void
+ counts: Partial<Record<TodayWorkSectionId, number>>
+ actions?: ReactNode
+}
+
+export function TodaySpacesSectionTabs({ value, onChange, counts, actions }: TodaySpacesSectionTabsProps): JSX.Element {
+ return (
+ <div className="sticky top-0 z-10 -mx-3 mb-1 flex items-center border-b border-border bg-[var(--today-paper)] px-3">
+ <Tabs
+ value={value}
+ onValueChange={(next) => onChange(next as TodayWorkSectionId)}
+ className="min-w-0 flex-1"
+ >
+ <TabsList variant="line" className="!h-11 gap-4 !p-0">
+ {SECTIONS.map(({ id, label }) => (
+ <TabsTrigger
+ key={id}
+ value={id}
+ className="h-11 !px-0 text-xxs font-semibold tracking-wider uppercase"
+ data-attr={`today-spaces-tab-${id}`}
+ >
+ {label}
+ {counts[id] ? (
+ <span className="font-normal tracking-normal text-muted-foreground tabular-nums">
+ {counts[id]}
+ </span>
+ ) : null}
+ </TabsTrigger>
+ ))}
+ </TabsList>
+ </Tabs>
+ {actions && <div className="flex shrink-0 items-center">{actions}</div>}
+ </div>
+ )
+}
diff --git a/frontend/src/layout/today/TodaySpacesSidebar.tsx b/frontend/src/layout/today/TodaySpacesSidebar.tsx
index 454d7b079953..d84cf28bd773 100644
--- a/frontend/src/layout/today/TodaySpacesSidebar.tsx
+++ b/frontend/src/layout/today/TodaySpacesSidebar.tsx
@@ -13,7 +13,6 @@ import { SpacePresenceAvatars } from 'products/tasks/frontend/spaces/SpacePresen
import { TodayChatRow } from './TodayChatRow'
import { TodayListAppearanceDialog } from './TodayListAppearanceDialog'
-import { TodayPaneGroupLabel } from './TodayPaneGroupLabel'
import { TodayPaneSearchList } from './TodayPaneSearchList'
import { TodayPaneSection, TodayPaneSectionProps } from './TodayPaneSection'
import { TodayPreviewTrigger } from './TodayPreviewTrigger'
@@ -22,11 +21,13 @@ import { TodaySessionBulkBar } from './TodaySessionBulkBar'
import { TodaySessionRow } from './TodaySessionRow'
import { selectionClick } from './todaySessionSelection'
import { todaySessionSelectionLogic } from './todaySessionSelectionLogic'
+import { todayShellLogic } from './todayShellLogic'
import { todayRecentClearLabel, todaySidebarSectionState } from './todaySidebarSectionState'
import { TodaySpaceContextMenu } from './TodaySpaceContextMenu'
import { TodaySpaceGlyph } from './TodaySpaceGlyph'
import { TodayWorkSectionId, isLockedSpace, spaceLabel, todaySpacesLogic } from './todaySpacesLogic'
import { TodaySpacesRow } from './TodaySpacesRow'
+import { TodaySpacesSectionTabs } from './TodaySpacesSectionTabs'
import { TodayWorkItem } from './todayWorkItems'
import { useTodaySectionLayout } from './useTodaySectionLayout'
@@ -40,7 +41,6 @@ export function TodaySpacesSidebar(): JSX.Element {
pinnedItems,
shownPinnedItems,
shownSpaces,
- recentlyViewedSessions,
allRecentItems,
recentItems,
recentGroups,
@@ -53,9 +53,12 @@ export function TodaySpacesSidebar(): JSX.Element {
unreadSpaceIds,
spacePresence,
spacePreviews,
+ phoneSection,
+ pinnedTasksLoading,
} = useValues(todaySpacesLogic)
- const { loadSpaces, loadRecentTasks, toggleSection, setRecentQuery, clearRecentSearchAndFilters } =
+ const { loadSpaces, loadRecentTasks, toggleSection, setRecentQuery, clearRecentSearchAndFilters, setPhoneSection } =
useActions(todaySpacesLogic)
+ const { phoneLayout } = useValues(todayShellLogic)
const { openNewSpace } = useActions(newSpaceLogic)
const { selectedSessionIds } = useValues(todaySessionSelectionLogic)
const { toggleSessionSelection, selectSessionRange, clearSelection } = useActions(todaySessionSelectionLogic)
@@ -167,6 +170,219 @@ export function TodaySpacesSidebar(): JSX.Element {
</Button>
)
+ const actionSize = phoneLayout ? 'icon-lg' : 'icon-xs'
+ const spacesActions = (
+ <>
+ <Tooltip>
+ <TooltipTrigger
+ delay={0}
+ render={
+ <Button
+ size={actionSize}
+ className="text-muted-foreground"
+ aria-label="New space"
+ onClick={openNewSpace}
+ data-attr="today-new-space-open-sidebar"
+ />
+ }
+ >
+ <IconPlus />
+ </TooltipTrigger>
+ <TooltipContent>New space</TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger
+ delay={0}
+ render={
+ <Button
+ size={actionSize}
+ render={<LinkPrimitive to={urls.taskSpaces()} />}
+ aria-current={browsingSpaces ? 'page' : undefined}
+ className={cn(
+ 'text-muted-foreground',
+ browsingSpaces && 'bg-fill-selected text-foreground'
+ )}
+ aria-label="Browse spaces"
+ data-attr="today-spaces-browse"
+ />
+ }
+ >
+ <IconTableOfContents />
+ </TooltipTrigger>
+ <TooltipContent>Browse spaces</TooltipContent>
+ </Tooltip>
+ </>
+ )
+
+ const pinnedRows = shownPinnedItems.map((item) => renderItem(item, 'pinned', 'today-pinned-session', true))
+
+ const recentBody =
+ recentState === 'loading' ? (
+ loadingRows('Loading recent')
+ ) : recentState === 'error' ? (
+ loadError('Recent sessions didn’t load.', loadRecentTasks, 'today-recent-retry')
+ ) : recentState === 'empty' ? (
+ <Text size="xs" variant="muted" className="px-2 py-1">
+ Sessions and chats you open show up here. Start one with New chat.
+ </Text>
+ ) : recentState === 'no-matches' ? (
+ notice(
+ 'No matches',
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={clearRecentSearchAndFilters}
+ data-attr="today-recent-clear-filters"
+ >
+ {todayRecentClearLabel(recentQuery !== '', recentFiltersActive)}
+ </Button>
+ )
+ ) : (
+ <>
+ {recentTasksUnavailable &&
+ loadError('Some sessions didn’t load.', loadRecentTasks, 'today-recent-retry')}
+ {recentGroups.map((group, index) => (
+ <Fragment key={group.key}>
+ {group.label && (
+ <Text
+ size="xs"
+ weight="medium"
+ variant="muted"
+ className={cn('block px-2 pb-1', index === 0 ? 'pt-1' : 'pt-3')}
+ >
+ {group.label}
+ </Text>
+ )}
+ {group.items.map((item) =>
+ renderItem(
+ item,
+ 'recent',
+ item.kind === 'chat' ? 'today-recent-chat' : 'today-recent-session'
+ )
+ )}
+ </Fragment>
+ ))}
+ </>
+ )
+
+ const spacesBody =
+ spacesState === 'loading' ? (
+ loadingRows('Loading spaces')
+ ) : spacesState === 'error' ? (
+ loadError('Spaces didn’t load.', loadSpaces, 'today-spaces-retry')
+ ) : spacesState === 'empty' ? (
+ notice(
+ 'Spaces you star show up here.',
+ <>
+ <Button variant="outline" size="sm" onClick={openNewSpace} data-attr="today-spaces-empty-new-space">
+ <IconPlus />
+ New space…
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ render={<LinkPrimitive to={urls.taskSpaces()} />}
+ data-attr="today-spaces-add"
+ >
+ Browse spaces
+ </Button>
+ </>
+ )
+ ) : (
+ <>
+ {spacesUnavailable && loadError('Spaces didn’t refresh.', loadSpaces, 'today-spaces-retry')}
+ {shownSpaces.map((space) => {
+ const presence = spacePresence[space.id]
+ return (
+ <TodaySpaceContextMenu key={space.id} space={space}>
+ <TodayPreviewTrigger payload={spacePreviews[space.id]}>
+ <TodaySpacesRow
+ label={spaceLabel(space)}
+ icon={
+ <TodaySpaceGlyph
+ locked={isLockedSpace(space)}
+ className="text-muted-foreground"
+ />
+ }
+ to={urls.taskSpace(space.id)}
+ active={location.pathname.includes(urls.taskSpace(space.id))}
+ dataAttr="today-space-row"
+ optionValue={`space:${space.id}`}
+ badge={presence ? <SpacePresenceAvatars presence={presence} /> : null}
+ badgeCount={Math.min(presence?.people.length ?? 1, 3) as 1 | 2 | 3}
+ unread={unreadSpaceIds.has(space.id)}
+ />
+ </TodayPreviewTrigger>
+ </TodaySpaceContextMenu>
+ )
+ })}
+ {visibleSpaces.length === 1 && (
+ <Button
+ variant="outline"
+ size="sm"
+ className="mt-1 self-start"
+ data-attr="today-spaces-add"
+ render={<LinkPrimitive to={urls.taskSpaces()} />}
+ >
+ <IconPlus />
+ Add the spaces you work in
+ </Button>
+ )}
+ </>
+ )
+
+ if (phoneLayout) {
+ const pinnedBody =
+ pinnedTasksLoading && pinnedItems.length === 0 ? (
+ loadingRows('Loading pinned')
+ ) : pinnedItems.length === 0 ? (
+ <Text size="sm" variant="muted" className="px-2 py-2">
+ Pinned sessions show up here. To pin a session, press and hold it, then pick Pin.
+ </Text>
+ ) : shownPinnedItems.length === 0 ? (
+ <Text size="sm" variant="muted" className="px-2 py-2">
+ No pinned sessions match your search.
+ </Text>
+ ) : (
+ pinnedRows
+ )
+ return (
+ <TooltipProvider>
+ <div className="TodayPane" data-quill>
+ <TodayPaneSearchList
+ query={recentQuery}
+ onQueryChange={setRecentQuery}
+ searchLabel="Search sessions and spaces"
+ dataAttr="today-recent-search"
+ listClassName="mt-1 flex flex-col pb-4"
+ >
+ <TodaySpacesSectionTabs
+ value={phoneSection}
+ onChange={setPhoneSection}
+ counts={{ pinned: pinnedItems.length, spaces: visibleSpaces.length }}
+ actions={
+ phoneSection === 'recent' ? (
+ <TodayRecentFilterMenu />
+ ) : phoneSection === 'spaces' ? (
+ spacesActions
+ ) : null
+ }
+ />
+ <div className="flex flex-col gap-px" data-attr={`today-spaces-tab-panel-${phoneSection}`}>
+ {phoneSection === 'pinned'
+ ? pinnedBody
+ : phoneSection === 'recent'
+ ? recentBody
+ : spacesBody}
+ </div>
+ </TodayPaneSearchList>
+ <TodaySessionBulkBar />
+ <TodayListAppearanceDialog />
+ </div>
+ </TooltipProvider>
+ )
+ }
+
return (
<TooltipProvider>
<div className="TodayPane" data-quill>
@@ -178,14 +394,6 @@ export function TodaySpacesSidebar(): JSX.Element {
searchActions={<TodayRecentFilterMenu />}
listClassName="flex flex-col overflow-hidden pb-0"
>
- {recentlyViewedSessions.length > 0 && (
- <div className="shrink-0 pb-2">
- <TodayPaneGroupLabel first>Recently viewed</TodayPaneGroupLabel>
- {recentlyViewedSessions.map((item) =>
- renderItem(item, 'viewed', 'today-recently-viewed-session')
- )}
- </div>
- )}
<div className="flex min-h-0 flex-1 flex-col overflow-hidden" ref={layout.measureRefs.area}>
{hasPinned && (
<TodayPaneSection
@@ -195,9 +403,7 @@ export function TodaySpacesSidebar(): JSX.Element {
onToggle={() => toggleSection('pinned')}
dataAttr="today-section-pinned"
>
- {shownPinnedItems.map((item) =>
- renderItem(item, 'pinned', 'today-pinned-session', true)
- )}
+ {pinnedRows}
</TodayPaneSection>
)}
<TodayPaneSection
@@ -208,53 +414,7 @@ export function TodaySpacesSidebar(): JSX.Element {
divider={hasPinned}
dataAttr="today-section-recent"
>
- {recentState === 'loading' ? (
- loadingRows('Loading recent')
- ) : recentState === 'error' ? (
- loadError('Recent sessions didn’t load.', loadRecentTasks, 'today-recent-retry')
- ) : recentState === 'empty' ? (
- <Text size="xs" variant="muted" className="px-2 py-1">
- Sessions and chats you open show up here. Start one with New chat.
- </Text>
- ) : recentState === 'no-matches' ? (
- notice(
- 'No matches',
- <Button
- variant="outline"
- size="sm"
- onClick={clearRecentSearchAndFilters}
- data-attr="today-recent-clear-filters"
- >
- {todayRecentClearLabel(recentQuery !== '', recentFiltersActive)}
- </Button>
- )
- ) : (
- <>
- {recentTasksUnavailable &&
- loadError('Some sessions didn’t load.', loadRecentTasks, 'today-recent-retry')}
- {recentGroups.map((group, index) => (
- <Fragment key={group.key}>
- {group.label && (
- <Text
- size="xs"
- weight="medium"
- variant="muted"
- className={cn('block px-2 pb-1', index === 0 ? 'pt-1' : 'pt-3')}
- >
- {group.label}
- </Text>
- )}
- {group.items.map((item) =>
- renderItem(
- item,
- 'recent',
- item.kind === 'chat' ? 'today-recent-chat' : 'today-recent-session'
- )
- )}
- </Fragment>
- ))}
- </>
- )}
+ {recentBody}
</TodayPaneSection>
<TodayPaneSection
label="Spaces"
@@ -263,125 +423,9 @@ export function TodaySpacesSidebar(): JSX.Element {
onToggle={() => toggleSection('spaces')}
divider
dataAttr="today-section-spaces"
- actions={
- <>
- <Tooltip>
- <TooltipTrigger
- delay={0}
- render={
- <Button
- size="icon-xs"
- className="text-muted-foreground"
- aria-label="New space"
- onClick={openNewSpace}
- data-attr="today-new-space-open-sidebar"
- />
- }
- >
- <IconPlus />
- </TooltipTrigger>
- <TooltipContent>New space</TooltipContent>
- </Tooltip>
- <Tooltip>
- <TooltipTrigger
- delay={0}
- render={
- <Button
- size="icon-xs"
- render={<LinkPrimitive to={urls.taskSpaces()} />}
- aria-current={browsingSpaces ? 'page' : undefined}
- className={cn(
- 'text-muted-foreground',
- browsingSpaces && 'bg-fill-selected text-foreground'
- )}
- aria-label="Browse spaces"
- data-attr="today-spaces-browse"
- />
- }
- >
- <IconTableOfContents />
- </TooltipTrigger>
- <TooltipContent>Browse spaces</TooltipContent>
- </Tooltip>
- </>
- }
+ actions={spacesActions}
>
- {spacesState === 'loading' ? (
- loadingRows('Loading spaces')
- ) : spacesState === 'error' ? (
- loadError('Spaces didn’t load.', loadSpaces, 'today-spaces-retry')
- ) : spacesState === 'empty' ? (
- notice(
- 'Spaces you star show up here.',
- <>
- <Button
- variant="outline"
- size="sm"
- onClick={openNewSpace}
- data-attr="today-spaces-empty-new-space"
- >
- <IconPlus />
- New space…
- </Button>
- <Button
- variant="outline"
- size="sm"
- render={<LinkPrimitive to={urls.taskSpaces()} />}
- data-attr="today-spaces-add"
- >
- Browse spaces
- </Button>
- </>
- )
- ) : (
- <>
- {spacesUnavailable &&
- loadError('Spaces didn’t refresh.', loadSpaces, 'today-spaces-retry')}
- {shownSpaces.map((space) => {
- const presence = spacePresence[space.id]
- return (
- <TodaySpaceContextMenu key={space.id} space={space}>
- <TodayPreviewTrigger payload={spacePreviews[space.id]}>
- <TodaySpacesRow
- label={spaceLabel(space)}
- icon={
- <TodaySpaceGlyph
- locked={isLockedSpace(space)}
- className="text-muted-foreground"
- />
- }
- to={urls.taskSpace(space.id)}
- active={location.pathname.includes(urls.taskSpace(space.id))}
- dataAttr="today-space-row"
- optionValue={`space:${space.id}`}
- badge={
- presence ? (
- <SpacePresenceAvatars presence={presence} />
- ) : null
- }
- badgeCount={
- Math.min(presence?.people.length ?? 1, 3) as 1 | 2 | 3
- }
- unread={unreadSpaceIds.has(space.id)}
- />
- </TodayPreviewTrigger>
- </TodaySpaceContextMenu>
- )
- })}
- {visibleSpaces.length === 1 && (
- <Button
- variant="outline"
- size="sm"
- className="mt-1 self-start"
- data-attr="today-spaces-add"
- render={<LinkPrimitive to={urls.taskSpaces()} />}
- >
- <IconPlus />
- Add the spaces you work in
- </Button>
- )}
- </>
- )}
+ {spacesBody}
</TodayPaneSection>
</div>
</TodayPaneSearchList>
diff --git a/frontend/src/layout/today/todayRecentsLogic.ts b/frontend/src/layout/today/todayRecentsLogic.ts
index d213af5104fa..e34434d7c6db 100644
--- a/frontend/src/layout/today/todayRecentsLogic.ts
+++ b/frontend/src/layout/today/todayRecentsLogic.ts
@@ -25,7 +25,6 @@ function pushRecent(list: string[], value: string): string[] {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface todayRecentsLogicValues {
recents: FileSystemEntry[] // recentItemsModel
- recentSessionIds: string[]
recentToolHrefs: string[]
recentViewEntries: TodayRecentEntry[]
}
@@ -39,9 +38,6 @@ export interface todayRecentsLogicActions {
pathname: string
searchParams: Record<string, any>
}
- recordSessionVisit: (sessionId: string) => {
- sessionId: string
- }
recordToolVisit: (href: string) => {
href: string
}
@@ -89,14 +85,13 @@ export type todayRecentsLogicType = MakeLogicType<
/**
* What the sidebar panes list as recently viewed. Views reads the project's recently viewed objects.
- * Tools and sessions have no server record of views, so this browser keeps one as the user moves between pages.
+ * Tools have no server record of views, so this browser keeps one as the user moves between pages.
*/
export const todayRecentsLogic = kea<todayRecentsLogicType>([
path(['layout', 'today', 'todayRecentsLogic']),
connect(() => ({ values: [recentItemsModel, ['recents']] })),
actions({
recordToolVisit: (href: string) => ({ href }),
- recordSessionVisit: (sessionId: string) => ({ sessionId }),
recordLocation: (pathname: string, searchParams: Record<string, any>) => ({ pathname, searchParams }),
}),
reducers({
@@ -106,11 +101,6 @@ export const todayRecentsLogic = kea<todayRecentsLogicType>([
{ persist: true },
{ recordToolVisit: (state, { href }) => pushRecent(state, href) },
],
- recentSessionIds: [
- [] as string[],
- { persist: true },
- { recordSessionVisit: (state, { sessionId }) => pushRecent(state, sessionId) },
- ],
}),
selectors({
recentViewEntries: [
@@ -129,15 +119,12 @@ export const todayRecentsLogic = kea<todayRecentsLogicType>([
],
}),
listeners(({ actions }) => ({
- recordLocation: ({ pathname, searchParams }) => {
+ recordLocation: ({ pathname }) => {
const path = removeProjectIdIfPresent(pathname)
const toolHref = toolHrefForPath(path)
if (toolHref) {
actions.recordToolVisit(toolHref)
}
- if (path === '/ai' && typeof searchParams.task === 'string') {
- actions.recordSessionVisit(searchParams.task)
- }
},
[router.actionTypes.locationChanged]: ({ pathname, searchParams }: LocationChangedPayload) => {
actions.recordLocation(pathname, searchParams)
diff --git a/frontend/src/layout/today/todaySpacesLogic.ts b/frontend/src/layout/today/todaySpacesLogic.ts
index 3cac516b2317..0b94f5e56785 100644
--- a/frontend/src/layout/today/todaySpacesLogic.ts
+++ b/frontend/src/layout/today/todaySpacesLogic.ts
@@ -2,6 +2,7 @@ import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, redu
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import type { LocationChangedPayload } from 'kea-router/lib/types'
+import posthog from 'posthog-js'
import { toast } from '@posthog/quill'
@@ -56,7 +57,6 @@ import {
groupRecentItems,
sortRecentItems,
} from './todayRecentOrder'
-import { todayRecentsLogic } from './todayRecentsLogic'
import {
TodayWorkItem,
buildRecentItems,
@@ -132,12 +132,12 @@ export interface todaySpacesLogicValues {
conversationHistory: ConversationDetail[] // maxGlobalLogic
conversationHistoryLoading: boolean // maxGlobalLogic
currentTeamId: number | null // teamLogic
- recentSessionIds: string[] // todayRecentsLogic
user: UserType | null // userLogic
allRecentItems: TodayWorkItem[]
collapsedSections: TodayWorkSectionId[]
lastSpaceId: string | null
pendingSpaceIds: string[]
+ phoneSection: TodayWorkSectionId
pinnedItems: TodayWorkItem[]
pinnedTasks: TaskListItemApi[]
pinnedTasksLoading: boolean
@@ -154,7 +154,6 @@ export interface todaySpacesLogicValues {
recentTasks: TaskListItemApi[]
recentTasksLoading: boolean
recentTasksUnavailable: boolean
- recentlyViewedSessions: TodayWorkItem[]
sectionHeights: Partial<Record<TodayWorkSectionId, number>>
shownPinnedItems: TodayWorkItem[]
shownSpaces: ChannelDTOApi[]
@@ -309,6 +308,9 @@ export interface todaySpacesLogicActions {
lower: TodayWorkSectionId
upper: TodayWorkSectionId
}
+ setPhoneSection: (section: TodayWorkSectionId) => {
+ section: TodayWorkSectionId
+ }
setPullRequestStates: (states: Record<string, PrStateEnumApi>) => {
states: Record<string, PrStateEnumApi>
}
@@ -360,11 +362,6 @@ export interface todaySpacesLogicMeta {
recentSourceOptions: (allRecentItems: TodayWorkItem[], recentFilters: TodayRecentFilters) => string[]
shownPinnedItems: (pinnedItems: TodayWorkItem[], recentQuery: string) => TodayWorkItem[]
shownSpaces: (visibleSpaces: ChannelDTOApi[], recentQuery: string) => ChannelDTOApi[]
- recentlyViewedSessions: (
- recentSessionIds: string[],
- allRecentItems: TodayWorkItem[],
- recentQuery: string
- ) => TodayWorkItem[]
recentFiltersActive: (recentFilters: TodayRecentFilters) => boolean
unreadSessionIds: (taskActivity: TaskActivityDTOApi[]) => Set<string>
recentItems: (
@@ -412,13 +409,12 @@ export const todaySpacesLogic = kea<todaySpacesLogicType>([
['user'],
maxGlobalLogic,
['conversationHistory', 'conversationHistoryLoading'],
- todayRecentsLogic,
- ['recentSessionIds'],
],
actions: [router, ['locationChanged']],
})),
actions({
toggleSection: (sectionId: TodayWorkSectionId) => ({ sectionId }),
+ setPhoneSection: (section: TodayWorkSectionId) => ({ section }),
setSectionHeights: (heights: Partial<Record<TodayWorkSectionId, number>>) => ({ heights }),
resetSectionPair: (upper: TodayWorkSectionId, lower: TodayWorkSectionId) => ({ upper, lower }),
spaceVisited: (spaceId: string) => ({ spaceId }),
@@ -531,6 +527,11 @@ export const todaySpacesLogic = kea<todaySpacesLogicType>([
state.includes(sectionId) ? state.filter((id) => id !== sectionId) : [...state, sectionId],
},
],
+ phoneSection: [
+ 'recent' as TodayWorkSectionId,
+ { persist: true },
+ { setPhoneSection: (_, { section }) => section },
+ ],
sectionHeights: [
{} as Partial<Record<TodayWorkSectionId, number>>,
{ persist: true },
@@ -627,14 +628,6 @@ export const todaySpacesLogic = kea<todaySpacesLogicType>([
(visibleSpaces: ChannelDTOApi[], recentQuery: string): ChannelDTOApi[] =>
visibleSpaces.filter((space) => matchesPaneQuery(spaceLabel(space), recentQuery)),
],
- // A session outside the loaded Recent list has no title or status to show, so it waits until it loads.
- recentlyViewedSessions: [
- (s) => [s.recentSessionIds, s.allRecentItems, s.recentQuery],
- (recentSessionIds: string[], allRecentItems: TodayWorkItem[], recentQuery: string): TodayWorkItem[] =>
- recentSessionIds
- .flatMap((id) => allRecentItems.find((item) => item.kind === 'session' && item.id === id) ?? [])
- .filter((item) => matchesPaneQuery(item.title || '', recentQuery)),
- ],
recentFiltersActive: [
(s) => [s.recentFilters],
(recentFilters: TodayRecentFilters): boolean => hasActiveRecentFilters(recentFilters),
@@ -755,6 +748,9 @@ export const todaySpacesLogic = kea<todaySpacesLogicType>([
}
}),
listeners(({ actions, values }) => ({
+ setPhoneSection: ({ section }) => {
+ posthog.capture('today spaces section picked', { section })
+ },
loadPinnedTasksSuccess: ({ pinnedTasks }) =>
actions.loadPullRequestStates(sessionIdsWithPullRequests(pinnedTasks)),
loadRecentTasksSuccess: ({ recentTasks }) =>