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): add desktop's space actions to sidebar space menus (#109853)

Shy Alter47d4bf31a4c8
diff --git a/frontend/src/layout/today/TodaySpaceActions.tsx b/frontend/src/layout/today/TodaySpaceActions.tsx
index ab14a5e760c6..eb25cb5cd974 100644
--- a/frontend/src/layout/today/TodaySpaceActions.tsx
+++ b/frontend/src/layout/today/TodaySpaceActions.tsx
@@ -1,6 +1,15 @@
import { useActions } from 'kea'
-import { IconCopy, IconGear, IconPlus, IconStar, IconStarFilled } from '@posthog/icons'
+import {
+ IconArchive,
+ IconCopy,
+ IconPencil,
+ IconPeople,
+ IconPlus,
+ IconStar,
+ IconStarFilled,
+ IconTrash,
+} from '@posthog/icons'
import { urls } from 'scenes/urls'
@@ -16,6 +25,10 @@ interface TodaySpaceActionsProps {
dataAttrPrefix: string
}
+function autoArchiveActionLabel(days: number | null): string {
+ return days === null ? 'Auto-archive: off…' : `Auto-archive: ${days} ${days === 1 ? 'day' : 'days'}…`
+}
+
/** A space's actions, New session first, like the space rows in PostHog Desktop. */
export function TodaySpaceActions({
parts: { Item, Separator },
@@ -24,6 +37,8 @@ export function TodaySpaceActions({
}: TodaySpaceActionsProps): JSX.Element {
const { toggleStar, copySpaceLink } = useActions(todaySpacesLogic)
const attr = (name: string): string => `${dataAttrPrefix}-${name}`
+ const settingsUrl = urls.taskSpaceSettings(space.id)
+ const editable = !space.system_role
return (
<>
@@ -42,10 +57,28 @@ export function TodaySpaceActions({
Copy link
</Item>
<Separator />
- <Item to={urls.taskSpaceSettings(space.id)} dataAttr={attr('settings')}>
- <IconGear />
- Space settings
+ <Item to={settingsUrl} dataAttr={attr('auto-archive')}>
+ <IconArchive />
+ {autoArchiveActionLabel(space.auto_archive_after_days)}
</Item>
+ {space.channel_type === 'private' && (
+ <Item to={settingsUrl} dataAttr={attr('members')}>
+ <IconPeople />
+ Members
+ </Item>
+ )}
+ {editable && (
+ <>
+ <Item to={settingsUrl} dataAttr={attr('rename')}>
+ <IconPencil />
+ Rename space…
+ </Item>
+ <Item to={settingsUrl} variant="destructive" dataAttr={attr('delete')}>
+ <IconTrash />
+ Delete space…
+ </Item>
+ </>
+ )}
</>
)
}
diff --git a/frontend/src/layout/today/todayMenuParts.tsx b/frontend/src/layout/today/todayMenuParts.tsx
index 200c2af55a33..9718a215f8a5 100644
--- a/frontend/src/layout/today/todayMenuParts.tsx
+++ b/frontend/src/layout/today/todayMenuParts.tsx
@@ -27,6 +27,7 @@ export interface TodayMenuItemProps {
/** Navigates instead of acting. */
to?: string
disabled?: boolean
+ variant?: 'default' | 'destructive'
}
export interface TodayMenuSubProps {
@@ -48,12 +49,13 @@ export interface TodayMenuParts {
const SUB_CONTENT_CLASS = 'max-h-80 w-64'
export const DROPDOWN_PARTS: TodayMenuParts = {
- Item: ({ children, dataAttr, onClick, to, disabled }) => (
+ Item: ({ children, dataAttr, onClick, to, disabled, variant }) => (
<DropdownMenuItem
onClick={onClick}
disabled={disabled}
+ variant={variant}
// quill draws the item as a row button by default, so a link keeps that look by rendering through one.
- {...(to ? { render: <Button size="row" left render={<LinkPrimitive to={to} />} /> } : {})}
+ {...(to ? { render: <Button variant={variant} size="row" left render={<LinkPrimitive to={to} />} /> } : {})}
data-attr={dataAttr}
>
{children}
@@ -69,11 +71,12 @@ export const DROPDOWN_PARTS: TodayMenuParts = {
}
export const CONTEXT_PARTS: TodayMenuParts = {
- Item: ({ children, dataAttr, onClick, to, disabled }) => (
+ Item: ({ children, dataAttr, onClick, to, disabled, variant }) => (
<ContextMenuItem
onClick={onClick}
disabled={disabled}
- {...(to ? { render: <Button size="row" left render={<LinkPrimitive to={to} />} /> } : {})}
+ variant={variant}
+ {...(to ? { render: <Button variant={variant} size="row" left render={<LinkPrimitive to={to} />} /> } : {})}
data-attr={dataAttr}
>
{children}
@@ -95,10 +98,11 @@ export const CONTEXT_PARTS: TodayMenuParts = {
*/
export function cardMenuParts(onAction: () => void, onSubmenuOpenChange: (open: boolean) => void): TodayMenuParts {
return {
- Item: ({ children, dataAttr, onClick, to, disabled }) => (
+ Item: ({ children, dataAttr, onClick, to, disabled, variant }) => (
<Button
left
className="w-full"
+ variant={variant}
disabled={disabled}
onClick={() => {
onClick?.()