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): welcome an empty space feed with suggestions like desktop (#110100)

Shy Alter233a847fc3f0
diff --git a/products/tasks/frontend/spaces/SpaceFeed.tsx b/products/tasks/frontend/spaces/SpaceFeed.tsx
index 5a05eb600eb0..c1750cad1ce1 100644
--- a/products/tasks/frontend/spaces/SpaceFeed.tsx
+++ b/products/tasks/frontend/spaces/SpaceFeed.tsx
@@ -13,6 +13,7 @@ import { SpaceFeedListRow } from './SpaceFeedListRow'
import { SpaceFeedPullRequestRow } from './SpaceFeedPullRequestRow'
import { SpaceFeedSkeleton } from './SpaceFeedSkeleton'
import { spaceFeedViewLogic } from './spaceFeedViewLogic'
+import { SpaceFeedWelcome } from './SpaceFeedWelcome'
import { SpaceFeedSourceStatus, spaceSceneLogic } from './spaceSceneLogic'
const EMPTY_NOUNS: Record<SpaceFeedType, string> = { task: 'sessions', canvas: 'canvases', pr: 'pull requests' }
@@ -21,11 +22,7 @@ const EMPTY_NOUNS: Record<SpaceFeedType, string> = { task: 'sessions', canvas: '
function emptyNote(types: SpaceFeedType[]): string {
const nouns = SPACE_FEED_TYPES.filter(({ value }) => types.includes(value)).map(({ value }) => EMPTY_NOUNS[value])
const last = nouns.pop()
- const note = `No ${nouns.length ? `${nouns.join(', ')} or ${last}` : last} in this space yet.`
- if (!types.includes('task')) {
- return note
- }
- return `${note} ${nouns.length ? 'Start a session' : 'Start one'} from the composer above.`
+ return `No ${nouns.length ? `${nouns.join(', ')} or ${last}` : last} in this space yet.`
}
export function SpaceFeed({ id }: { id: string }): JSX.Element {
@@ -88,7 +85,9 @@ export function SpaceFeed({ id }: { id: string }): JSX.Element {
</div>
)}
{feedPending && <SpaceFeedSkeleton listRows={listRows} />}
- {feedEmpty && (
+ {feedEmpty && !filtersActive && emptyTypes.includes('task') ? (
+ <SpaceFeedWelcome id={id} />
+ ) : feedEmpty ? (
<div className="flex flex-col items-center gap-2 px-2 py-6 text-center">
<Text size="sm" variant="muted">
{filtersActive ? 'Nothing here matches these filters.' : emptyNote(emptyTypes)}
@@ -104,7 +103,7 @@ export function SpaceFeed({ id }: { id: string }): JSX.Element {
</Button>
)}
</div>
- )}
+ ) : null}
{feedSections.map((section) => {
const entries = section.entries.filter(
(entry) => entry.kind === 'canvas' || sessionsById[entry.item.id]
diff --git a/products/tasks/frontend/spaces/SpaceFeedWelcome.tsx b/products/tasks/frontend/spaces/SpaceFeedWelcome.tsx
new file mode 100644
index 000000000000..75edb05e66d8
--- /dev/null
+++ b/products/tasks/frontend/spaces/SpaceFeedWelcome.tsx
@@ -0,0 +1,137 @@
+import { useActions, useValues } from 'kea'
+
+import {
+ IconBug,
+ IconCode,
+ IconDashboard,
+ IconFlask,
+ IconMessage,
+ IconPiggyBank,
+ IconTrends,
+ IconWrench,
+} from '@posthog/icons'
+import {
+ Empty,
+ EmptyContent,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
+ Item,
+ ItemContent,
+ ItemDescription,
+ ItemMedia,
+ ItemTitle,
+ Text,
+} from '@posthog/quill'
+
+import { spaceSceneLogic } from './spaceSceneLogic'
+
+interface SpaceSuggestion {
+ label: string
+ description: string
+ prompt: string
+ Icon: typeof IconBug
+}
+
+const SPACE_SUGGESTIONS: SpaceSuggestion[] = [
+ {
+ label: 'Debug a user issue',
+ description: 'Trace a specific user’s events, replays, and errors',
+ Icon: IconBug,
+ prompt: 'Help me debug an issue a specific user is hitting. Pull their recent events, session replays, and errors, then figure out what went wrong. Build a canvas that explains what you found and the evidence behind it.\n\n\nUser input:\n- Describe the user issue:\n- User identifier (distinct ID, email address, etc):',
+ },
+ {
+ label: 'Run a feature analysis',
+ description: 'Adoption, engagement, and retention of a feature',
+ Icon: IconTrends,
+ prompt: 'Analyze how a feature is performing: adoption, engagement, and retention of users who use it vs. those who don’t. Build a canvas that explains what you found, with the charts behind it.\n\n\nUser input:\n- Feature to analyze:\n- Time period (optional):',
+ },
+ {
+ label: 'Understand revenue patterns',
+ description: 'Trends over time, by plan, and by cohort',
+ Icon: IconPiggyBank,
+ prompt: 'Analyze our revenue trends. Break it down over time, by plan, and by cohort, and call out notable changes and likely drivers. Build a canvas that explains what you found, with the charts behind it.\n\n\nUser input:\n- What revenue question are you trying to answer:\n- Time period (optional):',
+ },
+ {
+ label: 'Build a canvas',
+ description: 'Research a question and explain the answer',
+ Icon: IconDashboard,
+ prompt: 'Research a question about our product, then build a canvas that explains the answer. Include the charts that show it and short written context for what they mean.\n\n\nUser input:\n- What should the canvas explain:\n- Time period (optional):',
+ },
+ {
+ label: 'Summarize user & agent feedback',
+ description: 'Common themes across recent feedback',
+ Icon: IconMessage,
+ prompt: 'Summarize recent user and support/agent feedback. Surface the common themes, complaints, and requests. Build a canvas that explains the themes, with examples behind each one.\n\n\nUser input:\n- Feedback source or topic to focus on:\n- Time period (optional):',
+ },
+ {
+ label: 'Interpret experiment results',
+ description: 'Significance and what to do next',
+ Icon: IconFlask,
+ prompt: 'Interpret the results of an experiment. Explain what the metrics show, whether it’s significant, and what to do next. Build a canvas that explains the result and your recommendation.\n\n\nUser input:\n- Experiment name or key:\n- What decision are you trying to make (optional):',
+ },
+ {
+ label: 'Fix a bug',
+ description: 'Track down and fix a problem in the code',
+ Icon: IconWrench,
+ prompt: 'Help me fix a bug. Track down the root cause in the code and implement a fix. Open a PR if appropriate.\n\n\nUser input:\n- Describe the bug / what’s going wrong:\n- Steps to reproduce (optional):\n- Where it happens (file, page, area, optional):',
+ },
+ {
+ label: 'Build a new feature',
+ description: 'Design and implement something new',
+ Icon: IconCode,
+ prompt: 'Help me build a new feature. Propose an approach, then implement it. Open a PR if appropriate.\n\n\nUser input:\n- Describe the feature you want:\n- Any constraints or requirements (optional):',
+ },
+]
+
+export function SpaceFeedWelcome({ id }: { id: string }): JSX.Element {
+ const { space } = useValues(spaceSceneLogic({ id }))
+ const { applySuggestion } = useActions(spaceSceneLogic({ id }))
+ const title =
+ space?.system_role === 'personal'
+ ? 'Welcome to your personal space'
+ : space
+ ? `Welcome to ${space.name}`
+ : 'Welcome'
+
+ return (
+ <Empty className="mt-4 gap-6" data-attr="today-space-welcome">
+ <EmptyHeader>
+ <EmptyTitle>{title}</EmptyTitle>
+ <EmptyDescription>
+ Start a session from the composer above, or pick a suggestion to fill it in.
+ </EmptyDescription>
+ </EmptyHeader>
+ <EmptyContent className="w-full max-w-none items-stretch gap-2">
+ <Text size="sm" weight="medium" variant="muted" className="px-1 text-left">
+ Suggestions
+ </Text>
+ <div className="grid grid-cols-1 gap-2 @lg/main-content:grid-cols-2">
+ {SPACE_SUGGESTIONS.map(({ label, description, prompt, Icon }) => (
+ <Item
+ key={label}
+ variant="outline"
+ size="sm"
+ className="flex-nowrap text-left hover:bg-fill-hover"
+ render={
+ <button
+ type="button"
+ onClick={() => applySuggestion(prompt)}
+ data-attr="today-space-suggestion"
+ />
+ }
+ >
+ <ItemMedia variant="icon">
+ <Icon />
+ </ItemMedia>
+ <ItemContent className="min-w-0">
+ <ItemTitle className="w-full truncate">{label}</ItemTitle>
+ <ItemDescription className="line-clamp-1">{description}</ItemDescription>
+ </ItemContent>
+ </Item>
+ ))}
+ </div>
+ </EmptyContent>
+ </Empty>
+ )
+}
diff --git a/products/tasks/frontend/spaces/SpaceScene.tsx b/products/tasks/frontend/spaces/SpaceScene.tsx
index 04042e811ec9..cb4568948ea9 100644
--- a/products/tasks/frontend/spaces/SpaceScene.tsx
+++ b/products/tasks/frontend/spaces/SpaceScene.tsx
@@ -32,7 +32,7 @@ import { spaceLabel } from '~/layout/today/todaySpacesLogic'
import { EmbeddedTaskComposer } from 'products/posthog_ai/frontend/api/runner'
import { SpaceFeed } from './SpaceFeed'
-import { SpaceSceneLogicProps, SpaceTab, spaceSceneLogic } from './spaceSceneLogic'
+import { SpaceSceneLogicProps, SpaceTab, spaceComposerPanelId, spaceSceneLogic } from './spaceSceneLogic'
import { SpaceSettings } from './SpaceSettings'
const SPACE_COMPOSER_OVERRIDE = {
@@ -157,7 +157,7 @@ export function SpaceScene({ id }: SpaceSceneLogicProps): JSX.Element {
<div className="mb-1 border-b border-border pb-4" data-attr="today-space-new-task">
<EmbeddedTaskComposer
key={space.id}
- panelId={`space-${space.id}`}
+ panelId={spaceComposerPanelId(id)}
channelId={space.id}
initialRepositoryConfig={composerRepositoryConfig}
composerOverride={SPACE_COMPOSER_OVERRIDE}
diff --git a/products/tasks/frontend/spaces/spaceSceneLogic.test.ts b/products/tasks/frontend/spaces/spaceSceneLogic.test.ts
index 02f8ace8fc3e..dfd9d3f201b9 100644
--- a/products/tasks/frontend/spaces/spaceSceneLogic.test.ts
+++ b/products/tasks/frontend/spaces/spaceSceneLogic.test.ts
@@ -11,11 +11,12 @@ import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
import type { CanvasApi } from 'products/canvas/frontend/generated/api.schemas'
+import { composerSeedLogic } from 'products/posthog_ai/frontend/api/logics'
import { TaskListItemApi } from '../generated/api.schemas'
import { DEFAULT_SPACE_FEED_FILTERS, SpaceFeedFilters, SpaceFeedType } from './spaceFeedEntries'
import { spaceFeedViewLogic } from './spaceFeedViewLogic'
-import { AutoArchiveSelection, SpaceFeedStatus, spaceSceneLogic } from './spaceSceneLogic'
+import { AutoArchiveSelection, SpaceFeedStatus, spaceComposerPanelId, spaceSceneLogic } from './spaceSceneLogic'
describe('spaceSceneLogic', () => {
let sessionSpace = 'space-a'
@@ -479,6 +480,22 @@ describe('spaceSceneLogic', () => {
expect(other.values.composerFocusRequest).toBe(0)
})
+ it('fills this space’s composer with a suggestion without sending it', async () => {
+ const logic = spaceSceneLogic({ id: 'space-a' })
+ logic.mount()
+ spaceSceneLogic({ id: 'space-b' }).mount()
+
+ logic.actions.applySuggestion('Fix the flaky test')
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(composerSeedLogic({ panelId: spaceComposerPanelId('space-a') }).values.seed).toEqual({
+ prompt: 'Fix the flaky test',
+ autoSubmit: false,
+ })
+ expect(composerSeedLogic({ panelId: spaceComposerPanelId('space-b') }).values.seed).toBeNull()
+ expect(logic.values.composerFocusRequest).toBe(1)
+ })
+
it.each([
['a preset', 14, null, 14],
['a custom value', 'custom', 45, 45],
diff --git a/products/tasks/frontend/spaces/spaceSceneLogic.ts b/products/tasks/frontend/spaces/spaceSceneLogic.ts
index 78dc7e5a3eb8..a867c89739e7 100644
--- a/products/tasks/frontend/spaces/spaceSceneLogic.ts
+++ b/products/tasks/frontend/spaces/spaceSceneLogic.ts
@@ -19,6 +19,7 @@ import { Breadcrumb, TeamPublicType, TeamType, UserType } from '~/types'
import { canvasesList } from 'products/canvas/frontend/generated/api'
import type { CanvasApi } from 'products/canvas/frontend/generated/api.schemas'
+import { ComposerSeed, composerSeedLogic } from 'products/posthog_ai/frontend/api/logics'
import type { EmbeddedTaskComposerProps } from 'products/posthog_ai/frontend/api/runner'
import {
@@ -90,6 +91,10 @@ export interface SpaceSceneLogicProps {
export type SpaceComposerRepositoryConfig = EmbeddedTaskComposerProps['initialRepositoryConfig']
+export function spaceComposerPanelId(spaceId: string): string {
+ return `space-${spaceId}`
+}
+
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface spaceSceneLogicValues {
filters: SpaceFeedFilters // spaceFeedViewLogic
@@ -148,6 +153,9 @@ export interface spaceSceneLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface spaceSceneLogicActions {
+ setSeed: (seed: ComposerSeed) => {
+ seed: ComposerSeed
+ } // composerSeedLogic
setTypes: (types: SpaceFeedType[]) => {
types: SpaceFeedType[]
} // spaceFeedViewLogic
@@ -166,6 +174,9 @@ export interface spaceSceneLogicActions {
spaces: ChannelDTOApi[]
} // todaySpacesLogic
loadTaskActivity: (_?: void | undefined) => void // todaySpacesLogic
+ applySuggestion: (prompt: string) => {
+ prompt: string
+ }
commitName: () => {
value: true
}
@@ -371,7 +382,7 @@ export const spaceSceneLogic = kea<spaceSceneLogicType>([
path((id) => ['products', 'tasks', 'spaces', 'spaceSceneLogic', id]),
props({} as SpaceSceneLogicProps),
key((props) => props.id),
- connect(() => ({
+ connect((props: SpaceSceneLogicProps) => ({
values: [
teamLogic,
['currentTeam', 'currentTeamId'],
@@ -389,6 +400,8 @@ export const spaceSceneLogic = kea<spaceSceneLogicType>([
['sessionUpdated'],
todaySpacesLogic,
['loadSpaces', 'loadSpacesSuccess', 'loadTaskActivity', 'loadPullRequestStates'],
+ composerSeedLogic({ panelId: spaceComposerPanelId(props.id) }),
+ ['setSeed'],
],
})),
actions({
@@ -399,6 +412,7 @@ export const spaceSceneLogic = kea<spaceSceneLogicType>([
savingFinished: true,
sessionStarted: (sessionId: string) => ({ sessionId }),
focusComposer: true,
+ applySuggestion: (prompt: string) => ({ prompt }),
setAutoArchiveSelection: (selection: AutoArchiveSelection) => ({ selection }),
setAutoArchiveCustomDays: (days: number | null) => ({ days }),
saveAutoArchiveCustomDays: true,
@@ -739,6 +753,10 @@ export const spaceSceneLogic = kea<spaceSceneLogicType>([
sessionUpdated: () => {
actions.loadSessions()
},
+ applySuggestion: ({ prompt }) => {
+ actions.setSeed({ prompt, autoSubmit: false })
+ actions.focusComposer()
+ },
setTypes: () => {
actions.ensureCanvases()
actions.loadPullRequestTitles()