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.

fix(today): tidy the faces and unread dot on sidebar space rows (#109665)

Shy Alterc1be59d35888
diff --git a/frontend/src/layout/today/TodaySpaceActions.tsx b/frontend/src/layout/today/TodaySpaceActions.tsx
index 5479c8b9b112..7e69c58bbdc3 100644
--- a/frontend/src/layout/today/TodaySpaceActions.tsx
+++ b/frontend/src/layout/today/TodaySpaceActions.tsx
@@ -1,6 +1,6 @@
import { useActions, useValues } from 'kea'
-import { IconEllipsis, IconGear, IconCopy, IconPlus, IconStar, IconStarFilled } from '@posthog/icons'
+import { IconEllipsis, IconGear, IconCopy, IconStar, IconStarFilled } from '@posthog/icons'
import {
Button,
DropdownMenu,
@@ -19,81 +19,60 @@ import { urls } from 'scenes/urls'
import { ChannelDTOApi } from 'products/tasks/frontend/generated/api.schemas'
import { useTodayPreviewMenuReport } from './todayPreviewCardContext'
-import { spaceLabel, spaceNewSessionUrl, todaySpacesLogic } from './todaySpacesLogic'
+import { todaySpacesLogic } from './todaySpacesLogic'
export function TodaySpaceActions({ space }: { space: ChannelDTOApi }): JSX.Element {
const { pendingSpaceIds } = useValues(todaySpacesLogic)
const { toggleStar, copySpaceLink } = useActions(todaySpacesLogic)
const reportMenuOpen = useTodayPreviewMenuReport()
const saving = pendingSpaceIds.includes(space.id)
- const newSessionLabel = `New session in ${spaceLabel(space)}`
const menuLabel = saving ? 'Saving your last change' : 'More actions'
return (
- <div className="flex gap-0.5">
+ <DropdownMenu onOpenChange={reportMenuOpen}>
<Tooltip>
<TooltipTrigger
delay={0}
render={
- <Button
- size="icon-xs"
- aria-label={newSessionLabel}
- render={<LinkPrimitive to={spaceNewSessionUrl(space.id)} />}
- data-attr="today-space-row-new-session"
+ <DropdownMenuTrigger
+ render={
+ <Button
+ size="icon-xs"
+ aria-label={menuLabel}
+ loading={saving}
+ data-attr="today-space-row-menu"
+ />
+ }
/>
}
>
- <IconPlus />
+ <IconEllipsis />
</TooltipTrigger>
- <TooltipContent>{newSessionLabel}</TooltipContent>
+ <TooltipContent>{menuLabel}</TooltipContent>
</Tooltip>
- <DropdownMenu onOpenChange={reportMenuOpen}>
- <Tooltip>
- <TooltipTrigger
- delay={0}
- render={
- <DropdownMenuTrigger
- render={
- <Button
- size="icon-xs"
- aria-label={menuLabel}
- loading={saving}
- data-attr="today-space-row-menu"
- />
- }
- />
- }
- >
- <IconEllipsis />
- </TooltipTrigger>
- <TooltipContent>{menuLabel}</TooltipContent>
- </Tooltip>
- <DropdownMenuContent align="end" className="w-48">
- {space.system_role !== 'personal' && (
- <DropdownMenuItem
- onClick={() => toggleStar(space.id, !space.starred)}
- data-attr="today-space-row-star"
- >
- {space.starred ? <IconStarFilled /> : <IconStar />}
- {space.starred ? 'Unstar space' : 'Star space'}
- </DropdownMenuItem>
- )}
- <DropdownMenuItem onClick={() => copySpaceLink(space.id)} data-attr="today-space-row-copy-link">
- <IconCopy />
- Copy link
- </DropdownMenuItem>
- <DropdownMenuSeparator />
+ <DropdownMenuContent align="end" className="w-48">
+ {space.system_role !== 'personal' && (
<DropdownMenuItem
- render={
- <Button size="row" left render={<LinkPrimitive to={urls.taskSpaceSettings(space.id)} />} />
- }
- data-attr="today-space-row-settings"
+ onClick={() => toggleStar(space.id, !space.starred)}
+ data-attr="today-space-row-star"
>
- <IconGear />
- Space settings
+ {space.starred ? <IconStarFilled /> : <IconStar />}
+ {space.starred ? 'Unstar space' : 'Star space'}
</DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
+ )}
+ <DropdownMenuItem onClick={() => copySpaceLink(space.id)} data-attr="today-space-row-copy-link">
+ <IconCopy />
+ Copy link
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ render={<Button size="row" left render={<LinkPrimitive to={urls.taskSpaceSettings(space.id)} />} />}
+ data-attr="today-space-row-settings"
+ >
+ <IconGear />
+ Space settings
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
)
}
diff --git a/frontend/src/layout/today/TodaySpacesRow.tsx b/frontend/src/layout/today/TodaySpacesRow.tsx
index 26f447bcfcb1..a486465e6c02 100644
--- a/frontend/src/layout/today/TodaySpacesRow.tsx
+++ b/frontend/src/layout/today/TodaySpacesRow.tsx
@@ -15,7 +15,6 @@ const HOVER_TRAILING_PADDING = [
'group-hover/row:pr-16 group-focus-within/row:pr-16 group-has-[[data-popup-open]]/row:pr-16',
'group-hover/row:pr-20 group-focus-within/row:pr-20 group-has-[[data-popup-open]]/row:pr-20',
'group-hover/row:pr-24 group-focus-within/row:pr-24 group-has-[[data-popup-open]]/row:pr-24',
- 'group-hover/row:pr-28 group-focus-within/row:pr-28 group-has-[[data-popup-open]]/row:pr-28',
] as const
interface TodaySpacesRowProps {
@@ -29,8 +28,6 @@ interface TodaySpacesRowProps {
badge?: JSX.Element | null
/** How many icon-sized slots `badge` takes, so the label truncates before them. */
badgeCount?: 1 | 2 | 3
- /** How many icon buttons `action` holds, so the label truncates before them. */
- actionCount?: 1 | 2
unread?: boolean
/** Off when the row's icon already marks it unread. */
unreadDot?: boolean
@@ -51,7 +48,6 @@ export function TodaySpacesRow({
action,
badge,
badgeCount = 1,
- actionCount = 1,
unread = false,
unreadDot = true,
ticker = false,
@@ -61,7 +57,7 @@ export function TodaySpacesRow({
const [hovered, setHovered] = useState(false)
const [keyboardFocused, setKeyboardFocused] = useState(false)
const badgeSlots = badge ? badgeCount : 0
- const actionSlots = action ? actionCount : 0
+ const actionSlots = action ? 1 : 0
const showUnreadDot = unread && unreadDot && !active
// Like PostHog Desktop, a row with badges shows its unread dot after them.
const trailingDot = showUnreadDot && !!badge
@@ -122,14 +118,17 @@ export function TodaySpacesRow({
// Like PostHog Desktop, the badges sit at the end of the row and move left for the hover action.
// The action stays while its menu is open, so the menu keeps its anchor after the pointer leaves.
<div className="absolute right-1 flex min-w-0 items-center gap-0.5">
- {badge}
- {trailingDot && (
- <span
- aria-hidden
- className="mx-1 size-1.5 shrink-0 rounded-full bg-primary"
- data-attr="today-unread-dot"
- />
- )}
+ {/* Desktop's spacing between the faces and the unread dot. */}
+ <span className="flex shrink-0 items-center gap-1.5">
+ {badge}
+ {trailingDot && (
+ <span
+ aria-hidden
+ className="mr-1 size-1.5 shrink-0 rounded-full bg-primary"
+ data-attr="today-unread-dot"
+ />
+ )}
+ </span>
{action && (
<div className="hidden group-focus-within/row:flex group-hover/row:flex group-has-[[data-popup-open]]/row:flex">
{action}
diff --git a/frontend/src/layout/today/TodaySpacesSidebar.tsx b/frontend/src/layout/today/TodaySpacesSidebar.tsx
index 655bb378c077..33b7395f71c6 100644
--- a/frontend/src/layout/today/TodaySpacesSidebar.tsx
+++ b/frontend/src/layout/today/TodaySpacesSidebar.tsx
@@ -312,7 +312,6 @@ export function TodaySpacesSidebar(): JSX.Element {
active={location.pathname.includes(urls.taskSpace(space.id))}
dataAttr="today-space-row"
action={<TodaySpaceActions space={space} />}
- actionCount={2}
badge={presence ? <SpacePresenceAvatars presence={presence} /> : null}
badgeCount={Math.min(presence?.people.length ?? 1, 3) as 1 | 2 | 3}
unread={unreadSpaceIds.has(space.id)}
diff --git a/frontend/src/scenes/project-homepage/today/Today.stories.tsx b/frontend/src/scenes/project-homepage/today/Today.stories.tsx
index 5f63d24046b3..ebd263db958b 100644
--- a/frontend/src/scenes/project-homepage/today/Today.stories.tsx
+++ b/frontend/src/scenes/project-homepage/today/Today.stories.tsx
@@ -367,6 +367,19 @@ export const SpacesPane: Story = {
},
}
+// Hovering a space row shows only its "…" menu, so the faces and the unread dot keep their place.
+export const SpacesPaneHoveringSpaceRow: Story = {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement)
+ await userEvent.click(await canvas.findByLabelText('Spaces'))
+ const labels = await canvas.findAllByText('checkout')
+ const row = labels.find((label) => label.closest('[data-attr="today-space-row"]'))
+ if (row) {
+ await userEvent.hover(row)
+ }
+ },
+}
+
export const SpacePage: Story = {
parameters: { pageUrl: urls.taskSpace('space-checkout') },
}
diff --git a/products/tasks/frontend/spaces/SpacePresenceAvatars.tsx b/products/tasks/frontend/spaces/SpacePresenceAvatars.tsx
index 9e8b99c20d52..0c539b6776af 100644
--- a/products/tasks/frontend/spaces/SpacePresenceAvatars.tsx
+++ b/products/tasks/frontend/spaces/SpacePresenceAvatars.tsx
@@ -12,7 +12,7 @@ function personLabel(name: string, creator: boolean, live: boolean): string {
}
/**
- * Who has been active in a space lately, like PostHog Desktop. A pulsing dot marks who is working right now,
+ * Who has been active in a space lately, like PostHog Desktop. A small corner dot marks who is working right now,
* and a crown marks the creator when `creatorUuid` is given.
* The newest person sits on top at the right, so their dot shows; the stack tucks the others behind them.
*/
@@ -45,10 +45,8 @@ export function SpacePresenceAvatars({
</span>
)}
{live && (
- <span className="absolute right-0 bottom-0 flex size-2 items-center justify-center">
- <span className="absolute inline-flex size-full animate-ping rounded-full bg-primary opacity-75" />
- <span className="relative inline-flex size-1.5 rounded-full bg-primary ring-1 ring-background" />
- </span>
+ // Desktop's corner dot. The background ring lifts it off the face, and it never grows over it.
+ <span className="absolute right-0 bottom-0 size-1.5 rounded-full bg-primary ring-1 ring-background" />
)}
</TooltipTrigger>
<TooltipContent>{label}</TooltipContent>