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): move the session menu to quill (#109077)

Shy Alter10535ea4eed0
diff --git a/frontend/src/layout/today/TodaySessionMenu.tsx b/frontend/src/layout/today/TodaySessionMenu.tsx
index 57dc4d5e64fc..e14b562659e7 100644
--- a/frontend/src/layout/today/TodaySessionMenu.tsx
+++ b/frontend/src/layout/today/TodaySessionMenu.tsx
@@ -1,7 +1,20 @@
import { useActions, useValues } from 'kea'
import { IconArchive, IconEllipsis, IconFolderMove, IconPencil, IconPin, IconPinFilled } from '@posthog/icons'
-import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuSub,
+ DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
+ DropdownMenuTrigger,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@posthog/quill'
import { TodaySessionSurface, todaySessionMenuLogic } from './todaySessionMenuLogic'
import { spaceLabel, todaySpacesLogic } from './todaySpacesLogic'
@@ -17,48 +30,66 @@ export function TodaySessionMenu({ sessionId, pinned, spaceId, surface }: TodayS
const { sortedSpaces } = useValues(todaySpacesLogic)
const { pendingSessionIds } = useValues(todaySessionMenuLogic)
const { setSessionPinned, startRenaming, archiveSession, moveSession } = useActions(todaySessionMenuLogic)
- const disabledReason = pendingSessionIds.includes(sessionId) ? 'Saving your last change' : undefined
+ const saving = pendingSessionIds.includes(sessionId)
const otherSpaces = sortedSpaces.filter((space) => space.id !== spaceId)
+ const label = saving ? 'Saving your last change' : 'More actions'
return (
- <LemonMenu
- items={[
- {
- label: pinned ? 'Unpin' : 'Pin',
- icon: pinned ? <IconPinFilled /> : <IconPin />,
- onClick: () => setSessionPinned(sessionId, !pinned),
- disabledReason,
- 'data-attr': 'today-session-pin',
- },
- {
- label: 'Rename',
- icon: <IconPencil />,
- onClick: () => startRenaming(sessionId, surface),
- disabledReason,
- 'data-attr': 'today-session-rename',
- },
- otherSpaces.length
- ? {
- label: 'Move to space',
- icon: <IconFolderMove />,
- items: otherSpaces.map((space) => ({
- label: spaceLabel(space),
- onClick: () => moveSession(sessionId, space.id),
- disabledReason,
- 'data-attr': 'today-session-move',
- })),
- }
- : null,
- {
- label: 'Archive',
- icon: <IconArchive />,
- onClick: () => archiveSession(sessionId, true),
- disabledReason,
- 'data-attr': 'today-session-archive',
- },
- ]}
- >
- <LemonButton size="xsmall" icon={<IconEllipsis />} tooltip="More" data-attr="today-session-menu" />
- </LemonMenu>
+ <DropdownMenu>
+ <Tooltip>
+ <TooltipTrigger
+ delay={0}
+ render={
+ <DropdownMenuTrigger
+ render={
+ <Button
+ size="icon-xs"
+ aria-label={label}
+ loading={saving}
+ data-attr="today-session-menu"
+ />
+ }
+ />
+ }
+ >
+ <IconEllipsis />
+ </TooltipTrigger>
+ <TooltipContent>{label}</TooltipContent>
+ </Tooltip>
+ <DropdownMenuContent align="end" className="w-48">
+ <DropdownMenuItem onClick={() => setSessionPinned(sessionId, !pinned)} data-attr="today-session-pin">
+ {pinned ? <IconPinFilled /> : <IconPin />}
+ {pinned ? 'Unpin' : 'Pin'}
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={() => startRenaming(sessionId, surface)} data-attr="today-session-rename">
+ <IconPencil />
+ Rename
+ </DropdownMenuItem>
+ {otherSpaces.length > 0 && (
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger>
+ <IconFolderMove />
+ Move to space
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent>
+ {otherSpaces.map((space) => (
+ <DropdownMenuItem
+ key={space.id}
+ onClick={() => moveSession(sessionId, space.id)}
+ data-attr="today-session-move"
+ >
+ {spaceLabel(space)}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+ )}
+ <DropdownMenuSeparator />
+ <DropdownMenuItem onClick={() => archiveSession(sessionId, true)} data-attr="today-session-archive">
+ <IconArchive />
+ Archive
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
)
}
diff --git a/frontend/src/layout/today/TodaySessionRenameInput.tsx b/frontend/src/layout/today/TodaySessionRenameInput.tsx
index 59e353a4757e..fb696d960c48 100644
--- a/frontend/src/layout/today/TodaySessionRenameInput.tsx
+++ b/frontend/src/layout/today/TodaySessionRenameInput.tsx
@@ -1,7 +1,7 @@
import { useActions } from 'kea'
-import { useRef, useState } from 'react'
+import { ChangeEvent, KeyboardEvent, useRef, useState } from 'react'
-import { LemonInput } from '@posthog/lemon-ui'
+import { Input } from '@posthog/quill'
import { todaySessionMenuLogic } from './todaySessionMenuLogic'
@@ -29,24 +29,21 @@ export function TodaySessionRenameInput({ sessionId, title }: TodaySessionRename
}
return (
- <div className="TodayPaneRow">
- <LemonInput
- size="xsmall"
- fullWidth
- autoFocus
- value={value}
- onChange={setValue}
- onPressEnter={save}
- onBlur={save}
- onKeyDown={(event) => {
- if (event.key === 'Escape') {
- finished.current = true
- stopRenaming()
- }
- }}
- aria-label="Session title"
- data-attr="today-session-rename-input"
- />
- </div>
+ <Input
+ autoFocus
+ value={value}
+ onChange={(event: ChangeEvent<HTMLInputElement>) => setValue(event.target.value)}
+ onBlur={save}
+ onKeyDown={(event: KeyboardEvent<HTMLInputElement>) => {
+ if (event.key === 'Enter') {
+ save()
+ } else if (event.key === 'Escape') {
+ finished.current = true
+ stopRenaming()
+ }
+ }}
+ aria-label="Session title"
+ data-attr="today-session-rename-input"
+ />
)
}
diff --git a/frontend/src/layout/today/TodaySessionRow.tsx b/frontend/src/layout/today/TodaySessionRow.tsx
index b97897214359..58ce36ad58a4 100644
--- a/frontend/src/layout/today/TodaySessionRow.tsx
+++ b/frontend/src/layout/today/TodaySessionRow.tsx
@@ -22,11 +22,7 @@ export function TodaySessionRow({ item, pinned, dataAttr, surface }: TodaySessio
const { location, searchParams } = useValues(router)
if (renaming?.sessionId === item.id && renaming.surface === surface) {
- return (
- <div data-not-quill>
- <TodaySessionRenameInput sessionId={item.id} title={item.title} />
- </div>
- )
+ return <TodaySessionRenameInput sessionId={item.id} title={item.title} />
}
return (
<TodaySpacesRow
diff --git a/frontend/src/layout/today/TodayShell.tsx b/frontend/src/layout/today/TodayShell.tsx
index 18ee213477ca..e0371d5997a9 100644
--- a/frontend/src/layout/today/TodayShell.tsx
+++ b/frontend/src/layout/today/TodayShell.tsx
@@ -3,6 +3,8 @@ import './TodayShell.scss'
import { useActions, useValues } from 'kea'
import { useEffect, useRef } from 'react'
+import { ToastProvider } from '@posthog/quill'
+
import 'scenes/project-homepage/today/Today.scss'
import { Resizer } from 'lib/components/Resizer/Resizer'
import { ResizerLogicProps, resizerLogic } from 'lib/components/Resizer/resizerLogic'
@@ -42,31 +44,33 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {
}, [desiredSize, setSidebarWidth])
return (
- <div className={cn('Today TodayShell', className)}>
- <TodayRail />
- {sidebarOpen && (
- <aside
- ref={sidebarRef}
- className="TodayShell__sidebar relative"
- aria-label={PANE_LABELS[activePane]}
- // eslint-disable-next-line react/forbid-dom-props
- style={{ width: sidebarWidth }}
- >
- <div className="TodayShell__pane">
- {activePane === 'home' ? (
- <TodayHomeSidebar />
- ) : activePane === 'spaces' ? (
- <TodaySpacesSidebar />
- ) : activePane === 'library' ? (
- <TodayLibrarySidebar />
- ) : (
- <TodayToolsSidebar />
- )}
- </div>
- <TodaySidebarFooter />
- <Resizer {...resizerLogicProps} className="z-2" offset={0} />
- </aside>
- )}
- </div>
+ <ToastProvider>
+ <div className={cn('Today TodayShell', className)}>
+ <TodayRail />
+ {sidebarOpen && (
+ <aside
+ ref={sidebarRef}
+ className="TodayShell__sidebar relative"
+ aria-label={PANE_LABELS[activePane]}
+ // eslint-disable-next-line react/forbid-dom-props
+ style={{ width: sidebarWidth }}
+ >
+ <div className="TodayShell__pane">
+ {activePane === 'home' ? (
+ <TodayHomeSidebar />
+ ) : activePane === 'spaces' ? (
+ <TodaySpacesSidebar />
+ ) : activePane === 'library' ? (
+ <TodayLibrarySidebar />
+ ) : (
+ <TodayToolsSidebar />
+ )}
+ </div>
+ <TodaySidebarFooter />
+ <Resizer {...resizerLogicProps} className="z-2" offset={0} />
+ </aside>
+ )}
+ </div>
+ </ToastProvider>
)
}
diff --git a/frontend/src/layout/today/TodaySpacesRow.tsx b/frontend/src/layout/today/TodaySpacesRow.tsx
index 72d8c63580fd..4b4da315dbab 100644
--- a/frontend/src/layout/today/TodaySpacesRow.tsx
+++ b/frontend/src/layout/today/TodaySpacesRow.tsx
@@ -30,10 +30,7 @@ export function TodaySpacesRow({ label, icon, to, active, dataAttr, action }: To
<span className="min-w-0 flex-1 truncate">{label}</span>
</Button>
{action && (
- <div
- data-not-quill
- className="absolute right-1 flex opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100"
- >
+ <div className="absolute right-1 flex opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100">
{action}
</div>
)}
diff --git a/frontend/src/layout/today/todaySessionMenuLogic.ts b/frontend/src/layout/today/todaySessionMenuLogic.ts
index b62383d74535..f0a932128781 100644
--- a/frontend/src/layout/today/todaySessionMenuLogic.ts
+++ b/frontend/src/layout/today/todaySessionMenuLogic.ts
@@ -1,6 +1,6 @@
import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
-import { lemonToast } from '@posthog/lemon-ui'
+import { toast } from '@posthog/quill'
import { teamLogic } from 'scenes/teamLogic'
@@ -117,7 +117,7 @@ export const todaySessionMenuLogic = kea<todaySessionMenuLogicType>([
actions.sessionUpdated(sessionId)
return true
} catch {
- lemonToast.error(failure)
+ toast.error({ title: failure })
actions.sessionUpdateFailed(sessionId)
return false
}
@@ -129,7 +129,7 @@ export const todaySessionMenuLogic = kea<todaySessionMenuLogicType>([
await tasksPinCreate(String(values.currentTeamId), sessionId, { pinned })
actions.sessionUpdated(sessionId)
} catch {
- lemonToast.error(`Couldn’t ${pinned ? 'pin' : 'unpin'} this session. Try again.`)
+ toast.error({ title: `Couldn’t ${pinned ? 'pin' : 'unpin'} this session. Try again.` })
actions.sessionUpdateFailed(sessionId)
}
},
@@ -143,12 +143,9 @@ export const todaySessionMenuLogic = kea<todaySessionMenuLogicType>([
`Couldn’t ${archived ? 'archive' : 'restore'} this session. Try again.`
)
if (done && archived) {
- lemonToast.success('Session archived', {
- button: {
- label: 'Undo',
- action: () => actions.archiveSession(sessionId, false),
- dataAttr: 'today-session-archive-undo',
- },
+ toast.success({
+ title: 'Session archived',
+ action: { label: 'Undo', onClick: () => actions.archiveSession(sessionId, false) },
})
}
},