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): expand prompts on space feed cards like desktop (#109829)

Shy Alter16ea66ab0859
diff --git a/products/tasks/frontend/spaces/SpaceFeedCard.tsx b/products/tasks/frontend/spaces/SpaceFeedCard.tsx
index 550947745f6c..3ffda249eaeb 100644
--- a/products/tasks/frontend/spaces/SpaceFeedCard.tsx
+++ b/products/tasks/frontend/spaces/SpaceFeedCard.tsx
@@ -30,6 +30,7 @@ import { todaySpacesLogic } from '~/layout/today/todaySpacesLogic'
import { sessionItem, sessionMenuTarget, shortTimeAgo } from '~/layout/today/todayWorkItems'
import { TaskListItemApi } from '../generated/api.schemas'
+import { SpaceFeedCardPrompt } from './SpaceFeedCardPrompt'
import { spaceFeedPreview } from './spaceFeedPreview'
import { spaceFeedStatus } from './spaceFeedStatus'
import { SpaceFeedStatusIcon } from './SpaceFeedStatusIcon'
@@ -63,7 +64,7 @@ export function SpaceFeedCard({ task, pinned, unread, repository }: SpaceFeedCar
const card = (
<Card
size="sm"
- className="group/card relative my-1.5 gap-0 rounded-xl px-4 pt-3.5 pb-3 transition-colors hover:bg-fill-hover"
+ className="group/card relative my-1.5 gap-0 rounded-xl px-4 pt-3.5 pb-3 transition hover:bg-fill-hover hover:ring-1 hover:ring-input"
>
<div className="flex min-w-0 items-center gap-3">
{renaming?.sessionId === task.id && renaming.surface === 'feed' ? (
@@ -109,11 +110,7 @@ export function SpaceFeedCard({ task, pinned, unread, repository }: SpaceFeedCar
<TodaySessionMenu target={menu} surface="feed" />
</div>
</div>
- {preview && (
- <Text size="xs" variant="muted" className="mt-1.5 line-clamp-2 leading-normal break-words">
- {preview}
- </Text>
- )}
+ <SpaceFeedCardPrompt taskId={task.id} prompt={preview} />
{(repository || author || item.pullRequests.length > 0) && (
<div className="mt-3 flex min-w-0 flex-wrap items-center gap-1.5">
{repository && (
diff --git a/products/tasks/frontend/spaces/SpaceFeedCardPrompt.tsx b/products/tasks/frontend/spaces/SpaceFeedCardPrompt.tsx
new file mode 100644
index 000000000000..36b8a5917c7b
--- /dev/null
+++ b/products/tasks/frontend/spaces/SpaceFeedCardPrompt.tsx
@@ -0,0 +1,68 @@
+import { useEffect, useId, useRef, useState } from 'react'
+
+import { IconChevronDown } from '@posthog/icons'
+import { Text, cn } from '@posthog/quill'
+
+import { MarkdownMessage } from 'products/posthog_ai/frontend/api/primitives'
+
+interface SpaceFeedCardPromptProps {
+ taskId: string
+ prompt: string
+}
+
+export function SpaceFeedCardPrompt({ taskId, prompt }: SpaceFeedCardPromptProps): JSX.Element {
+ const [expanded, setExpanded] = useState(false)
+ const [overflowing, setOverflowing] = useState(false)
+ const clampRef = useRef<HTMLDivElement>(null)
+ const contentId = useId()
+
+ useEffect(() => {
+ const element = clampRef.current
+ if (expanded || !element) {
+ return
+ }
+ const observer = new ResizeObserver(() => setOverflowing(element.scrollHeight - element.clientHeight > 1))
+ observer.observe(element)
+ return () => observer.disconnect()
+ }, [expanded, prompt])
+
+ if (!prompt) {
+ return (
+ <Text size="xs" variant="muted" className="mt-1.5 leading-normal">
+ A new task was started
+ </Text>
+ )
+ }
+
+ return (
+ <div className="mt-1.5 flex min-w-0 flex-col items-start gap-1">
+ {expanded ? (
+ <div id={contentId} className="relative w-full min-w-0 text-xs leading-normal text-muted-foreground">
+ <MarkdownMessage content={prompt} id={`space-feed-prompt-${taskId}`} />
+ </div>
+ ) : (
+ <Text
+ render={<p ref={clampRef} id={contentId} />}
+ size="xs"
+ variant="muted"
+ className="line-clamp-2 leading-normal break-words"
+ >
+ {prompt}
+ </Text>
+ )}
+ {(overflowing || expanded) && (
+ <button
+ type="button"
+ aria-expanded={expanded}
+ aria-controls={contentId}
+ onClick={() => setExpanded(!expanded)}
+ className="relative flex items-center gap-0.5 rounded-sm text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring"
+ data-attr="today-space-feed-card-prompt-toggle"
+ >
+ <span>{expanded ? 'Show less' : 'Show full prompt'}</span>
+ <IconChevronDown className={cn('size-3', expanded && 'rotate-180')} />
+ </button>
+ )}
+ </div>
+ )
+}