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(quill): convert scene title actions to quill behind today-rail-nav (#119617)

Adam Leith25382eeac079
diff --git a/frontend/src/design.md b/frontend/src/design.md
index bf718db55c47..be03ee00c51d 100644
--- a/frontend/src/design.md
+++ b/frontend/src/design.md
@@ -179,10 +179,12 @@ Use via Tailwind utilities (`bg-primary text-primary-foreground`, `border-border
- Buttons:
- Button vs Link: performs an action → Button; changes URL → the host router's Link (use `render={<Link />}` on Button when it must look like one)
- - Icon-only: `size="icon"` (or `icon-xs` / `icon-sm` / `icon-lg`), `aria-label` required, and always wrap in a Tooltip with the same string
+ - Icon-only: `size="icon"` (or `icon-xs` / `icon-sm` / `icon-lg`), `aria-label` required, and `tooltip` with the same string
- Size: buttons and select or picker triggers use the default size (`size="icon"` when icon-only). Use `sm` or `xs` only for a special case, such as a dense table cell, or when the design asks for it
- In-flight action: `loading`, not a separate spinner
- - Disabled: state the reason; tooltips work by default (`focusableWhenDisabled` is true), so don't turn it off
+ - Disabled: say why with `disabledReason`, not `disabled`. It disables the control and shows the reason in a tooltip. `Button`, every menu item, `Checkbox` and `Switch` take it. Never hand-wrap a disabled control in a Tooltip
+ - Leading icon: the first child, before the label. Trailing icon: the last child
+ - Split button (main action plus a menu of variants): `ButtonGroup` holding the Button and an icon-only `DropdownMenuTrigger` with `IconChevronDown`
- Switch vs Checkbox vs Toggle:
- setting that applies immediately → Switch
- value submitted with a form, or multi-select → Checkbox
@@ -198,10 +200,21 @@ Use via Tailwind utilities (`bg-primary text-primary-foreground`, `border-border
- ContextMenu: right-click only; never the only path to an action
- Menubar: persistent app-level menus
- Never Select for actions; never restyle Buttons into menu rows (use `Item variant="menuItem"`)
+ - A menu sizes to its longest row, never narrower than its trigger. Don't set a width on `DropdownMenuContent` unless the content needs a fixed one
+ - A row with a second line takes `description` on `DropdownMenuItem` or `DropdownMenuSubTrigger`. Never stack the text yourself: the row has a fixed height until `description` tells it to grow
+ - A menu item that navigates calls the router in `onClick`. Never pass a Link through the item's `render`: the item already uses `render` for its row styling
+ - Icon-only menu trigger: `aria-label` and a tooltip with the same string, as for any icon-only button
- A list of clickable rows (tickets, programs, recent items) → `CardGroup` of `Card size="sm"`, each holding one full-width `<button>` or `<a>`. Item has no clickable variant. `Item tone` is for callouts only, such as a warning or an incident notice
- Switching views: Tabs (sections of one page; `variant="line"` for page-level) | ToggleGroup (2–4 display modes) | Select (many views, low priority)
+- Filtering a list in a compact area (a sidebar pane, a side panel, a picker inside a menu):
+ - A search field (`InputGroup size="sm"`) and, beside it, one icon-only funnel button (`TodayFilterMenuTrigger`). Never a row of selects: it does not fit, and it hides which filters exist
+ - The funnel opens a DropdownMenu with one row per filter: the label on the left and the choice in force on the right, opening a submenu of the options (`TodayRecentRadioSubmenu`). One choice → radio items; several → checkbox items. The default comes first ("Any user", "All")
+ - While any filter differs from its default, the funnel shows a dot and reads "Filters on", and that row's value takes the primary color
+ - "Clear filters" is the last row, after a separator, `variant="destructive"`, and only shows while a filter is on
+ - Inside another menu (a picker), give the outer `DropdownMenu` `modal={false}`, or it blocks the filter menu's popup
+ - Precedent: `layout/today/TodayViewsFilterMenu`
- Text and numbers:
- - Input: single-line text
+ - Input: single-line text. Beside default-size buttons, such as a search field next to a filter button, use `size="sm"` on `Input` or `InputGroup` so the heights match
- Textarea: multi-line or long free text
- NumberFieldRoot: exact numeric values
- Slider: approximate value in a bounded range; pair with NumberFieldRoot when exact values also matter
@@ -288,7 +301,53 @@ Use via Tailwind utilities (`bg-primary text-primary-foreground`, `border-border
- The Quill UI ships behind the `today-rail-nav` feature flag; don't change the flag-off LemonUI path to match it
- During migration, use the scoped CSS and add `data-quill` to the wrapper of any Quill subtree
-- <TODO: migration rules>
+- Migrate a LemonUI call site by branching on the flag. Every migrated call site has the same shape, so a reader can find both halves:
+
+ ```tsx
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV') // with the component's other hooks, never after a return
+
+ <SceneTitleSection
+ actions={
+ todayRailNav ? (
+ <Button variant="primary" render={<LinkPrimitive to={urls.x()} />} disabledReason={reason} data-attr="new-x">
+ <IconPlus />
+ New x
+ </Button>
+ ) : (
+ <LemonButton type="primary" size="small" to={urls.x()} icon={<IconPlusSmall />} disabledReason={reason} data-attr="new-x">
+ New x
+ </LemonButton>
+ )
+ }
+ />
+ ```
+
+- Name the flag variable `todayRailNav`. The flag-off branch keeps the Lemon code, and its behavior, unchanged
+- A short quill branch stays inline. A longer one, or one that needs its own hooks, goes in a `Quill<Name>.tsx` file next to the Lemon component
+- Behavior is shared, never copied. A handler, dialog or menu item list that both branches need lives in one function or kea action that both call. Only the view forks
+- A shared Lemon component gets a `Quill<Name>.tsx` sibling, and returns it after its last hook when the flag is on. Flags load after the first render, so a return before a hook changes the hook order and crashes. If the component also renders on surfaces outside the migration, leave it alone and let the migrated caller pick the quill sibling
+- Keep every `data-attr`, handler and string. `data-attr` values are frozen
+- A product that imports quill declares `"@posthog/quill": "workspace:*"` in its `package.json`, or Vite cannot resolve it
+- Lemon to quill mapping:
+
+ | Lemon | Quill |
+ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
+ | `LemonButton type="primary"` | `variant="primary"` |
+ | `type="secondary"` | `variant="outline"` |
+ | `type="tertiary"`, or no type | `variant="default"` |
+ | `status="danger"` | `variant="destructive-outline"` (`destructive` only for a primary destructive action) |
+ | `size="small"`, `"xsmall"`, or no size | default size (omit `size`; it matches Lemon small) |
+ | `icon={<IconX />}` | `<IconX />` as the first child |
+ | `IconPlusSmall` | `IconPlus` |
+ | `type` held in a variable | `quillButtonVariant(type)` (`lib/lemon-ui/LemonButton/quillButtonVariant`) |
+ | `to={url}` | `render={<LinkPrimitive to={url} />}` |
+ | `disabledReason`, `tooltip` | the same props on `Button` |
+ | `sideAction` with a dropdown | `ButtonGroup` (see §3 Buttons) |
+ | `LemonMenu` | `DropdownMenu`; nested items → `DropdownMenuSub` |
+ | `LemonTag` | `Badge` |
+ | `LemonSelect` | `Select` |
+ | `LemonSegmentedButton` | `ToggleGroup` |
+ | `AccessControlAction`, `Shortcut` | keep the wrapper around the quill `Button`, menu item, `Checkbox` or `Switch`; it passes `disabledReason` in |
### PostHog Desktop
diff --git a/frontend/src/layout/navigation-3000/sidepanel/AGENTS.md b/frontend/src/layout/navigation-3000/sidepanel/AGENTS.md
index 1674b4ecf687..d9904169e244 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/AGENTS.md
+++ b/frontend/src/layout/navigation-3000/sidepanel/AGENTS.md
@@ -11,6 +11,7 @@ Under that flag the side panel shrinks, and its tabs move to other surfaces:
- **Info** renders the scene's `ScenePanel`. It is deprecated and will be removed, and the `SceneMenuBar` takes over its actions. See [`layout/scenes/AGENTS.md`](../../scenes/AGENTS.md) when you change a scene's actions.
- **Support** opens from the menu bar's Help menu instead of a tab bar button.
- **Notebooks** and **Discussion** are hidden from the tab bar (`visibleTabs`). Their panels still open from their existing entry points, such as a comment button or "Add to notebook". They will be removed from the side panel or moved; the new home is not decided yet.
+- **Adding to a notebook from outside a notebook is deprecated.** Under the flag, `NotebookSelectButton` (person pages, person hover card, group pages) and `SceneAddToNotebookDropdownMenu` render nothing, and the replay menu and the insight, feature flag and cohort menu bars leave their entry out. Inside a notebook the button stays. A finished quill picker, `scenes/notebooks/NotebookSelectButton/QuillNotebookSelectButton`, is kept but not rendered. If someone asks to bring it back, remove those gates and render that component instead of building a new one.
Do not build new features on the Info, Notebooks or Discussion tabs.
A change to them must keep working with the flag off, because the current UI still ships them.
diff --git a/frontend/src/layout/navigation-3000/sidepanel/components/QuillPeopleAvatars.tsx b/frontend/src/layout/navigation-3000/sidepanel/components/QuillPeopleAvatars.tsx
index 0ceff2d7b45f..e53bd6d548c3 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/components/QuillPeopleAvatars.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/components/QuillPeopleAvatars.tsx
@@ -1,6 +1,6 @@
import { AvatarGroup, Text, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'
-import { QuillPersonAvatar } from './QuillPersonAvatar'
+import { QuillPersonAvatar } from 'lib/components/QuillPersonAvatar/QuillPersonAvatar'
interface QuillPeopleAvatarsProps {
people: { name: string; email: string }[]
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/quill/QuillAccessControlMembers.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/quill/QuillAccessControlMembers.tsx
index 4fe214d800e4..1d712155fa26 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/quill/QuillAccessControlMembers.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/quill/QuillAccessControlMembers.tsx
@@ -2,6 +2,7 @@ import { useAsyncActions, useValues } from 'kea'
import { Item, ItemActions, ItemContent, ItemDescription, ItemMedia, ItemTitle } from '@posthog/quill'
+import { QuillPersonAvatar } from 'lib/components/QuillPersonAvatar/QuillPersonAvatar'
import { fullName } from 'lib/utils/strings'
import { userLogic } from 'scenes/userLogic'
@@ -14,7 +15,6 @@ import {
} from '~/types'
import { QuillPeopleAvatars } from '../../../components/QuillPeopleAvatars'
-import { QuillPersonAvatar } from '../../../components/QuillPersonAvatar'
import { accessControlLogic } from '../accessControlLogic'
import { QuillAccessLevelSelect } from './QuillAccessLevelSelect'
import { QuillAccessSection } from './QuillAccessSection'
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/quill/QuillAddAccessDialog.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/quill/QuillAddAccessDialog.tsx
index 884c5537c127..bbc922d8affb 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/quill/QuillAddAccessDialog.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/quill/QuillAddAccessDialog.tsx
@@ -30,9 +30,10 @@ import {
useComboboxAnchor,
} from '@posthog/quill'
+import { QuillPersonAvatar } from 'lib/components/QuillPersonAvatar/QuillPersonAvatar'
+
import { AccessControlLevel } from '~/types'
-import { QuillPersonAvatar } from '../../../components/QuillPersonAvatar'
import { accessControlLogic } from '../accessControlLogic'
import { QuillAccessLevelSelect } from './QuillAccessLevelSelect'
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/quill/QuillActivityLogRow.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/quill/QuillActivityLogRow.tsx
index 35f27aa58650..587f3ffec656 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/quill/QuillActivityLogRow.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/quill/QuillActivityLogRow.tsx
@@ -19,12 +19,11 @@ import { ActivityLogDiff } from 'lib/components/ActivityLog/ActivityLogDiff'
import { ACTIVITY_SEARCH_PARAM } from 'lib/components/ActivityLog/activityLogLogic'
import { AgentAttribution } from 'lib/components/ActivityLog/AgentAttribution'
import { HumanizedActivityLogItem } from 'lib/components/ActivityLog/humanizeActivity'
+import { QuillPersonAvatar } from 'lib/components/QuillPersonAvatar/QuillPersonAvatar'
import { TZLabel } from 'lib/components/TZLabel'
import { IconLink } from 'lib/lemon-ui/icons'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
-import { QuillPersonAvatar } from '../../../components/QuillPersonAvatar'
-
type ActivityLogTab = 'details' | 'extended description' | 'diff' | 'raw'
function IconButton({
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/quill/QuillActivityMemberFilter.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/quill/QuillActivityMemberFilter.tsx
index d18879510641..fc4a8e99c89c 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/quill/QuillActivityMemberFilter.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/quill/QuillActivityMemberFilter.tsx
@@ -13,13 +13,12 @@ import {
Spinner,
} from '@posthog/quill'
+import { QuillPersonAvatar } from 'lib/components/QuillPersonAvatar/QuillPersonAvatar'
import { fullName } from 'lib/utils/strings'
import { membersLogic } from 'scenes/organization/membersLogic'
import { UserBasicType } from '~/types'
-import { QuillPersonAvatar } from '../../../components/QuillPersonAvatar'
-
const ANY_USER = 'any'
interface QuillActivityMemberFilterProps {
diff --git a/frontend/src/lib/components/DatePicker/DatePicker.tsx b/frontend/src/lib/components/DatePicker/DatePicker.tsx
index 57be7db5a778..2db8e23e71b9 100644
--- a/frontend/src/lib/components/DatePicker/DatePicker.tsx
+++ b/frontend/src/lib/components/DatePicker/DatePicker.tsx
@@ -5,6 +5,7 @@ import { Button, cn, DatePicker as QuillDatePicker, Popover, PopoverContent, Pop
import { dayjs } from 'lib/dayjs'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { quillButtonVariant } from 'lib/lemon-ui/LemonButton/quillButtonVariant'
import { LemonCalendarSelectInput, LemonCalendarSelectInputProps } from 'lib/lemon-ui/LemonCalendar/LemonCalendarSelect'
/**
@@ -81,11 +82,6 @@ export interface DatePickerProps {
const QUILL_TRIGGER_FORMAT = 'MMMM D, YYYY'
const QUILL_TRIGGER_DATETIME_FORMAT = 'MMMM D, YYYY HH:mm'
-const QUILL_TRIGGER_VARIANT: Record<NonNullable<DatePickerProps['type']>, 'primary' | 'outline' | 'default'> = {
- primary: 'primary',
- secondary: 'outline',
- tertiary: 'default',
-}
const QUILL_TRIGGER_SIZE: Record<NonNullable<DatePickerProps['size']>, 'default' | 'xs' | 'sm' | 'lg'> = {
xsmall: 'xs',
small: 'sm',
@@ -152,7 +148,7 @@ function DatePickerQuill({
<PopoverTrigger
render={
<Button
- variant={QUILL_TRIGGER_VARIANT[type]}
+ variant={quillButtonVariant(type)}
size={QUILL_TRIGGER_SIZE[size]}
data-attr={dataAttr}
data-quill
diff --git a/frontend/src/lib/components/FeedbackSurveyButton/FeedbackSurveyButton.tsx b/frontend/src/lib/components/FeedbackSurveyButton/FeedbackSurveyButton.tsx
index 393b0f71860a..13909b16866d 100644
--- a/frontend/src/lib/components/FeedbackSurveyButton/FeedbackSurveyButton.tsx
+++ b/frontend/src/lib/components/FeedbackSurveyButton/FeedbackSurveyButton.tsx
@@ -1,8 +1,11 @@
import posthog, { DisplaySurveyType, type Properties } from 'posthog-js'
import { useEffect, useState } from 'react'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
+import { QuillFeedbackSurveyButton } from './QuillFeedbackSurveyButton'
+
export interface FeedbackSurveyButtonProps {
surveyId: string
properties?: Properties
@@ -20,6 +23,7 @@ export function FeedbackSurveyButton({
'data-attr': dataAttr,
}: FeedbackSurveyButtonProps): JSX.Element {
const [surveysLoaded, setSurveysLoaded] = useState(false)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
useEffect(
() =>
@@ -31,6 +35,17 @@ export function FeedbackSurveyButton({
[]
)
+ if (todayRailNav) {
+ return (
+ <QuillFeedbackSurveyButton
+ surveyId={surveyId}
+ properties={properties}
+ data-attr={dataAttr}
+ surveysLoaded={surveysLoaded}
+ />
+ )
+ }
+
return (
<LemonButton
size="small"
diff --git a/frontend/src/lib/components/FeedbackSurveyButton/QuillFeedbackSurveyButton.tsx b/frontend/src/lib/components/FeedbackSurveyButton/QuillFeedbackSurveyButton.tsx
new file mode 100644
index 000000000000..67d35039c372
--- /dev/null
+++ b/frontend/src/lib/components/FeedbackSurveyButton/QuillFeedbackSurveyButton.tsx
@@ -0,0 +1,32 @@
+import posthog, { DisplaySurveyType } from 'posthog-js'
+
+import { Button } from '@posthog/quill'
+
+import type { FeedbackSurveyButtonProps } from './FeedbackSurveyButton'
+
+export function QuillFeedbackSurveyButton({
+ surveyId,
+ properties,
+ 'data-attr': dataAttr,
+ surveysLoaded,
+}: FeedbackSurveyButtonProps & { surveysLoaded: boolean }): JSX.Element {
+ return (
+ <Button
+ data-attr={dataAttr}
+ tooltip="Have any questions or feedback?"
+ disabledReason={surveysLoaded ? undefined : 'Feedback is unavailable right now'}
+ onClick={() =>
+ // A deliberate click should always bring up the survey, so bypass the
+ // popover's URL/cohort/already-dismissed targeting.
+ posthog.displaySurvey(surveyId, {
+ displayType: DisplaySurveyType.Popover,
+ ignoreConditions: true,
+ ignoreDelay: true,
+ properties,
+ })
+ }
+ >
+ Feedback
+ </Button>
+ )
+}
diff --git a/frontend/src/layout/navigation-3000/sidepanel/components/QuillPersonAvatar.tsx b/frontend/src/lib/components/QuillPersonAvatar/QuillPersonAvatar.tsx
similarity index 100%
rename from frontend/src/layout/navigation-3000/sidepanel/components/QuillPersonAvatar.tsx
rename to frontend/src/lib/components/QuillPersonAvatar/QuillPersonAvatar.tsx
diff --git a/frontend/src/lib/components/Scenes/InsightOrDashboard/SceneAddToNotebookDropdownMenu.tsx b/frontend/src/lib/components/Scenes/InsightOrDashboard/SceneAddToNotebookDropdownMenu.tsx
index ff5f0ce953de..48bc592b9a10 100644
--- a/frontend/src/lib/components/Scenes/InsightOrDashboard/SceneAddToNotebookDropdownMenu.tsx
+++ b/frontend/src/lib/components/Scenes/InsightOrDashboard/SceneAddToNotebookDropdownMenu.tsx
@@ -1,5 +1,6 @@
import { IconPlusSmall } from '@posthog/icons'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { ButtonPrimitive, ButtonPrimitiveProps } from 'lib/ui/Button/ButtonPrimitives'
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from 'lib/ui/DropdownMenu/DropdownMenu'
import { MenuOpenIndicator } from 'lib/ui/Menus/Menus'
@@ -19,7 +20,12 @@ export function SceneAddToNotebookDropdownMenu({
shortId,
dataAttrKey,
disabledReasons,
-}: SceneNotebookDropdownMenuProps): JSX.Element {
+}: SceneNotebookDropdownMenuProps): JSX.Element | null {
+ // The rail redesign (`today-rail-nav`) deprecates adding to notebooks from outside a notebook. See QuillNotebookSelectButton to bring it back.
+ const hidden = useFeatureFlag('TODAY_RAIL_NAV')
+ if (hidden) {
+ return null
+ }
const isDisabled = disabledReasons ? Object.values(disabledReasons).some(Boolean) : false
return (
<DropdownMenu>
diff --git a/frontend/src/lib/lemon-ui/LemonButton/quillButtonVariant.ts b/frontend/src/lib/lemon-ui/LemonButton/quillButtonVariant.ts
new file mode 100644
index 000000000000..9b1f5f0204a1
--- /dev/null
+++ b/frontend/src/lib/lemon-ui/LemonButton/quillButtonVariant.ts
@@ -0,0 +1,11 @@
+import type { LemonButtonProps } from './LemonButton'
+
+const VARIANT_BY_TYPE = {
+ primary: 'primary',
+ secondary: 'outline',
+ tertiary: 'default',
+} as const
+
+export function quillButtonVariant(type: LemonButtonProps['type']): 'primary' | 'outline' | 'default' {
+ return type ? VARIANT_BY_TYPE[type] : 'default'
+}
diff --git a/frontend/src/scenes/approvals/ApprovalDetail.tsx b/frontend/src/scenes/approvals/ApprovalDetail.tsx
index 38e3557fbf03..4fd1df1558c3 100644
--- a/frontend/src/scenes/approvals/ApprovalDetail.tsx
+++ b/frontend/src/scenes/approvals/ApprovalDetail.tsx
@@ -7,6 +7,7 @@ import { LemonTag, lemonToast } from '@posthog/lemon-ui'
import MonacoDiffEditor from 'lib/components/MonacoDiffEditor'
import { NotFound } from 'lib/components/NotFound'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
@@ -25,6 +26,7 @@ import { ApprovalDecision, ChangeRequest, ChangeRequestState } from '~/types'
import { ApprovalLogicProps, ProposedChangesTab, approvalLogic } from './approvalLogic'
import { ChangeRequestActions } from './ChangeRequestActions'
import { generateDecisionAnalysis } from './decisionAnalysis'
+import { QuillChangeRequestActions } from './QuillChangeRequestActions'
export const scene: SceneExport<ApprovalLogicProps> = {
component: ApprovalDetail,
@@ -41,6 +43,7 @@ function ApprovalDetail({ id }: ApprovalLogicProps): JSX.Element {
const containerRef = useRef<HTMLDivElement>(null)
const [width] = useSize(containerRef)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!isApprovalsFeatureEnabled || changeRequestMissing) {
return <NotFound object="change request" />
@@ -55,6 +58,7 @@ function ApprovalDetail({ id }: ApprovalLogicProps): JSX.Element {
}
const decisionAnalysis = generateDecisionAnalysis(changeRequest)
+ const ChangeRequestActionsComponent = todayRailNav ? QuillChangeRequestActions : ChangeRequestActions
return (
<SceneContent>
@@ -63,7 +67,7 @@ function ApprovalDetail({ id }: ApprovalLogicProps): JSX.Element {
description={changeRequest.intent_display?.description}
resourceType={{ type: 'change_request' }}
actions={
- <ChangeRequestActions
+ <ChangeRequestActionsComponent
changeRequest={changeRequest}
onApprove={() => approveChangeRequest()}
onReject={(_, reason) => {
diff --git a/frontend/src/scenes/approvals/ChangeRequestActions.tsx b/frontend/src/scenes/approvals/ChangeRequestActions.tsx
index aec5ec44abae..dec510b46982 100644
--- a/frontend/src/scenes/approvals/ChangeRequestActions.tsx
+++ b/frontend/src/scenes/approvals/ChangeRequestActions.tsx
@@ -16,17 +16,16 @@ export interface ChangeRequestActionsProps {
showDisabledApproveButton?: boolean
}
-export function ChangeRequestActions({
+export function changeRequestDialogHandlers({
changeRequest,
onApprove,
onReject,
onCancel,
- showViewButton = false,
- showDisabledApproveButton = false,
-}: ChangeRequestActionsProps): JSX.Element {
- const { showApproveButton, showRejectButton, showCancelButton } = getChangeRequestButtonVisibility(changeRequest)
- const approveDisabledReason = getApproveDisabledReason(changeRequest)
-
+}: Pick<ChangeRequestActionsProps, 'changeRequest' | 'onApprove' | 'onReject' | 'onCancel'>): {
+ handleApprove: () => void
+ handleReject: () => void
+ handleCancel: () => void
+} {
const handleApprove = (): void => {
LemonDialog.open({
title: 'Approve this change request?',
@@ -111,6 +110,27 @@ export function ChangeRequestActions({
})
}
+ return { handleApprove, handleReject, handleCancel }
+}
+
+export function ChangeRequestActions({
+ changeRequest,
+ onApprove,
+ onReject,
+ onCancel,
+ showViewButton = false,
+ showDisabledApproveButton = false,
+}: ChangeRequestActionsProps): JSX.Element {
+ const { showApproveButton, showRejectButton, showCancelButton } = getChangeRequestButtonVisibility(changeRequest)
+ const approveDisabledReason = getApproveDisabledReason(changeRequest)
+
+ const { handleApprove, handleReject, handleCancel } = changeRequestDialogHandlers({
+ changeRequest,
+ onApprove,
+ onReject,
+ onCancel,
+ })
+
const menuItems = []
if (showViewButton) {
menuItems.push({
diff --git a/frontend/src/scenes/approvals/QuillChangeRequestActions.tsx b/frontend/src/scenes/approvals/QuillChangeRequestActions.tsx
new file mode 100644
index 000000000000..e283bb2ab1dc
--- /dev/null
+++ b/frontend/src/scenes/approvals/QuillChangeRequestActions.tsx
@@ -0,0 +1,68 @@
+import { router } from 'kea-router'
+
+import { IconEllipsis } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+import { getApproveDisabledReason, getChangeRequestButtonVisibility } from 'scenes/approvals/changeRequestsLogic'
+import { urls } from 'scenes/urls'
+
+import { ChangeRequestActionsProps, changeRequestDialogHandlers } from './ChangeRequestActions'
+
+export function QuillChangeRequestActions({
+ changeRequest,
+ onApprove,
+ onReject,
+ onCancel,
+ showViewButton = false,
+ showDisabledApproveButton = false,
+}: ChangeRequestActionsProps): JSX.Element {
+ const { showApproveButton, showRejectButton, showCancelButton } = getChangeRequestButtonVisibility(changeRequest)
+ const approveDisabledReason = getApproveDisabledReason(changeRequest)
+ const { handleApprove, handleReject, handleCancel } = changeRequestDialogHandlers({
+ changeRequest,
+ onApprove,
+ onReject,
+ onCancel,
+ })
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ {showApproveButton ? (
+ <Button variant="primary" onClick={handleApprove}>
+ Approve
+ </Button>
+ ) : (
+ showDisabledApproveButton &&
+ approveDisabledReason && (
+ <Button variant="primary" disabledReason={approveDisabledReason}>
+ Approve
+ </Button>
+ )
+ )}
+ {showRejectButton && (
+ <Button variant="outline" onClick={handleReject}>
+ Reject
+ </Button>
+ )}
+ {showCancelButton && (
+ <Button variant="outline" onClick={handleCancel}>
+ Cancel
+ </Button>
+ )}
+ {showViewButton && (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={<Button variant="outline" size="icon" aria-label="More" tooltip="More" />}
+ >
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={() => router.actions.push(urls.approval(changeRequest.id))}>
+ View details
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/cohorts/CohortEdit.tsx b/frontend/src/scenes/cohorts/CohortEdit.tsx
index 99d884421af5..eeb2dd3950a1 100644
--- a/frontend/src/scenes/cohorts/CohortEdit.tsx
+++ b/frontend/src/scenes/cohorts/CohortEdit.tsx
@@ -15,6 +15,7 @@ import {
IconWarning,
} from '@posthog/icons'
import { LemonBanner, LemonDialog, LemonDivider, LemonSnack, LemonTabs, Link, Tooltip } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
import { cohortReadsFlagCalls } from 'lib/components/FlagCalledRebuildBanner/flagCalledDependencies'
@@ -25,6 +26,7 @@ import { SceneFile } from 'lib/components/Scenes/SceneFile'
import { TestAccountFilterSwitch } from 'lib/components/TestAccountFiltersSwitch'
import { TZLabel } from 'lib/components/TZLabel'
import { CohortTypeEnum, FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useFileSystemLogView } from 'lib/hooks/useFileSystemLogView'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonField } from 'lib/lemon-ui/LemonField'
@@ -245,6 +247,7 @@ export function CohortEdit({ id, attachTo }: CohortEditProps): JSX.Element {
const { featureFlags } = useValues(featureFlagLogic)
const { canCopyToProject } = useValues(interProjectCopyLogic)
const { openSidePanel } = useActions(sidePanelStateLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const isNewCohort = cohort.id === 'new' || cohort.id === undefined
const accessDisabledReason = messageAudienceAccessDisabledReason()
@@ -440,32 +443,59 @@ export function CohortEdit({ id, attachTo }: CohortEditProps): JSX.Element {
canEdit
forceEdit={isNewCohort}
actions={
- <>
- {isNewCohort ? (
+ todayRailNav ? (
+ <>
+ {isNewCohort ? (
+ <Button
+ data-attr="cancel-cohort"
+ variant="outline"
+ onClick={() => {
+ router.actions.push(urls.cohorts())
+ }}
+ disabled={cohortLoading}
+ >
+ Cancel
+ </Button>
+ ) : null}
+ <Button
+ variant="primary"
+ data-attr="save-cohort"
+ type="submit"
+ loading={cohortLoading}
+ disabledReason={cohortLoading ? 'Saving cohort...' : undefined}
+ form="cohort"
+ >
+ Save
+ </Button>
+ </>
+ ) : (
+ <>
+ {isNewCohort ? (
+ <LemonButton
+ data-attr="cancel-cohort"
+ type="secondary"
+ onClick={() => {
+ router.actions.push(urls.cohorts())
+ }}
+ size="small"
+ disabled={cohortLoading}
+ >
+ Cancel
+ </LemonButton>
+ ) : null}
<LemonButton
- data-attr="cancel-cohort"
- type="secondary"
- onClick={() => {
- router.actions.push(urls.cohorts())
- }}
+ type="primary"
+ data-attr="save-cohort"
+ htmlType="submit"
+ loading={cohortLoading}
+ disabledReason={cohortLoading ? 'Saving cohort...' : undefined}
+ form="cohort"
size="small"
- disabled={cohortLoading}
>
- Cancel
+ Save
</LemonButton>
- ) : null}
- <LemonButton
- type="primary"
- data-attr="save-cohort"
- htmlType="submit"
- loading={cohortLoading}
- disabledReason={cohortLoading ? 'Saving cohort...' : undefined}
- form="cohort"
- size="small"
- >
- Save
- </LemonButton>
- </>
+ </>
+ )
}
/>
</LemonField>
diff --git a/frontend/src/scenes/cohorts/CohortSceneMenuBar.tsx b/frontend/src/scenes/cohorts/CohortSceneMenuBar.tsx
index 65109b1f9d8c..713608ac5aef 100644
--- a/frontend/src/scenes/cohorts/CohortSceneMenuBar.tsx
+++ b/frontend/src/scenes/cohorts/CohortSceneMenuBar.tsx
@@ -7,6 +7,7 @@ import { LemonDialog } from '@posthog/lemon-ui'
import { SceneMenuBarAddToNotebook } from 'lib/components/Scenes/SceneMenuBarAddToNotebook'
import { SceneMenuBarFileItems } from 'lib/components/Scenes/SceneMenuBarFileItems'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { cohortEditLogic } from 'scenes/cohorts/cohortEditLogic'
import {
@@ -48,6 +49,7 @@ function CohortSceneMenuBarInner({ id }: { id?: CohortType['id'] }): JSX.Element
const { cohort, cohortLoading } = useValues(logic)
const { duplicateCohort, deleteCohort, restoreCohort } = useActions(logic)
const { canCopyToProject } = useValues(interProjectCopyLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!cohort) {
return null
@@ -90,15 +92,18 @@ function CohortSceneMenuBarInner({ id }: { id?: CohortType['id'] }): JSX.Element
<IconSend />
Build a custom workflow
</SceneMenuBarItem>
- <SceneMenuBarAddToNotebook
- dataAttrKey={RESOURCE_TYPE}
- notebookSelectButtonProps={{
- resource: {
- type: NotebookNodeType.Cohort,
- attrs: { id: cohortIdNumber },
- },
- }}
- />
+ {/* Adding to notebooks is deprecated under the rail redesign. */}
+ {!todayRailNav && (
+ <SceneMenuBarAddToNotebook
+ dataAttrKey={RESOURCE_TYPE}
+ notebookSelectButtonProps={{
+ resource: {
+ type: NotebookNodeType.Cohort,
+ attrs: { id: cohortIdNumber },
+ },
+ }}
+ />
+ )}
</SceneMenuBarSubMenu>
<SceneMenuBarSeparator />
</>
diff --git a/frontend/src/scenes/cohorts/Cohorts.tsx b/frontend/src/scenes/cohorts/Cohorts.tsx
index 4e400728bfe7..0a406c4e3b42 100644
--- a/frontend/src/scenes/cohorts/Cohorts.tsx
+++ b/frontend/src/scenes/cohorts/Cohorts.tsx
@@ -4,6 +4,7 @@ import { useActions, useValues } from 'kea'
import { combineUrl, router } from 'kea-router'
import { LemonBanner, LemonDialog, LemonInput, LemonSelect } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { MemberSelect } from 'lib/components/MemberSelect'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
@@ -55,6 +56,7 @@ export function Cohorts(): JSX.Element {
useActions(cohortsSceneLogic)
const { searchParams } = useValues(router)
const realtimeTargetingEnabled = useFeatureFlag('REALTIME_COHORT_FLAG_TARGETING')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
// Creating an export requires editor access to the export resource.
const exportAccessControlDisabledReason = getAccessControlDisabledReason(
@@ -290,15 +292,26 @@ export function Cohorts(): JSX.Element {
interaction="click"
scope={Scene.Cohorts}
>
- <LemonButton
- type="primary"
- size="small"
- data-attr="new-cohort"
- onClick={() => router.actions.push(urls.cohort('new'))}
- tooltip="New cohort"
- >
- New cohort
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ data-attr="new-cohort"
+ onClick={() => router.actions.push(urls.cohort('new'))}
+ tooltip="New cohort"
+ >
+ New cohort
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ size="small"
+ data-attr="new-cohort"
+ onClick={() => router.actions.push(urls.cohort('new'))}
+ tooltip="New cohort"
+ >
+ New cohort
+ </LemonButton>
+ )}
</Shortcut>
}
/>
diff --git a/frontend/src/scenes/dashboard/DashboardCustomizeButton.tsx b/frontend/src/scenes/dashboard/DashboardCustomizeButton.tsx
index 09115595c22a..33afe58a0d56 100644
--- a/frontend/src/scenes/dashboard/DashboardCustomizeButton.tsx
+++ b/frontend/src/scenes/dashboard/DashboardCustomizeButton.tsx
@@ -4,6 +4,7 @@ import { IconGridMasonry } from '@posthog/icons'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonMenu, LemonMenuOverlay } from 'lib/lemon-ui/LemonMenu'
import { DashboardEventSource } from 'lib/utils/eventUsageLogic'
@@ -12,12 +13,18 @@ import { Scene } from 'scenes/sceneTypes'
import { DashboardCustomizeMenu } from 'products/dashboards/frontend/components/DashboardCustomizeMenu/DashboardCustomizeMenu'
import { dashboardLogic } from './dashboardLogic'
+import { QuillDashboardCustomizeButton } from './QuillDashboardCustomizeButton'
export function DashboardCustomizeButton(): JSX.Element {
const { setDashboardEditing } = useActions(dashboardLogic)
const { currentLayoutSize } = useValues(dashboardLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const layoutAvailable = currentLayoutSize !== 'xs'
+ if (todayRailNav) {
+ return <QuillDashboardCustomizeButton />
+ }
+
if (!layoutAvailable) {
return (
<LemonMenu
diff --git a/frontend/src/scenes/dashboard/DashboardHeader.tsx b/frontend/src/scenes/dashboard/DashboardHeader.tsx
index 0674cfcfcee1..69fd9d9c5571 100644
--- a/frontend/src/scenes/dashboard/DashboardHeader.tsx
+++ b/frontend/src/scenes/dashboard/DashboardHeader.tsx
@@ -1,6 +1,7 @@
import { useActions, useValues } from 'kea'
import { FullScreen } from 'lib/components/FullScreen'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { DashboardEventSource } from 'lib/utils/eventUsageLogic'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene } from 'scenes/sceneTypes'
@@ -17,6 +18,7 @@ import { DashboardLoadAction, dashboardLogic } from './dashboardLogic'
import { DashboardModals } from './DashboardModals'
import { DashboardSceneMenuBar } from './DashboardSceneMenuBar'
import { DashboardScenePanel } from './DashboardScenePanel'
+import { QuillDashboardHeaderActions } from './QuillDashboardHeaderActions'
export const DASHBOARD_CANNOT_EDIT_MESSAGE =
"You don't have edit permissions for this dashboard. Ask a dashboard collaborator with edit access to add you."
@@ -29,6 +31,7 @@ export function DashboardHeader({ loading = false }: { loading?: boolean }): JSX
const { dashboard, dashboardLoading, dashboardMode, dashboardEditing, canEditDashboard } = useValues(dashboardLogic)
const { setDashboardMode, loadDashboard } = useActions(dashboardLogic)
const { updateDashboard } = useActions(dashboardsModel)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const isLoading = !dashboard && (loading || dashboardLoading)
@@ -113,7 +116,7 @@ export function DashboardHeader({ loading = false }: { loading?: boolean }): JSX
}
: undefined
}
- actions={actions}
+ actions={todayRailNav && dashboard ? <QuillDashboardHeaderActions /> : actions}
/>
</>
)
diff --git a/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsx b/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsx
index b6b442f99b52..87d978f098d0 100644
--- a/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsx
+++ b/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsx
@@ -6,6 +6,7 @@ import posthog from 'posthog-js'
import { IconBell } from '@posthog/icons'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconWithCount } from 'lib/lemon-ui/icons/icons'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
@@ -13,6 +14,7 @@ import { subscriptionsLogic } from 'products/subscriptions/frontend/components/S
import { urlForSubscriptions } from 'products/subscriptions/frontend/components/Subscriptions/utils'
import { dashboardLogic } from './dashboardLogic'
+import { QuillDashboardSubscribeButton } from './QuillDashboardSubscribeButton'
function SubscribeCountIcon({ dashboardId }: { dashboardId: number }): JSX.Element {
const { subscriptions } = useValues(subscriptionsLogic({ dashboardId }))
@@ -35,6 +37,11 @@ function SubscribeIcon({ dashboardId }: { dashboardId: number }): JSX.Element {
export function DashboardSubscribeButton(): JSX.Element | null {
const { dashboard, canEditDashboard, tiles } = useValues(dashboardLogic)
const { push } = useActions(router)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ if (todayRailNav) {
+ return <QuillDashboardSubscribeButton />
+ }
if (!dashboard || !canEditDashboard || tiles.length === 0) {
return null
diff --git a/frontend/src/scenes/dashboard/QuillDashboardAddTileButton.tsx b/frontend/src/scenes/dashboard/QuillDashboardAddTileButton.tsx
new file mode 100644
index 000000000000..d03ae4371739
--- /dev/null
+++ b/frontend/src/scenes/dashboard/QuillDashboardAddTileButton.tsx
@@ -0,0 +1,134 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+
+import { IconPlus } from '@posthog/icons'
+import {
+ Badge,
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
+import { MaxTool } from 'scenes/max/MaxTool'
+
+import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { DashboardAddTileKey, getDashboardAddTileOptions } from './dashboardAddTileOptions'
+import { DashboardLoadAction, dashboardLogic } from './dashboardLogic'
+
+// pinned: autocapture data-attrs for the header's Add menu items
+const ADD_TILE_MENU_DATA_ATTRS: Record<DashboardAddTileKey, string> = {
+ insight: 'dashboard-add-insight',
+ text: 'dashboard-add-text-tile',
+ image: 'dashboard-add-image-tile',
+ button: 'dashboard-add-button-tile',
+ widget: 'dashboard-add-widget',
+ 'widget-preview': 'dashboard-add-widget-preview',
+}
+
+export function QuillDashboardAddTileButton(): JSX.Element | null {
+ const { dashboard, dashboardWidgetsEnabled, tiles } = useValues(dashboardLogic)
+ const {
+ loadDashboard,
+ setAddWidgetModalOpen,
+ openAddInsightModal,
+ openTextTileModal,
+ openImageTileModal,
+ openButtonTileModal,
+ } = useActions(dashboardLogic)
+ const { push } = useActions(router)
+ const { reportDashboardAddMenuOpened } = useActions(eventUsageLogic)
+
+ if (!dashboard || tiles.length === 0) {
+ return null
+ }
+
+ const disabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.Dashboard,
+ AccessControlLevel.Editor,
+ dashboard.user_access_level
+ )
+ const options = getDashboardAddTileOptions({
+ dashboardWidgetsEnabled,
+ onAddInsight: openAddInsightModal,
+ onAddText: openTextTileModal,
+ onAddImage: openImageTileModal,
+ onAddButton: openButtonTileModal,
+ push,
+ setAddWidgetModalOpen,
+ })
+
+ return (
+ <MaxTool
+ className="shrink-0"
+ identifier="upsert_dashboard"
+ context={{
+ current_dashboard: {
+ id: dashboard.id,
+ name: dashboard.name,
+ description: dashboard.description,
+ tags: dashboard.tags,
+ },
+ }}
+ contextDescription={{
+ text: dashboard.name,
+ icon: iconForType('dashboard'),
+ }}
+ active={false}
+ callback={() => loadDashboard({ action: DashboardLoadAction.Update })}
+ position="top-right"
+ >
+ {disabledReason ? (
+ <Button variant="primary" data-attr="dashboard-add-tile" disabledReason={disabledReason}>
+ <IconPlus />
+ Add
+ </Button>
+ ) : (
+ <DropdownMenu
+ onOpenChange={(open) => {
+ if (open) {
+ reportDashboardAddMenuOpened('header', dashboard.id)
+ }
+ }}
+ >
+ <DropdownMenuTrigger render={<Button variant="primary" data-attr="dashboard-add-tile" />}>
+ <IconPlus />
+ Add
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-40">
+ <DropdownMenuGroup>
+ <DropdownMenuLabel>Content</DropdownMenuLabel>
+ {options.map((option) => {
+ return (
+ <DropdownMenuItem
+ key={option.key}
+ onClick={option.onClick}
+ tooltip={option.tooltip}
+ data-attr={ADD_TILE_MENU_DATA_ATTRS[option.key]}
+ >
+ {option.label}
+ {option.tag && (
+ <Badge
+ variant={option.tag === 'new' ? 'success' : 'warning'}
+ className="ml-auto"
+ >
+ {option.tag.toUpperCase()}
+ </Badge>
+ )}
+ </DropdownMenuItem>
+ )
+ })}
+ </DropdownMenuGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ </MaxTool>
+ )
+}
diff --git a/frontend/src/scenes/dashboard/QuillDashboardCustomizeButton.tsx b/frontend/src/scenes/dashboard/QuillDashboardCustomizeButton.tsx
new file mode 100644
index 000000000000..ca24b161c145
--- /dev/null
+++ b/frontend/src/scenes/dashboard/QuillDashboardCustomizeButton.tsx
@@ -0,0 +1,93 @@
+import { useActions, useValues } from 'kea'
+
+import { IconChevronDown, IconGridMasonry } from '@posthog/icons'
+import {
+ Button,
+ ButtonGroup,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@posthog/quill'
+
+import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { DashboardEventSource } from 'lib/utils/eventUsageLogic'
+import { Scene } from 'scenes/sceneTypes'
+
+import { DashboardCustomizeMenu } from 'products/dashboards/frontend/components/DashboardCustomizeMenu/DashboardCustomizeMenu'
+
+import { dashboardLogic } from './dashboardLogic'
+
+export function QuillDashboardCustomizeButton(): JSX.Element {
+ const { setDashboardEditing } = useActions(dashboardLogic)
+ const { currentLayoutSize } = useValues(dashboardLogic)
+ const layoutAvailable = currentLayoutSize !== 'xs'
+
+ if (!layoutAvailable) {
+ return (
+ <Popover>
+ <PopoverTrigger
+ render={<Button variant="outline" data-attr="dashboard-edit-layout-customize-dropdown" />}
+ >
+ <IconGridMasonry />
+ Customize
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-auto p-0">
+ <DashboardCustomizeMenu />
+ </PopoverContent>
+ </Popover>
+ )
+ }
+
+ return (
+ <ButtonGroup>
+ <Shortcut
+ name="EnterEditMode"
+ scope={Scene.Dashboard}
+ keybind={[keyBinds.edit]}
+ intent="Enter edit mode"
+ interaction="click"
+ >
+ <Button
+ variant="outline"
+ data-attr="dashboard-edit-mode-button"
+ onClick={() =>
+ setDashboardEditing({ filters: true, layout: true }, DashboardEventSource.SceneCommonButtons)
+ }
+ tooltip="Customize dashboard"
+ >
+ <IconGridMasonry />
+ Customize
+ </Button>
+ </Shortcut>
+ <Popover>
+ <Tooltip>
+ <TooltipTrigger
+ delay={0}
+ render={
+ <PopoverTrigger
+ render={
+ <Button
+ variant="outline"
+ size="icon"
+ aria-label="Customize options"
+ data-attr="dashboard-edit-layout-customize-dropdown"
+ />
+ }
+ />
+ }
+ >
+ <IconChevronDown />
+ </TooltipTrigger>
+ <TooltipContent>Customize options</TooltipContent>
+ </Tooltip>
+ <PopoverContent align="end" className="w-auto p-0">
+ <DashboardCustomizeMenu />
+ </PopoverContent>
+ </Popover>
+ </ButtonGroup>
+ )
+}
diff --git a/frontend/src/scenes/dashboard/QuillDashboardHeaderActions.tsx b/frontend/src/scenes/dashboard/QuillDashboardHeaderActions.tsx
new file mode 100644
index 000000000000..7ae24469c5d6
--- /dev/null
+++ b/frontend/src/scenes/dashboard/QuillDashboardHeaderActions.tsx
@@ -0,0 +1,162 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+
+import { IconGridMasonry, IconShare } from '@posthog/icons'
+import { Badge, Button, Popover, PopoverContent, PopoverTrigger } from '@posthog/quill'
+
+import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { DashboardEventSource } from 'lib/utils/eventUsageLogic'
+import { Scene } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
+
+import { AccessControlLevel, AccessControlResourceType, DashboardMode } from '~/types'
+
+import { DashboardCustomizeMenu } from 'products/dashboards/frontend/components/DashboardCustomizeMenu/DashboardCustomizeMenu'
+
+import { dashboardLogic } from './dashboardLogic'
+import { QuillDashboardAddTileButton } from './QuillDashboardAddTileButton'
+import { QuillDashboardCustomizeButton } from './QuillDashboardCustomizeButton'
+import { QuillDashboardSubscribeButton } from './QuillDashboardSubscribeButton'
+
+export function QuillDashboardHeaderActions(): JSX.Element | null {
+ const {
+ dashboard,
+ dashboardEditing,
+ dashboardMode,
+ dashboardLoading,
+ canEditDashboard,
+ layoutEditMode,
+ tiles,
+ dashboardCustomizeMenuOpen,
+ showTextTileModal,
+ showImageTileModal,
+ showButtonTileModal,
+ addWidgetModalOpen,
+ } = useValues(dashboardLogic)
+ const { setDashboardMode, setDashboardCustomizeMenuOpen, cancelLayoutEdit, saveLayout } = useActions(dashboardLogic)
+ const { push } = useActions(router)
+
+ if (!dashboard) {
+ return null
+ }
+
+ if (dashboardEditing) {
+ const withShortcuts = !(showTextTileModal || showImageTileModal || showButtonTileModal || addWidgetModalOpen)
+ const cancelButton = (
+ <Button
+ data-attr="dashboard-edit-mode-discard"
+ variant="outline"
+ onClick={cancelLayoutEdit}
+ tooltip="Discard layout changes and exit layout editing"
+ >
+ Cancel
+ </Button>
+ )
+ const saveButton = (
+ <Button
+ data-attr="dashboard-edit-mode-save"
+ variant="primary"
+ onClick={saveLayout}
+ tooltip="Save dashboard layout"
+ disabledReason={
+ dashboardLoading
+ ? 'Wait for dashboard to finish loading'
+ : canEditDashboard
+ ? undefined
+ : 'Not privileged to edit this dashboard'
+ }
+ >
+ Save layout
+ </Button>
+ )
+
+ return (
+ <>
+ <QuillDashboardSubscribeButton />
+ {layoutEditMode &&
+ (withShortcuts ? (
+ <>
+ <Shortcut
+ name="CancelDashboardEdit"
+ keybind={[keyBinds.escape]}
+ intent="Cancel edit mode"
+ interaction="click"
+ scope={Scene.Dashboard}
+ >
+ {cancelButton}
+ </Shortcut>
+ <Shortcut
+ name="SaveDashboard"
+ keybind={[keyBinds.edit, keyBinds.save]}
+ intent="Save dashboard layout"
+ interaction="click"
+ scope={Scene.Dashboard}
+ disabled={!canEditDashboard}
+ >
+ {saveButton}
+ </Shortcut>
+ </>
+ ) : (
+ <>
+ {cancelButton}
+ {saveButton}
+ </>
+ ))}
+ {canEditDashboard && !layoutEditMode && tiles.length > 0 && <QuillDashboardCustomizeButton />}
+ {layoutEditMode && tiles.length > 0 && (
+ <Popover open={dashboardCustomizeMenuOpen} onOpenChange={setDashboardCustomizeMenuOpen}>
+ <PopoverTrigger
+ render={<Button variant="outline" data-attr="dashboard-edit-layout-customize-dropdown" />}
+ >
+ <IconGridMasonry />
+ Customize
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-auto p-0">
+ <DashboardCustomizeMenu />
+ </PopoverContent>
+ </Popover>
+ )}
+ <QuillDashboardAddTileButton />
+ </>
+ )
+ }
+
+ if (dashboardMode === DashboardMode.Fullscreen) {
+ return (
+ <Button
+ variant="outline"
+ onClick={() => setDashboardMode(null, DashboardEventSource.DashboardHeaderExitFullscreen)}
+ data-attr="dashboard-exit-presentation-mode"
+ disabled={dashboardLoading}
+ >
+ Exit full screen
+ </Button>
+ )
+ }
+
+ const sharingDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.SharingConfiguration,
+ AccessControlLevel.Viewer
+ )
+
+ return (
+ <>
+ <QuillDashboardSubscribeButton />
+ {(tiles.length > 0 || dashboard.is_shared) && (
+ <Button
+ variant="outline"
+ data-attr="dashboard-share-button"
+ onClick={() => push(urls.dashboardSharing(dashboard.id))}
+ disabledReason={sharingDisabledReason}
+ >
+ {dashboard.is_shared ? <Badge variant="success">On</Badge> : <IconShare />}
+ <span>{dashboard.is_shared ? 'Sharing' : 'Share'}</span>
+ </Button>
+ )}
+ {canEditDashboard && tiles.length > 0 && <QuillDashboardCustomizeButton />}
+ <QuillDashboardAddTileButton />
+ </>
+ )
+}
diff --git a/frontend/src/scenes/dashboard/QuillDashboardSubscribeButton.tsx b/frontend/src/scenes/dashboard/QuillDashboardSubscribeButton.tsx
new file mode 100644
index 000000000000..299df94d4a6b
--- /dev/null
+++ b/frontend/src/scenes/dashboard/QuillDashboardSubscribeButton.tsx
@@ -0,0 +1,41 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+import posthog from 'posthog-js'
+
+import { IconBell } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { subscriptionsLogic } from 'products/subscriptions/frontend/components/Subscriptions/subscriptionsLogic'
+import { urlForSubscriptions } from 'products/subscriptions/frontend/components/Subscriptions/utils'
+
+import { dashboardLogic } from './dashboardLogic'
+import { SubscriptionCountBadge } from './SubscriptionCountBadge'
+
+export function QuillDashboardSubscribeButton(): JSX.Element | null {
+ const { dashboard, canEditDashboard, tiles } = useValues(dashboardLogic)
+ const { push } = useActions(router)
+
+ if (!dashboard || !canEditDashboard || tiles.length === 0) {
+ return null
+ }
+
+ const dashboardId = dashboard.id
+
+ return (
+ <Button
+ variant="default"
+ data-attr="dashboard-subscribe-prominent-button"
+ onClick={() => {
+ posthog.capture('dashboard subscribe clicked', {
+ dashboard_id: dashboardId,
+ })
+ push(urlForSubscriptions({ dashboardId }))
+ }}
+ >
+ <IconBell />
+ Subscribe
+ {/* Read the count only when the logic is already mounted, so a dashboard view does not load subscriptions */}
+ {subscriptionsLogic.isMounted({ dashboardId }) && <SubscriptionCountBadge dashboardId={dashboardId} />}
+ </Button>
+ )
+}
diff --git a/frontend/src/scenes/dashboard/SubscriptionCountBadge.tsx b/frontend/src/scenes/dashboard/SubscriptionCountBadge.tsx
new file mode 100644
index 000000000000..5b09af8ebb74
--- /dev/null
+++ b/frontend/src/scenes/dashboard/SubscriptionCountBadge.tsx
@@ -0,0 +1,11 @@
+import { useValues } from 'kea'
+
+import { Badge } from '@posthog/quill'
+
+import { subscriptionsLogic } from 'products/subscriptions/frontend/components/Subscriptions/subscriptionsLogic'
+
+export function SubscriptionCountBadge({ dashboardId }: { dashboardId: number }): JSX.Element | null {
+ const { subscriptions } = useValues(subscriptionsLogic({ dashboardId }))
+ const count = subscriptions?.length ?? 0
+ return count > 0 ? <Badge>{count}</Badge> : null
+}
diff --git a/frontend/src/scenes/dashboard/dashboards/Dashboards.tsx b/frontend/src/scenes/dashboard/dashboards/Dashboards.tsx
index 4506fa601537..16c0cc6e8084 100644
--- a/frontend/src/scenes/dashboard/dashboards/Dashboards.tsx
+++ b/frontend/src/scenes/dashboard/dashboards/Dashboards.tsx
@@ -8,6 +8,7 @@ import { AccessControlAction } from 'lib/components/AccessControlAction'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonTab, LemonTabs } from 'lib/lemon-ui/LemonTabs'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { DashboardsTab, dashboardsLogic } from 'scenes/dashboard/dashboards/dashboardsLogic'
@@ -34,6 +35,7 @@ import { dashboardsEmptyState } from 'products/dashboards/frontend/emptyState/da
import { DashboardsSceneMenuBar } from './DashboardsSceneMenuBar'
import { DashboardsTableContainer } from './DashboardsTable'
import { NewDashboardMenu } from './NewDashboardMenu'
+import { QuillDashboardsActions } from './QuillDashboardsActions'
export const scene: SceneExport = {
component: Dashboards,
@@ -51,6 +53,7 @@ export function Dashboards(): JSX.Element {
const crossProjectTabOpen = crossProjectEnabled && currentTab === DashboardsTab.CrossProject
const { showNewDashboardModal } = useActions(newDashboardLogic)
const templatesModalOpen = String(searchParams.templates) === '1'
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const enabledTabs: LemonTab<DashboardsTab>[] = [
{
key: DashboardsTab.All,
@@ -93,6 +96,8 @@ export function Dashboards(): JSX.Element {
actions={
crossProjectTabOpen ? (
<NewCrossProjectDashboardButton />
+ ) : todayRailNav ? (
+ <QuillDashboardsActions />
) : (
<AccessControlAction
resourceType={AccessControlResourceType.Dashboard}
diff --git a/frontend/src/scenes/dashboard/dashboards/QuillDashboardsActions.tsx b/frontend/src/scenes/dashboard/dashboards/QuillDashboardsActions.tsx
new file mode 100644
index 000000000000..cc98fc117969
--- /dev/null
+++ b/frontend/src/scenes/dashboard/dashboards/QuillDashboardsActions.tsx
@@ -0,0 +1,89 @@
+import { useActions, useValues } from 'kea'
+import { combineUrl, router } from 'kea-router'
+
+import { IconChevronDown, IconPencil, IconPlus } from '@posthog/icons'
+import {
+ Button,
+ ButtonGroup,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { newDashboardLogic } from 'scenes/dashboard/newDashboardLogic'
+import { Scene } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+export function QuillDashboardsActions(): JSX.Element {
+ const { showNewDashboardModal } = useActions(newDashboardLogic)
+ const { searchParams } = useValues(router)
+ const { push } = useActions(router)
+ const accessDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.Dashboard,
+ AccessControlLevel.Editor
+ )
+
+ return (
+ <ButtonGroup>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Dashboard}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Shortcut
+ name="NewDashboard"
+ keybind={[keyBinds.new]}
+ intent="New dashboard"
+ interaction="click"
+ scope={Scene.Dashboards}
+ >
+ <Button variant="primary" data-attr="new-dashboard" onClick={showNewDashboardModal}>
+ New dashboard
+ </Button>
+ </Shortcut>
+ </AccessControlAction>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="primary"
+ size="icon"
+ aria-label="More dashboard options"
+ data-attr="new-dashboard-dropdown"
+ disabledReason={accessDisabledReason}
+ />
+ }
+ >
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-64">
+ <DropdownMenuItem
+ onClick={showNewDashboardModal}
+ data-attr="new-dashboard-menu-item"
+ description="Start blank or from a template"
+ >
+ <IconPlus />
+ New dashboard
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ onClick={() => push(combineUrl(urls.dashboardTemplates(), searchParams).url)}
+ // Pinned analytics value: insights built on clicks that open the templates list match on it.
+ data-attr="view-dashboard-templates"
+ description="Edit, share or delete your templates"
+ >
+ <IconPencil />
+ Manage templates
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </ButtonGroup>
+ )
+}
diff --git a/frontend/src/scenes/data-management/definition/DefinitionEdit.tsx b/frontend/src/scenes/data-management/definition/DefinitionEdit.tsx
index 866c4acb98e0..c9a521771c28 100644
--- a/frontend/src/scenes/data-management/definition/DefinitionEdit.tsx
+++ b/frontend/src/scenes/data-management/definition/DefinitionEdit.tsx
@@ -4,6 +4,7 @@ import { createRef } from 'react'
import { IconImage } from '@posthog/icons'
import { LemonSkeleton, LemonTag } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { PropertyStatusControl } from 'lib/components/DefinitionPopover/DefinitionPopoverContents'
import { FlaggedFeature } from 'lib/components/FlaggedFeature'
@@ -15,6 +16,7 @@ import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { TaxonomicPopover } from 'lib/components/TaxonomicPopover/TaxonomicPopover'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useUploadFiles } from 'lib/hooks/useUploadFiles'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonField } from 'lib/lemon-ui/LemonField'
@@ -23,6 +25,7 @@ import { LemonLabel } from 'lib/lemon-ui/LemonLabel/LemonLabel'
import { LemonSelect } from 'lib/lemon-ui/LemonSelect'
import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea/LemonTextArea'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { getPrimaryPropertyForEvent, hasTaxonomyPrimaryProperty } from 'lib/utils/events'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { definitionEditLogic } from 'scenes/data-management/definition/definitionEditLogic'
@@ -65,6 +68,7 @@ export function DefinitionEdit(rawProps: DefinitionLogicProps): JSX.Element {
const { currentTeamId } = useValues(teamLogic)
const { objectStorageAvailable } = useValues(preflightLogic)
const { reportMediaPreviewUploaded } = useActions(eventUsageLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const allowVerification = !isCoreFilter(editDefinition.name) && 'verified' in editDefinition
@@ -113,32 +117,63 @@ export function DefinitionEdit(rawProps: DefinitionLogicProps): JSX.Element {
}
}
actions={
- <>
- <LemonButton
- data-attr="save-definition"
- type="primary"
- size="small"
- onClick={() => {
- saveDefinition({})
- }}
- disabledReason={definitionLoading ? 'Loading...' : undefined}
- >
- Save
- </LemonButton>
- <LemonButton
- data-attr="cancel-definition"
- type="secondary"
- size="small"
- to={
- !isProperty
- ? urls.eventDefinition(editDefinition.id)
- : urls.propertyDefinition(editDefinition.id)
- }
- disabledReason={definitionLoading ? 'Loading...' : undefined}
- >
- Cancel
- </LemonButton>
- </>
+ todayRailNav ? (
+ <>
+ <Button
+ data-attr="save-definition"
+ variant="primary"
+ onClick={() => {
+ saveDefinition({})
+ }}
+ disabledReason={definitionLoading ? 'Loading...' : undefined}
+ >
+ Save
+ </Button>
+ <Button
+ data-attr="cancel-definition"
+ variant="outline"
+ render={
+ <LinkPrimitive
+ to={
+ !isProperty
+ ? urls.eventDefinition(editDefinition.id)
+ : urls.propertyDefinition(editDefinition.id)
+ }
+ />
+ }
+ disabledReason={definitionLoading ? 'Loading...' : undefined}
+ >
+ Cancel
+ </Button>
+ </>
+ ) : (
+ <>
+ <LemonButton
+ data-attr="save-definition"
+ type="primary"
+ size="small"
+ onClick={() => {
+ saveDefinition({})
+ }}
+ disabledReason={definitionLoading ? 'Loading...' : undefined}
+ >
+ Save
+ </LemonButton>
+ <LemonButton
+ data-attr="cancel-definition"
+ type="secondary"
+ size="small"
+ to={
+ !isProperty
+ ? urls.eventDefinition(editDefinition.id)
+ : urls.propertyDefinition(editDefinition.id)
+ }
+ disabledReason={definitionLoading ? 'Loading...' : undefined}
+ >
+ Cancel
+ </LemonButton>
+ </>
+ )
}
/>
diff --git a/frontend/src/scenes/data-management/definition/DefinitionView.tsx b/frontend/src/scenes/data-management/definition/DefinitionView.tsx
index 77e4c051d38b..43e23ec13980 100644
--- a/frontend/src/scenes/data-management/definition/DefinitionView.tsx
+++ b/frontend/src/scenes/data-management/definition/DefinitionView.tsx
@@ -4,6 +4,7 @@ import { useMemo } from 'react'
import { IconBadge, IconEye, IconHide, IconInfo } from '@posthog/icons'
import { LemonTag, LemonTagType, Spinner, Tooltip } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { FlaggedFeature } from 'lib/components/FlaggedFeature'
import { ImageCarousel } from 'lib/components/ImageCarousel/ImageCarousel'
@@ -15,6 +16,7 @@ import { TZLabel } from 'lib/components/TZLabel'
import { UserActivityIndicator } from 'lib/components/UserActivityIndicator/UserActivityIndicator'
import ViewRecordingsPlaylistButton from 'lib/components/ViewRecordingButton/ViewRecordingsPlaylistButton'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
import { SpinnerOverlay } from 'lib/lemon-ui/Spinner/Spinner'
@@ -133,6 +135,7 @@ export function DefinitionView(rawProps: DefinitionLogicProps): JSX.Element {
const { definition, definitionLoading, definitionMissing, singular, isEvent, isProperty, metrics, metricsLoading } =
useValues(logic)
const { deleteDefinition } = useActions(logic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const memoizedQuery = useMemo(() => {
const columnsToUse =
@@ -183,6 +186,42 @@ export function DefinitionView(rawProps: DefinitionLogicProps): JSX.Element {
? getCoreFilterDefinition(definition.name, virtualProperty.group)?.description
: definition.description
+ const openEditDefinition = (): void => {
+ if (isProperty) {
+ router.actions.push(urls.propertyDefinitionEdit(definition.id))
+ } else {
+ router.actions.push(urls.eventDefinitionEdit(definition.id))
+ }
+ }
+
+ const openDeleteDialog = (): void =>
+ LemonDialog.open({
+ title: `Delete this ${singular} definition?`,
+ description: (
+ <>
+ <p>
+ <strong>
+ {getFilterLabel(
+ definition.name,
+ isEvent ? TaxonomicFilterGroupType.Events : TaxonomicFilterGroupType.EventProperties
+ )}
+ </strong>{' '}
+ will no longer appear in selectors. Associated data will remain in the database.
+ </p>
+ <p>This definition will be recreated if the {singular} is ever seen again in the event stream.</p>
+ </>
+ ),
+ primaryButton: {
+ status: 'danger',
+ children: 'Delete definition',
+ onClick: () => deleteDefinition(),
+ },
+ secondaryButton: {
+ children: 'Cancel',
+ },
+ width: 448,
+ })
+
return (
<SceneContent>
<SceneTitleSection
@@ -225,67 +264,43 @@ export function DefinitionView(rawProps: DefinitionLogicProps): JSX.Element {
data-attr="event-definition-view-recordings"
/>
)}
- {!isVirtual && (
- <>
- <LemonButton
- data-attr="delete-definition"
- type="secondary"
- status="danger"
- size="small"
- onClick={() =>
- LemonDialog.open({
- title: `Delete this ${singular} definition?`,
- description: (
- <>
- <p>
- <strong>
- {getFilterLabel(
- definition.name,
- isEvent
- ? TaxonomicFilterGroupType.Events
- : TaxonomicFilterGroupType.EventProperties
- )}
- </strong>{' '}
- will no longer appear in selectors. Associated data will remain
- in the database.
- </p>
- <p>
- This definition will be recreated if the {singular} is ever seen
- again in the event stream.
- </p>
- </>
- ),
- primaryButton: {
- status: 'danger',
- children: 'Delete definition',
- onClick: () => deleteDefinition(),
- },
- secondaryButton: {
- children: 'Cancel',
- },
- width: 448,
- })
- }
- tooltip="Delete this definition. Associated data will remain."
- >
- Delete
- </LemonButton>
- <LemonButton
- data-attr="edit-definition"
- type="secondary"
- size="small"
- onClick={() => {
- if (isProperty) {
- router.actions.push(urls.propertyDefinitionEdit(definition.id))
- } else {
- router.actions.push(urls.eventDefinitionEdit(definition.id))
- }
- }}
- >
- Edit
- </LemonButton>
- </>
- )}
+ {!isVirtual &&
+ (todayRailNav ? (
+ <>
+ <Button
+ data-attr="delete-definition"
+ variant="destructive-outline"
+ onClick={openDeleteDialog}
+ tooltip="Delete this definition. Associated data will remain."
+ >
+ Delete
+ </Button>
+ <Button data-attr="edit-definition" variant="outline" onClick={openEditDefinition}>
+ Edit
+ </Button>
+ </>
+ ) : (
+ <>
+ <LemonButton
+ data-attr="delete-definition"
+ type="secondary"
+ status="danger"
+ size="small"
+ onClick={openDeleteDialog}
+ tooltip="Delete this definition. Associated data will remain."
+ >
+ Delete
+ </LemonButton>
+ <LemonButton
+ data-attr="edit-definition"
+ type="secondary"
+ size="small"
+ onClick={openEditDefinition}
+ >
+ Edit
+ </LemonButton>
+ </>
+ ))}
</>
}
forceBackTo={
diff --git a/frontend/src/scenes/data-management/variables/SqlVariableEditScene.tsx b/frontend/src/scenes/data-management/variables/SqlVariableEditScene.tsx
index 4a71ce94fa62..03efbbf69b04 100644
--- a/frontend/src/scenes/data-management/variables/SqlVariableEditScene.tsx
+++ b/frontend/src/scenes/data-management/variables/SqlVariableEditScene.tsx
@@ -3,7 +3,9 @@ import { Form } from 'kea-forms'
import { IconCopy, IconInfo } from '@posthog/icons'
import { LemonInput, LemonSelect, LemonSkeleton, LemonTable } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
@@ -66,6 +68,14 @@ export function SqlVariableEditScene(): JSX.Element {
} = useValues(sqlVariableEditSceneLogic)
const { setVariableType, setVariableFormValues, submitVariableForm, resetVariableForm } =
useActions(sqlVariableEditSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ const discardChanges = (): void => {
+ if (variable) {
+ resetVariableForm(variableToFormValues(variable))
+ setVariableType(variable.type)
+ }
+ }
const title = isNew ? 'New variable' : variableForm.name || 'Edit variable'
const codeNameFallback = getCodeName(variableForm.name ?? '')
@@ -91,32 +101,49 @@ export function SqlVariableEditScene(): JSX.Element {
key: 'variables',
}}
actions={
- <>
- <LemonButton
- data-attr="discard-variable-changes"
- type="secondary"
- size="small"
- disabledReason={!isNew && !hasChanges ? 'No changes to discard' : undefined}
- onClick={() => {
- if (variable) {
- resetVariableForm(variableToFormValues(variable))
- setVariableType(variable.type)
- }
- }}
- >
- Discard changes
- </LemonButton>
- <LemonButton
- data-attr="save-variable"
- type="primary"
- size="small"
- onClick={submitVariableForm}
- loading={isVariableFormSubmitting}
- disabledReason={!isNew && !hasChanges ? 'No changes to save' : undefined}
- >
- Save
- </LemonButton>
- </>
+ todayRailNav ? (
+ <>
+ <Button
+ data-attr="discard-variable-changes"
+ variant="outline"
+ disabledReason={!isNew && !hasChanges ? 'No changes to discard' : undefined}
+ onClick={discardChanges}
+ >
+ Discard changes
+ </Button>
+ <Button
+ data-attr="save-variable"
+ variant="primary"
+ onClick={submitVariableForm}
+ loading={isVariableFormSubmitting}
+ disabledReason={!isNew && !hasChanges ? 'No changes to save' : undefined}
+ >
+ Save
+ </Button>
+ </>
+ ) : (
+ <>
+ <LemonButton
+ data-attr="discard-variable-changes"
+ type="secondary"
+ size="small"
+ disabledReason={!isNew && !hasChanges ? 'No changes to discard' : undefined}
+ onClick={discardChanges}
+ >
+ Discard changes
+ </LemonButton>
+ <LemonButton
+ data-attr="save-variable"
+ type="primary"
+ size="small"
+ onClick={submitVariableForm}
+ loading={isVariableFormSubmitting}
+ disabledReason={!isNew && !hasChanges ? 'No changes to save' : undefined}
+ >
+ Save
+ </LemonButton>
+ </>
+ )
}
/>
diff --git a/frontend/src/scenes/data-management/variables/SqlVariablesTable.tsx b/frontend/src/scenes/data-management/variables/SqlVariablesTable.tsx
index 337ed76fe651..875e0b854a0a 100644
--- a/frontend/src/scenes/data-management/variables/SqlVariablesTable.tsx
+++ b/frontend/src/scenes/data-management/variables/SqlVariablesTable.tsx
@@ -2,9 +2,12 @@ import { useActions, useValues } from 'kea'
import { IconPencil, IconTrash } from '@posthog/icons'
import { LemonDialog, LemonInput, LemonTag, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonTable, LemonTableColumn, LemonTableColumns } from 'lib/lemon-ui/LemonTable'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
@@ -17,6 +20,7 @@ import { sqlVariablesLogic } from './sqlVariablesLogic'
export function SqlVariablesTable(): JSX.Element {
const { filteredVariables, variablesLoading, searchTerm } = useValues(sqlVariablesLogic)
const { deleteVariable, setSearchTerm } = useActions(sqlVariablesLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const handleDelete = (variable: Variable): void => {
LemonDialog.open({
@@ -108,9 +112,15 @@ export function SqlVariablesTable(): JSX.Element {
description="Create reusable variables for your SQL queries. Use variables to parameterize your queries and make them dynamic."
resourceType={{ type: 'variable' }}
actions={
- <LemonButton type="primary" size="small" to={urls.variableEdit('new')}>
- New variable
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="primary" render={<LinkPrimitive to={urls.variableEdit('new')} />}>
+ New variable
+ </Button>
+ ) : (
+ <LemonButton type="primary" size="small" to={urls.variableEdit('new')}>
+ New variable
+ </LemonButton>
+ )
}
/>
<div className="flex flex-row items-center gap-2 justify-start mb-4">
diff --git a/frontend/src/scenes/data-pipelines/DestinationsScene.tsx b/frontend/src/scenes/data-pipelines/DestinationsScene.tsx
index 3b7e3498320b..995bab0b3a83 100644
--- a/frontend/src/scenes/data-pipelines/DestinationsScene.tsx
+++ b/frontend/src/scenes/data-pipelines/DestinationsScene.tsx
@@ -1,11 +1,14 @@
import { useActions, useValues } from 'kea'
-import { IconPlusSmall } from '@posthog/icons'
+import { IconPlus, IconPlusSmall } from '@posthog/icons'
import { LemonButton, LemonTab, LemonTabs } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -63,6 +66,7 @@ const TABS: LemonTab<DestinationsSceneTab>[] = [
export function DestinationsScene(): JSX.Element {
const { activeTab } = useValues(destinationsSceneLogic)
const { setActiveTab } = useActions(destinationsSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const action = (
<Shortcut
@@ -72,16 +76,28 @@ export function DestinationsScene(): JSX.Element {
interaction="click"
scope={Scene.Destinations}
>
- <LemonButton
- type="primary"
- to={urls.dataPipelinesNew('destination')}
- icon={<IconPlusSmall />}
- size="small"
- tooltip="New destination"
- data-attr="new-destination"
- >
- New destination
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.dataPipelinesNew('destination')} />}
+ tooltip="New destination"
+ data-attr="new-destination"
+ >
+ <IconPlus />
+ New destination
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ to={urls.dataPipelinesNew('destination')}
+ icon={<IconPlusSmall />}
+ size="small"
+ tooltip="New destination"
+ data-attr="new-destination"
+ >
+ New destination
+ </LemonButton>
+ )}
</Shortcut>
)
diff --git a/frontend/src/scenes/data-pipelines/TransformationsScene.tsx b/frontend/src/scenes/data-pipelines/TransformationsScene.tsx
index ed866105c651..a1efff0f7e58 100644
--- a/frontend/src/scenes/data-pipelines/TransformationsScene.tsx
+++ b/frontend/src/scenes/data-pipelines/TransformationsScene.tsx
@@ -1,8 +1,11 @@
-import { IconPlusSmall } from '@posthog/icons'
+import { IconPlus, IconPlusSmall } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -24,6 +27,7 @@ export const scene: SceneExport = {
}
export function TransformationsScene(): JSX.Element {
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const action = (
<Shortcut
name="NewPipelineTransformation"
@@ -32,16 +36,28 @@ export function TransformationsScene(): JSX.Element {
interaction="click"
scope={Scene.Transformations}
>
- <LemonButton
- type="primary"
- to={urls.dataPipelinesNew('transformation')}
- icon={<IconPlusSmall />}
- size="small"
- tooltip="New transformation"
- data-attr="new-transformation"
- >
- New transformation
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.dataPipelinesNew('transformation')} />}
+ tooltip="New transformation"
+ data-attr="new-transformation"
+ >
+ <IconPlus />
+ New transformation
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ to={urls.dataPipelinesNew('transformation')}
+ icon={<IconPlusSmall />}
+ size="small"
+ tooltip="New transformation"
+ data-attr="new-transformation"
+ >
+ New transformation
+ </LemonButton>
+ )}
</Shortcut>
)
diff --git a/frontend/src/scenes/data-pipelines/WebScriptsScene.tsx b/frontend/src/scenes/data-pipelines/WebScriptsScene.tsx
index f7544a4bda68..4ccbae916c11 100644
--- a/frontend/src/scenes/data-pipelines/WebScriptsScene.tsx
+++ b/frontend/src/scenes/data-pipelines/WebScriptsScene.tsx
@@ -1,11 +1,14 @@
import { useActions, useValues } from 'kea'
-import { IconPlusSmall } from '@posthog/icons'
+import { IconPlus, IconPlusSmall } from '@posthog/icons'
import { LemonButton, LemonTabs } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -30,6 +33,7 @@ export const scene: SceneExport = {
export function WebScriptsScene(): JSX.Element {
const { activeTab } = useValues(webScriptsSceneLogic)
const { setActiveTab } = useActions(webScriptsSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const action = (
<Shortcut
@@ -39,16 +43,28 @@ export function WebScriptsScene(): JSX.Element {
interaction="click"
scope={Scene.WebScripts}
>
- <LemonButton
- type="primary"
- to={urls.webScriptsNew()}
- icon={<IconPlusSmall />}
- size="small"
- tooltip="New web script"
- data-attr="new-web-script"
- >
- New web script
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.webScriptsNew()} />}
+ tooltip="New web script"
+ data-attr="new-web-script"
+ >
+ <IconPlus />
+ New web script
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ to={urls.webScriptsNew()}
+ icon={<IconPlusSmall />}
+ size="small"
+ tooltip="New web script"
+ data-attr="new-web-script"
+ >
+ New web script
+ </LemonButton>
+ )}
</Shortcut>
)
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/BatchExportScene.tsx b/frontend/src/scenes/data-pipelines/batch-exports/BatchExportScene.tsx
index eb9c3c21fc02..00cdfa799990 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/BatchExportScene.tsx
+++ b/frontend/src/scenes/data-pipelines/batch-exports/BatchExportScene.tsx
@@ -43,6 +43,7 @@ import {
import { RenderBatchExportIcon } from './BatchExportIcon'
import { BatchExportNotifications } from './BatchExportNotifications'
import { BatchExportsMetrics } from './BatchExportsMetrics'
+import { QuillBatchExportSceneActions } from './QuillBatchExportSceneActions'
import { humanizeBatchExportName, normalizeBatchExportService } from './utils'
const BATCH_EXPORT_SCENE_TABS = [
@@ -170,6 +171,7 @@ export const scene: SceneExport = {
function BatchExportSceneHeader(): JSX.Element {
const { configuration, batchExportConfigLoading } = useValues(batchExportConfigFormLogic)
const { setConfigurationValue, deleteBatchExport } = useActions(batchExportConfigFormLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<>
@@ -189,21 +191,25 @@ function BatchExportSceneHeader(): JSX.Element {
onDescriptionChange={(value) => setConfigurationValue('description', value)}
canEdit
actions={
- <>
- <More
- size="small"
- overlay={
- <>
- <LemonButton status="danger" fullWidth onClick={() => deleteBatchExport()}>
- Delete
- </LemonButton>
- </>
- }
- />
- <LemonDivider vertical />
- <BatchExportConfigurationClearChangesButton />
- <BatchExportConfigurationSaveButton />
- </>
+ todayRailNav ? (
+ <QuillBatchExportSceneActions />
+ ) : (
+ <>
+ <More
+ size="small"
+ overlay={
+ <>
+ <LemonButton status="danger" fullWidth onClick={() => deleteBatchExport()}>
+ Delete
+ </LemonButton>
+ </>
+ }
+ />
+ <LemonDivider vertical />
+ <BatchExportConfigurationClearChangesButton />
+ <BatchExportConfigurationSaveButton />
+ </>
+ )
}
/>
</>
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/QuillBatchExportSceneActions.tsx b/frontend/src/scenes/data-pipelines/batch-exports/QuillBatchExportSceneActions.tsx
new file mode 100644
index 000000000000..a2396573eade
--- /dev/null
+++ b/frontend/src/scenes/data-pipelines/batch-exports/QuillBatchExportSceneActions.tsx
@@ -0,0 +1,56 @@
+import { useActions, useValues } from 'kea'
+
+import { IconEllipsis } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+import { batchExportConfigFormLogic, getDefaultConfiguration } from './batchExportConfigFormLogic'
+
+export function QuillBatchExportSceneActions(): JSX.Element {
+ const { isNew, isConfigurationSubmitting, configurationChanged, savedConfiguration, service } =
+ useValues(batchExportConfigFormLogic)
+ const { deleteBatchExport, resetConfiguration, submitConfiguration } = useActions(batchExportConfigFormLogic)
+
+ return (
+ <>
+ <DropdownMenu>
+ <DropdownMenuTrigger render={<Button size="icon" aria-label="More" tooltip="More" />}>
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem variant="destructive" onClick={() => deleteBatchExport()}>
+ Delete
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ {configurationChanged ? (
+ <Button
+ variant="outline"
+ type="reset"
+ onClick={() =>
+ isNew && service
+ ? resetConfiguration(getDefaultConfiguration(service))
+ : resetConfiguration(savedConfiguration)
+ }
+ disabledReason={isConfigurationSubmitting ? 'Saving in progress…' : undefined}
+ >
+ {isNew ? 'Reset' : 'Clear changes'}
+ </Button>
+ ) : null}
+ <Button
+ variant="primary"
+ type="submit"
+ onClick={submitConfiguration}
+ loading={isConfigurationSubmitting}
+ disabledReason={
+ !configurationChanged
+ ? 'No changes to save'
+ : isConfigurationSubmitting
+ ? 'Saving in progress…'
+ : undefined
+ }
+ >
+ {isNew ? 'Create' : 'Save'}
+ </Button>
+ </>
+ )
+}
diff --git a/frontend/src/scenes/data-warehouse/editor/QuillSQLEditorSceneActions.tsx b/frontend/src/scenes/data-warehouse/editor/QuillSQLEditorSceneActions.tsx
new file mode 100644
index 000000000000..1f928cea80be
--- /dev/null
+++ b/frontend/src/scenes/data-warehouse/editor/QuillSQLEditorSceneActions.tsx
@@ -0,0 +1,309 @@
+import { useActions, useValues } from 'kea'
+
+import { IconBook, IconChevronDown, IconDownload, IconNotebook, IconX } from '@posthog/icons'
+import {
+ Button,
+ ButtonGroup,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { dataWarehouseViewsLogic } from '../saved_queries/dataWarehouseViewsLogic'
+import { SaveAsMenuItem, editorSceneLogic } from './editorSceneLogic'
+import { sqlEditorLogic } from './sqlEditorLogic'
+
+export interface QuillSQLEditorSecondarySaveMenuItem extends SaveAsMenuItem {
+ onClick: () => void
+ accessDisabledReason: string | null | undefined
+}
+
+export interface QuillSQLEditorSceneActionsProps {
+ isMaterializedView: boolean
+ closeObjectTooltip: string
+ editingViewDisabledReason: string | undefined
+ editingViewLoading: boolean
+ onUpdateView: () => void
+ saveAsInsightDisabledReason: string | undefined
+ saveAsDisabledReason: string | undefined
+ saveAsViewAccessDisabledReason: string | null
+ saveAsEndpointDisabledReason: string | null
+ continueInNotebookAccessDisabledReason: string | null
+ secondarySaveMenuItems: QuillSQLEditorSecondarySaveMenuItem[]
+ onPrimarySaveClick: () => void
+}
+
+export function QuillSQLEditorSceneActions({
+ isMaterializedView,
+ closeObjectTooltip,
+ editingViewDisabledReason,
+ editingViewLoading,
+ onUpdateView,
+ saveAsInsightDisabledReason,
+ saveAsDisabledReason,
+ saveAsViewAccessDisabledReason,
+ saveAsEndpointDisabledReason,
+ continueInNotebookAccessDisabledReason,
+ secondarySaveMenuItems,
+ onPrimarySaveClick,
+}: QuillSQLEditorSceneActionsProps): JSX.Element {
+ const { updateInsightButtonEnabled, saveAsMenuItems, notebooksLoading } = useValues(editorSceneLogic)
+ const {
+ queryInput,
+ editingView,
+ editingInsight,
+ insightLoading,
+ hasEditorChanges,
+ editingMetricName,
+ metricUpdating,
+ } = useValues(sqlEditorLogic)
+ const { updatingDataWarehouseSavedQuery } = useValues(dataWarehouseViewsLogic)
+ const { convertToNotebook, openHistoryModal } = useActions(editorSceneLogic)
+ const {
+ updateInsight,
+ closeEditingObject,
+ saveAsInsight,
+ saveAsView,
+ saveAsEndpoint,
+ updateEditingMetric,
+ setEditingMetricName,
+ discardChanges,
+ } = useActions(sqlEditorLogic)
+
+ const continueInNotebookDisabledReason = queryInput?.trim()
+ ? continueInNotebookAccessDisabledReason
+ : 'Write a SQL query before continuing'
+
+ const historyButton = (dataAttr?: string): JSX.Element => (
+ <Button variant="outline" onClick={() => openHistoryModal()} data-attr={dataAttr}>
+ <IconBook />
+ History
+ </Button>
+ )
+
+ const discardChangesButton = (
+ <Button
+ variant="outline"
+ onClick={() => discardChanges()}
+ disabledReason={
+ insightLoading || updatingDataWarehouseSavedQuery
+ ? 'Wait for the current operation to finish'
+ : !hasEditorChanges
+ ? 'No changes to discard'
+ : undefined
+ }
+ data-attr="sql-editor-discard-changes"
+ >
+ Discard changes
+ </Button>
+ )
+
+ const continueInNotebookMenuItem = (
+ <DropdownMenuItem
+ onClick={() => convertToNotebook()}
+ disabledReason={notebooksLoading ? 'Creating notebook...' : continueInNotebookDisabledReason}
+ data-attr="sql-editor-continue-in-notebook-button"
+ >
+ <IconNotebook />
+ Continue in a notebook
+ </DropdownMenuItem>
+ )
+
+ const saveAsMenuItemsGroup = (
+ <DropdownMenuGroup>
+ {continueInNotebookMenuItem}
+ <DropdownMenuItem disabledReason={saveAsInsightDisabledReason} onClick={() => saveAsInsight()}>
+ Save as new insight...
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ disabledReason={saveAsDisabledReason ?? saveAsViewAccessDisabledReason}
+ onClick={() => saveAsView()}
+ >
+ Save as new view...
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ disabledReason={saveAsDisabledReason ?? saveAsEndpointDisabledReason}
+ onClick={() => saveAsEndpoint()}
+ >
+ Save as endpoint...
+ </DropdownMenuItem>
+ </DropdownMenuGroup>
+ )
+
+ const secondarySaveMenuContent = (
+ <DropdownMenuContent align="end">
+ {secondarySaveMenuItems.map((item) => (
+ <DropdownMenuItem
+ key={item.action}
+ disabledReason={
+ (item.action === 'insight' ? saveAsInsightDisabledReason : saveAsDisabledReason) ??
+ item.accessDisabledReason
+ }
+ onClick={item.onClick}
+ >
+ {item.label}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ )
+
+ const saveOptionsTrigger = (dataAttr?: string): JSX.Element => (
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="primary"
+ size="icon"
+ aria-label="More save options"
+ tooltip="More save options"
+ data-attr={dataAttr}
+ />
+ }
+ >
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ )
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ {editingView ? (
+ <>
+ {historyButton()}
+ {discardChangesButton}
+ <DropdownMenu>
+ <ButtonGroup>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.WarehouseObjects}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={editingView.user_access_level}
+ >
+ <Button
+ variant="primary"
+ onClick={onUpdateView}
+ loading={editingViewLoading}
+ disabledReason={editingViewDisabledReason}
+ >
+ {!editingViewLoading && <IconDownload />}
+ {isMaterializedView ? 'Update and re-materialize view' : 'Update view'}
+ </Button>
+ </AccessControlAction>
+ {saveOptionsTrigger()}
+ </ButtonGroup>
+ <DropdownMenuContent align="end">{saveAsMenuItemsGroup}</DropdownMenuContent>
+ </DropdownMenu>
+ <Button
+ variant="default"
+ size="icon"
+ onClick={() => closeEditingObject()}
+ aria-label="close"
+ tooltip={closeObjectTooltip}
+ >
+ <IconX />
+ </Button>
+ </>
+ ) : editingInsight ? (
+ <>
+ {historyButton('sql-editor-insight-history-button')}
+ {discardChangesButton}
+ <DropdownMenu>
+ <ButtonGroup>
+ <Button
+ variant="primary"
+ onClick={() => updateInsight()}
+ loading={insightLoading}
+ disabledReason={
+ saveAsInsightDisabledReason ??
+ (!updateInsightButtonEnabled ? 'No updates to save' : undefined)
+ }
+ >
+ Update insight
+ </Button>
+ {saveOptionsTrigger('sql-editor-save-options-button')}
+ </ButtonGroup>
+ <DropdownMenuContent align="end">
+ {saveAsMenuItemsGroup}
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ onClick={() => closeEditingObject()}
+ data-attr="sql-editor-reset-view"
+ title={closeObjectTooltip}
+ >
+ Reset view
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </>
+ ) : editingMetricName ? (
+ <>
+ <DropdownMenu>
+ <ButtonGroup>
+ <Button
+ variant="primary"
+ onClick={() => updateEditingMetric()}
+ loading={metricUpdating}
+ disabledReason={saveAsDisabledReason}
+ data-attr="sql-editor-update-metric"
+ >
+ Update metric
+ </Button>
+ {saveOptionsTrigger()}
+ </ButtonGroup>
+ {secondarySaveMenuContent}
+ </DropdownMenu>
+ <Button
+ variant="default"
+ size="icon"
+ onClick={() => setEditingMetricName(null)}
+ aria-label="Stop editing metric"
+ tooltip="Stop editing this metric and start a new query"
+ >
+ <IconX />
+ </Button>
+ </>
+ ) : (
+ <>
+ {saveAsMenuItems.primary.action === 'insight' && (
+ <Button
+ variant="outline"
+ onClick={() => convertToNotebook()}
+ loading={notebooksLoading}
+ disabledReason={continueInNotebookDisabledReason}
+ data-attr="sql-editor-continue-in-notebook-button"
+ >
+ <IconNotebook />
+ Continue in a notebook
+ </Button>
+ )}
+ <DropdownMenu>
+ <ButtonGroup>
+ <Button
+ variant="primary"
+ onClick={onPrimarySaveClick}
+ disabledReason={
+ (saveAsMenuItems.primary.action === 'insight'
+ ? saveAsInsightDisabledReason
+ : saveAsDisabledReason) ??
+ (saveAsMenuItems.primary.action === 'endpoint'
+ ? saveAsEndpointDisabledReason
+ : saveAsMenuItems.primary.action === 'view'
+ ? saveAsViewAccessDisabledReason
+ : undefined)
+ }
+ >
+ {saveAsMenuItems.primary.label}
+ </Button>
+ {saveOptionsTrigger('sql-editor-save-options-button')}
+ </ButtonGroup>
+ {secondarySaveMenuContent}
+ </DropdownMenu>
+ </>
+ )}
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/data-warehouse/editor/SQLEditor.tsx b/frontend/src/scenes/data-warehouse/editor/SQLEditor.tsx
index e5d6b34de8a3..1d123b8373df 100644
--- a/frontend/src/scenes/data-warehouse/editor/SQLEditor.tsx
+++ b/frontend/src/scenes/data-warehouse/editor/SQLEditor.tsx
@@ -8,6 +8,7 @@ import { LemonModal, LemonTag, Spinner } from '@posthog/lemon-ui'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { useDebouncedValue } from 'lib/hooks/useDebouncedValue'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonMenuOverlay } from 'lib/lemon-ui/LemonMenu/LemonMenu'
@@ -54,6 +55,7 @@ import { OutputPane } from './OutputPane'
import { outputPaneLogic } from './outputPaneLogic'
import { QueryHistoryModal } from './QueryHistoryModal'
import { QueryWindow } from './QueryWindow'
+import { QuillSQLEditorSceneActions } from './QuillSQLEditorSceneActions'
import { sqlEditorLogic } from './sqlEditorLogic'
import { SQLEditorMode, isEmbeddedSQLEditorMode } from './sqlEditorModes'
@@ -523,6 +525,7 @@ function SQLEditorSceneTitle(): JSX.Element | null {
const { editingMetricName, metricUpdating } = useValues(sqlEditorLogic)
const { response, responseError, responseLoading } = useValues(dataNodeLogic)
const { updatingDataWarehouseSavedQuery } = useValues(dataWarehouseViewsLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const debouncedQueryInput = useDebouncedValue(queryInput, MAX_TOOL_CONTEXT_DEBOUNCE_MS)
const debouncedSourceQuery = useDebouncedValue(sourceQuery, MAX_TOOL_CONTEXT_DEBOUNCE_MS)
@@ -647,34 +650,46 @@ function SQLEditorSceneTitle(): JSX.Element | null {
return undefined
}, [insightLoading, isSourceQueryLastRun, responseLoading, responseError, response])
- const [editingViewDisabledReason, EditingViewButtonIcon] = useMemo(() => {
+ const { editingViewDisabledReason, editingViewLoading } = useMemo((): {
+ editingViewDisabledReason: string | undefined
+ editingViewLoading: boolean
+ } => {
if (updatingDataWarehouseSavedQuery) {
- return ['Saving...', Spinner]
+ return { editingViewDisabledReason: 'Saving...', editingViewLoading: true }
}
if (isMultiQuery) {
- return ['Views must be a single query — remove extra statements to update', IconDownload]
+ return {
+ editingViewDisabledReason: 'Views must be a single query — remove extra statements to update',
+ editingViewLoading: false,
+ }
}
if (!changesToSave) {
- return ['No changes to save', IconDownload]
+ return { editingViewDisabledReason: 'No changes to save', editingViewLoading: false }
}
// Require the current (edited) query to have been run successfully before updating — a stale
// response from a previous run must not enable the button after further edits.
if (!isSourceQueryLastRun) {
- return ['Run the latest query before updating the view', IconDownload]
+ return {
+ editingViewDisabledReason: 'Run the latest query before updating the view',
+ editingViewLoading: false,
+ }
}
if (responseLoading) {
- return ['Running query...', Spinner]
+ return { editingViewDisabledReason: 'Running query...', editingViewLoading: true }
}
if (responseError || !response) {
- return ['Run the query successfully before updating the view', IconDownload]
+ return {
+ editingViewDisabledReason: 'Run the query successfully before updating the view',
+ editingViewLoading: false,
+ }
}
- return [undefined, IconDownload]
+ return { editingViewDisabledReason: undefined, editingViewLoading: false }
}, [
updatingDataWarehouseSavedQuery,
changesToSave,
@@ -684,6 +699,7 @@ function SQLEditorSceneTitle(): JSX.Element | null {
response,
isMultiQuery,
])
+ const EditingViewButtonIcon = editingViewLoading ? Spinner : IconDownload
const isMaterializedView = editingView?.is_materialized === true
const closeObjectTooltip = editingInsight
@@ -776,116 +792,76 @@ function SQLEditorSceneTitle(): JSX.Element | null {
},
}}
actions={
- <div className="flex flex-wrap items-center gap-2">
- {editingView ? (
- <>
- <LemonButton
- onClick={() => openHistoryModal()}
- icon={<IconBook />}
- type="secondary"
- size="small"
- >
- History
- </LemonButton>
- {discardChangesButton}
- <AccessControlAction
- resourceType={AccessControlResourceType.WarehouseObjects}
- minAccessLevel={AccessControlLevel.Editor}
- userAccessLevel={editingView.user_access_level}
- >
+ todayRailNav ? (
+ <QuillSQLEditorSceneActions
+ isMaterializedView={isMaterializedView}
+ closeObjectTooltip={closeObjectTooltip}
+ editingViewDisabledReason={editingViewDisabledReason}
+ editingViewLoading={editingViewLoading}
+ onUpdateView={() =>
+ editingView &&
+ reviewViewUpdate({
+ id: editingView.id,
+ query: {
+ ...sourceQuery.source,
+ query: queryInput ?? '',
+ },
+ types: response && 'types' in response ? (response?.types ?? []) : [],
+ shouldRematerialize: isMaterializedView,
+ edited_history_id: inProgressViewEdits[editingView.id],
+ })
+ }
+ saveAsInsightDisabledReason={saveAsInsightDisabledReason}
+ saveAsDisabledReason={saveAsDisabledReason}
+ saveAsViewAccessDisabledReason={saveAsViewAccessDisabledReason}
+ saveAsEndpointDisabledReason={saveAsEndpointDisabledReason}
+ continueInNotebookAccessDisabledReason={continueInNotebookAccessDisabledReason}
+ secondarySaveMenuItems={secondarySaveMenuItems}
+ onPrimarySaveClick={onPrimarySaveClick}
+ />
+ ) : (
+ <div className="flex flex-wrap items-center gap-2">
+ {editingView ? (
+ <>
<LemonButton
- onClick={() =>
- reviewViewUpdate({
- id: editingView.id,
- query: {
- ...sourceQuery.source,
- query: queryInput ?? '',
- },
- types: response && 'types' in response ? (response?.types ?? []) : [],
- shouldRematerialize: isMaterializedView,
- edited_history_id: inProgressViewEdits[editingView.id],
- })
- }
- disabledReason={editingViewDisabledReason}
- icon={<EditingViewButtonIcon />}
- type="primary"
+ onClick={() => openHistoryModal()}
+ icon={<IconBook />}
+ type="secondary"
size="small"
- sideAction={{
- icon: <IconChevronDown />,
- dropdown: {
- placement: 'bottom-end',
- overlay: (
- <LemonMenuOverlay
- items={[
- continueInNotebookMenuItem,
- {
- label: 'Save as new insight...',
- disabledReason: saveAsInsightDisabledReason,
- onClick: () => saveAsInsight(),
- },
- {
- label: 'Save as new view...',
- disabledReason:
- saveAsDisabledReason ??
- saveAsViewAccessDisabledReason,
- onClick: () => saveAsView(),
- },
- {
- label: 'Save as endpoint...',
- disabledReason:
- saveAsDisabledReason ??
- saveAsEndpointDisabledReason,
- onClick: () => saveAsEndpoint(),
- },
- ]}
- />
- ),
- },
- }}
>
- {isMaterializedView ? 'Update and re-materialize view' : 'Update view'}
+ History
</LemonButton>
- </AccessControlAction>
- <LemonButton
- onClick={() => closeEditingObject()}
- icon={<IconX />}
- type="tertiary"
- size="small"
- aria-label="close"
- tooltip={closeObjectTooltip}
- />
- </>
- ) : editingInsight ? (
- <>
- <LemonButton
- onClick={() => openHistoryModal()}
- icon={<IconBook />}
- type="secondary"
- size="small"
- data-attr="sql-editor-insight-history-button"
- >
- History
- </LemonButton>
- {discardChangesButton}
- <LemonButton
- disabledReason={
- saveAsInsightDisabledReason ??
- (!updateInsightButtonEnabled ? 'No updates to save' : undefined)
- }
- loading={insightLoading}
- type="primary"
- size="small"
- onClick={() => updateInsight()}
- sideAction={{
- icon: <IconChevronDown />,
- 'data-attr': 'sql-editor-save-options-button',
- dropdown: {
- placement: 'bottom-end',
- overlay: (
- <LemonMenuOverlay
- items={[
- {
- items: [
+ {discardChangesButton}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.WarehouseObjects}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={editingView.user_access_level}
+ >
+ <LemonButton
+ onClick={() =>
+ reviewViewUpdate({
+ id: editingView.id,
+ query: {
+ ...sourceQuery.source,
+ query: queryInput ?? '',
+ },
+ types:
+ response && 'types' in response ? (response?.types ?? []) : [],
+ shouldRematerialize: isMaterializedView,
+ edited_history_id: inProgressViewEdits[editingView.id],
+ })
+ }
+ disabledReason={editingViewDisabledReason}
+ icon={<EditingViewButtonIcon />}
+ type="primary"
+ size="small"
+ sideAction={{
+ icon: <IconChevronDown />,
+ dropdown: {
+ placement: 'bottom-end',
+ overlay: (
+ <LemonMenuOverlay
+ items={[
continueInNotebookMenuItem,
{
label: 'Save as new insight...',
@@ -906,106 +882,178 @@ function SQLEditorSceneTitle(): JSX.Element | null {
saveAsEndpointDisabledReason,
onClick: () => saveAsEndpoint(),
},
- ],
- },
- {
- items: [
- {
- label: 'Reset view',
- 'data-attr': 'sql-editor-reset-view',
- tooltip: closeObjectTooltip,
- onClick: () => closeEditingObject(),
- },
- ],
- },
- ]}
- />
- ),
- },
- }}
- >
- Update insight
- </LemonButton>
- </>
- ) : editingMetricName ? (
- <>
- <LemonButton
- type="primary"
- size="small"
- onClick={() => updateEditingMetric()}
- loading={metricUpdating}
- disabledReason={saveAsDisabledReason}
- data-attr="sql-editor-update-metric"
- sideAction={{
- icon: <IconChevronDown />,
- dropdown: {
- placement: 'bottom-end',
- overlay: (
- <LemonMenuOverlay
- items={secondarySaveMenuItems.map((item) => ({
- ...item,
- disabledReason:
- (item.action === 'insight'
- ? saveAsInsightDisabledReason
- : saveAsDisabledReason) ?? item.accessDisabledReason,
- }))}
- />
- ),
- },
- }}
- >
- Update metric
- </LemonButton>
- <LemonButton
- onClick={() => setEditingMetricName(null)}
- icon={<IconX />}
- type="tertiary"
- size="small"
- aria-label="Stop editing metric"
- tooltip="Stop editing this metric and start a new query"
- />
- </>
- ) : (
- <>
- {saveAsMenuItems.primary.action === 'insight' && continueInNotebookButton}
- <LemonButton
- type="primary"
- size="small"
- onClick={onPrimarySaveClick}
- disabledReason={
- (saveAsMenuItems.primary.action === 'insight'
- ? saveAsInsightDisabledReason
- : saveAsDisabledReason) ??
- (saveAsMenuItems.primary.action === 'endpoint'
- ? saveAsEndpointDisabledReason
- : saveAsMenuItems.primary.action === 'view'
- ? saveAsViewAccessDisabledReason
- : undefined)
- }
- sideAction={{
- icon: <IconChevronDown />,
- 'data-attr': 'sql-editor-save-options-button',
- dropdown: {
- placement: 'bottom-end',
- overlay: (
- <LemonMenuOverlay
- items={secondarySaveMenuItems.map((item) => ({
- ...item,
- disabledReason:
- (item.action === 'insight'
- ? saveAsInsightDisabledReason
- : saveAsDisabledReason) ?? item.accessDisabledReason,
- }))}
- />
- ),
- },
- }}
- >
- {saveAsMenuItems.primary.label}
- </LemonButton>
- </>
- )}
- </div>
+ ]}
+ />
+ ),
+ },
+ }}
+ >
+ {isMaterializedView ? 'Update and re-materialize view' : 'Update view'}
+ </LemonButton>
+ </AccessControlAction>
+ <LemonButton
+ onClick={() => closeEditingObject()}
+ icon={<IconX />}
+ type="tertiary"
+ size="small"
+ aria-label="close"
+ tooltip={closeObjectTooltip}
+ />
+ </>
+ ) : editingInsight ? (
+ <>
+ <LemonButton
+ onClick={() => openHistoryModal()}
+ icon={<IconBook />}
+ type="secondary"
+ size="small"
+ data-attr="sql-editor-insight-history-button"
+ >
+ History
+ </LemonButton>
+ {discardChangesButton}
+ <LemonButton
+ disabledReason={
+ saveAsInsightDisabledReason ??
+ (!updateInsightButtonEnabled ? 'No updates to save' : undefined)
+ }
+ loading={insightLoading}
+ type="primary"
+ size="small"
+ onClick={() => updateInsight()}
+ sideAction={{
+ icon: <IconChevronDown />,
+ 'data-attr': 'sql-editor-save-options-button',
+ dropdown: {
+ placement: 'bottom-end',
+ overlay: (
+ <LemonMenuOverlay
+ items={[
+ {
+ items: [
+ continueInNotebookMenuItem,
+ {
+ label: 'Save as new insight...',
+ disabledReason: saveAsInsightDisabledReason,
+ onClick: () => saveAsInsight(),
+ },
+ {
+ label: 'Save as new view...',
+ disabledReason:
+ saveAsDisabledReason ??
+ saveAsViewAccessDisabledReason,
+ onClick: () => saveAsView(),
+ },
+ {
+ label: 'Save as endpoint...',
+ disabledReason:
+ saveAsDisabledReason ??
+ saveAsEndpointDisabledReason,
+ onClick: () => saveAsEndpoint(),
+ },
+ ],
+ },
+ {
+ items: [
+ {
+ label: 'Reset view',
+ 'data-attr': 'sql-editor-reset-view',
+ tooltip: closeObjectTooltip,
+ onClick: () => closeEditingObject(),
+ },
+ ],
+ },
+ ]}
+ />
+ ),
+ },
+ }}
+ >
+ Update insight
+ </LemonButton>
+ </>
+ ) : editingMetricName ? (
+ <>
+ <LemonButton
+ type="primary"
+ size="small"
+ onClick={() => updateEditingMetric()}
+ loading={metricUpdating}
+ disabledReason={saveAsDisabledReason}
+ data-attr="sql-editor-update-metric"
+ sideAction={{
+ icon: <IconChevronDown />,
+ dropdown: {
+ placement: 'bottom-end',
+ overlay: (
+ <LemonMenuOverlay
+ items={secondarySaveMenuItems.map((item) => ({
+ ...item,
+ disabledReason:
+ (item.action === 'insight'
+ ? saveAsInsightDisabledReason
+ : saveAsDisabledReason) ??
+ item.accessDisabledReason,
+ }))}
+ />
+ ),
+ },
+ }}
+ >
+ Update metric
+ </LemonButton>
+ <LemonButton
+ onClick={() => setEditingMetricName(null)}
+ icon={<IconX />}
+ type="tertiary"
+ size="small"
+ aria-label="Stop editing metric"
+ tooltip="Stop editing this metric and start a new query"
+ />
+ </>
+ ) : (
+ <>
+ {saveAsMenuItems.primary.action === 'insight' && continueInNotebookButton}
+ <LemonButton
+ type="primary"
+ size="small"
+ onClick={onPrimarySaveClick}
+ disabledReason={
+ (saveAsMenuItems.primary.action === 'insight'
+ ? saveAsInsightDisabledReason
+ : saveAsDisabledReason) ??
+ (saveAsMenuItems.primary.action === 'endpoint'
+ ? saveAsEndpointDisabledReason
+ : saveAsMenuItems.primary.action === 'view'
+ ? saveAsViewAccessDisabledReason
+ : undefined)
+ }
+ sideAction={{
+ icon: <IconChevronDown />,
+ 'data-attr': 'sql-editor-save-options-button',
+ dropdown: {
+ placement: 'bottom-end',
+ overlay: (
+ <LemonMenuOverlay
+ items={secondarySaveMenuItems.map((item) => ({
+ ...item,
+ disabledReason:
+ (item.action === 'insight'
+ ? saveAsInsightDisabledReason
+ : saveAsDisabledReason) ??
+ item.accessDisabledReason,
+ }))}
+ />
+ ),
+ },
+ }}
+ >
+ {saveAsMenuItems.primary.label}
+ </LemonButton>
+ </>
+ )}
+ </div>
+ )
}
/>
<QueryHistoryModal />
diff --git a/frontend/src/scenes/debug/DebugScene.tsx b/frontend/src/scenes/debug/DebugScene.tsx
index 79291a668e27..e92849c7559d 100644
--- a/frontend/src/scenes/debug/DebugScene.tsx
+++ b/frontend/src/scenes/debug/DebugScene.tsx
@@ -3,6 +3,7 @@ import { useActions, useValues } from 'kea'
import { IconDatabaseBolt } from '@posthog/icons'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonLabel } from 'lib/lemon-ui/LemonLabel/LemonLabel'
import { LemonSelect } from 'lib/lemon-ui/LemonSelect'
@@ -15,11 +16,13 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { stringifiedExamples } from '~/queries/examples'
import { debugSceneLogic } from './debugSceneLogic'
+import { QuillDebugSceneActions } from './QuillDebugSceneActions'
export function DebugScene(): JSX.Element {
const { query1, query2 } = useValues(debugSceneLogic)
const { setQuery1, setQuery2 } = useActions(debugSceneLogic)
const { featureFlags } = useValues(featureFlagLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<SceneContent className="QueryScene">
@@ -27,61 +30,65 @@ export function DebugScene(): JSX.Element {
name="Debug"
resourceType={{ type: 'debug', forceIcon: <IconDatabaseBolt /> }}
actions={
- <>
- <LemonButton
- size="small"
- active={!!query2}
- onClick={() => (query2 ? setQuery2('') : setQuery2(query1))}
- >
- Split
- </LemonButton>
- <LemonButton
- size="small"
- active={query1 === stringifiedExamples.HogQLRaw}
- onClick={() => setQuery1(stringifiedExamples.HogQLRaw)}
- >
- SQL Debug
- </LemonButton>
- {featureFlags[FEATURE_FLAGS.HOG] ? (
+ todayRailNav ? (
+ <QuillDebugSceneActions />
+ ) : (
+ <>
<LemonButton
size="small"
- active={query1 === stringifiedExamples.Hoggonacci}
- onClick={() => setQuery1(stringifiedExamples.Hoggonacci)}
+ active={!!query2}
+ onClick={() => (query2 ? setQuery2('') : setQuery2(query1))}
>
- Hog
+ Split
</LemonButton>
- ) : null}
- <LemonButton
- size="small"
- active={query1 === stringifiedExamples.HogQLTable}
- onClick={() => setQuery1(stringifiedExamples.HogQLTable)}
- >
- SQL Table
- </LemonButton>
- <LemonButton
- size="small"
- active={query1 === stringifiedExamples.Events}
- onClick={() => setQuery1(stringifiedExamples.Events)}
- >
- Any Query
- </LemonButton>
- <LemonLabel>
- <LemonSelect
+ <LemonButton
+ size="small"
+ active={query1 === stringifiedExamples.HogQLRaw}
+ onClick={() => setQuery1(stringifiedExamples.HogQLRaw)}
+ >
+ SQL Debug
+ </LemonButton>
+ {featureFlags[FEATURE_FLAGS.HOG] ? (
+ <LemonButton
+ size="small"
+ active={query1 === stringifiedExamples.Hoggonacci}
+ onClick={() => setQuery1(stringifiedExamples.Hoggonacci)}
+ >
+ Hog
+ </LemonButton>
+ ) : null}
+ <LemonButton
size="small"
- placeholder="More sample queries"
- options={Object.entries(stringifiedExamples)
- .filter(([k]) => k !== 'HogQLTable' && k !== 'HogQLRaw')
- .map(([k, v]) => {
- return { label: k, value: v }
- })}
- onChange={(v) => {
- if (v) {
- setQuery1(v)
- }
- }}
- />
- </LemonLabel>
- </>
+ active={query1 === stringifiedExamples.HogQLTable}
+ onClick={() => setQuery1(stringifiedExamples.HogQLTable)}
+ >
+ SQL Table
+ </LemonButton>
+ <LemonButton
+ size="small"
+ active={query1 === stringifiedExamples.Events}
+ onClick={() => setQuery1(stringifiedExamples.Events)}
+ >
+ Any Query
+ </LemonButton>
+ <LemonLabel>
+ <LemonSelect
+ size="small"
+ placeholder="More sample queries"
+ options={Object.entries(stringifiedExamples)
+ .filter(([k]) => k !== 'HogQLTable' && k !== 'HogQLRaw')
+ .map(([k, v]) => {
+ return { label: k, value: v }
+ })}
+ onChange={(v) => {
+ if (v) {
+ setQuery1(v)
+ }
+ }}
+ />
+ </LemonLabel>
+ </>
+ )
}
/>
diff --git a/frontend/src/scenes/debug/QuillDebugSceneActions.tsx b/frontend/src/scenes/debug/QuillDebugSceneActions.tsx
new file mode 100644
index 000000000000..f8ed87f872b4
--- /dev/null
+++ b/frontend/src/scenes/debug/QuillDebugSceneActions.tsx
@@ -0,0 +1,55 @@
+import { useActions, useValues } from 'kea'
+
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Toggle } from '@posthog/quill'
+
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+
+import { stringifiedExamples } from '~/queries/examples'
+
+import { debugSceneLogic } from './debugSceneLogic'
+
+export function QuillDebugSceneActions(): JSX.Element {
+ const { query1, query2 } = useValues(debugSceneLogic)
+ const { setQuery1, setQuery2 } = useActions(debugSceneLogic)
+ const hogEnabled = useFeatureFlag('HOG')
+
+ const presets: { label: string; query: string }[] = [
+ { label: 'SQL Debug', query: stringifiedExamples.HogQLRaw },
+ ...(hogEnabled ? [{ label: 'Hog', query: stringifiedExamples.Hoggonacci }] : []),
+ { label: 'SQL Table', query: stringifiedExamples.HogQLTable },
+ { label: 'Any Query', query: stringifiedExamples.Events },
+ ]
+ const moreSamples = Object.entries(stringifiedExamples).filter(([k]) => k !== 'HogQLTable' && k !== 'HogQLRaw')
+
+ return (
+ <div className="flex flex-wrap items-center gap-1">
+ <Toggle pressed={!!query2} onPressedChange={() => (query2 ? setQuery2('') : setQuery2(query1))}>
+ Split
+ </Toggle>
+ {presets.map(({ label, query }) => (
+ <Toggle key={label} pressed={query1 === query} onPressedChange={() => setQuery1(query)}>
+ {label}
+ </Toggle>
+ ))}
+ <Select<string>
+ value={null}
+ onValueChange={(v) => {
+ if (v) {
+ setQuery1(v)
+ }
+ }}
+ >
+ <SelectTrigger>
+ <SelectValue placeholder="More sample queries" />
+ </SelectTrigger>
+ <SelectContent>
+ {moreSamples.map(([k, v]) => (
+ <SelectItem key={k} value={v}>
+ {k}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/experiments/ExperimentView/ExperimentActionsMenu.tsx b/frontend/src/scenes/experiments/ExperimentView/ExperimentActionsMenu.tsx
index 6fe3e49b144e..1dbf0b8661cf 100644
--- a/frontend/src/scenes/experiments/ExperimentView/ExperimentActionsMenu.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/ExperimentActionsMenu.tsx
@@ -4,17 +4,20 @@ import { LemonButton } from '@posthog/lemon-ui'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonMenu } from 'lib/lemon-ui/LemonMenu'
+import { QuillExperimentActionsMenu } from 'products/experiments/frontend/components/QuillExperimentActionsMenu'
+
import { useExperimentActions } from './useExperimentActions'
export function ExperimentActionsMenu(): JSX.Element | null {
const sceneMenuBarEnabled = useFeatureFlag('SCENE_MENU_BAR')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
// The scene menu bar already surfaces every action in its File/Edit menus.
if (sceneMenuBarEnabled) {
return null
}
- return <ExperimentActionsMenuInner />
+ return todayRailNav ? <QuillExperimentActionsMenu /> : <ExperimentActionsMenuInner />
}
function ExperimentActionsMenuInner(): JSX.Element | null {
diff --git a/frontend/src/scenes/experiments/ExperimentView/PageHeader.tsx b/frontend/src/scenes/experiments/ExperimentView/PageHeader.tsx
index 7a5b9ef35bee..de9a7d666573 100644
--- a/frontend/src/scenes/experiments/ExperimentView/PageHeader.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/PageHeader.tsx
@@ -3,9 +3,11 @@ import { Fragment } from 'react'
import { IconFlask } from '@posthog/icons'
import { LemonButton, LemonDivider, LemonSwitch, Tooltip } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { useHogfetti } from 'lib/components/Hogfetti/Hogfetti'
import { superpowersLogic } from 'lib/components/Superpowers/superpowersLogic'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { userHasAccess } from 'lib/utils/accessControlUtils'
@@ -41,6 +43,7 @@ export function PageHeaderCustom(): JSX.Element {
useActions(modalsLogic)
const actionSections = useExperimentActions()
const { trigger, HogfettiComponent } = useHogfetti()
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
useOnMountEffect(() => {
setHogfettiTrigger(trigger)
@@ -68,37 +71,66 @@ export function PageHeaderCustom(): JSX.Element {
renameDebounceMs={0}
saveOnBlur
actions={
- <>
- {experiment && isExperimentDraft && (
- <div className="flex items-center">
- <LemonButton
- type="primary"
+ todayRailNav ? (
+ <>
+ {experiment && isExperimentDraft && (
+ <Button
+ variant="primary"
data-attr="launch-experiment"
onClick={() => launchExperiment()}
loading={launchExperimentLoading}
- size="small"
>
Launch
- </LemonButton>
- </div>
- )}
- {experiment && isExperimentRunning && !isExperimentStopped && (
- <>
- <Tooltip title="Conclude this experiment and decide which variant to keep">
+ </Button>
+ )}
+ {experiment && isExperimentRunning && !isExperimentStopped && (
+ <>
+ <Button
+ variant="primary"
+ tooltip="Conclude this experiment and decide which variant to keep"
+ onClick={() => openFinishExperimentModal()}
+ >
+ <IconFlask />
+ <b>End experiment</b>
+ </Button>
+ <FinishExperimentModal />
+ </>
+ )}
+ <ExperimentActionsMenu />
+ </>
+ ) : (
+ <>
+ {experiment && isExperimentDraft && (
+ <div className="flex items-center">
<LemonButton
type="primary"
- icon={<IconFlask />}
- onClick={() => openFinishExperimentModal()}
+ data-attr="launch-experiment"
+ onClick={() => launchExperiment()}
+ loading={launchExperimentLoading}
size="small"
>
- <b>End experiment</b>
+ Launch
</LemonButton>
- </Tooltip>
- <FinishExperimentModal />
- </>
- )}
- <ExperimentActionsMenu />
- </>
+ </div>
+ )}
+ {experiment && isExperimentRunning && !isExperimentStopped && (
+ <>
+ <Tooltip title="Conclude this experiment and decide which variant to keep">
+ <LemonButton
+ type="primary"
+ icon={<IconFlask />}
+ onClick={() => openFinishExperimentModal()}
+ size="small"
+ >
+ <b>End experiment</b>
+ </LemonButton>
+ </Tooltip>
+ <FinishExperimentModal />
+ </>
+ )}
+ <ExperimentActionsMenu />
+ </>
+ )
}
/>
<HogfettiComponent />
diff --git a/frontend/src/scenes/experiments/SharedMetrics/SharedMetric.tsx b/frontend/src/scenes/experiments/SharedMetrics/SharedMetric.tsx
index 07870e2f6aba..3477d6f88cf0 100644
--- a/frontend/src/scenes/experiments/SharedMetrics/SharedMetric.tsx
+++ b/frontend/src/scenes/experiments/SharedMetrics/SharedMetric.tsx
@@ -32,6 +32,7 @@ import { tagsModel } from '~/models/tagsModel'
import { ExperimentMetric } from '~/queries/schema/schema-general'
import { AccessControlLevel, AccessControlResourceType, ExperimentsTabs } from '~/types'
+import { QuillSharedMetricActions } from 'products/experiments/frontend/components/QuillSharedMetricActions'
import type { ExperimentSavedMetricLinkedExperimentApi } from 'products/experiments/frontend/generated/api.schemas'
import { ExperimentMetricForm } from '../ExperimentMetricForm'
@@ -91,6 +92,7 @@ function openSaveWithRunningExperimentsDialog(
export function SharedMetric(): JSX.Element {
const { sharedMetric, action, metricSaving } = useValues(sharedMetricLogic)
const sceneMenuBarEnabled = useFeatureFlag('SCENE_MENU_BAR')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const { setSharedMetric, createSharedMetric, updateSharedMetric, deleteSharedMetric } =
useActions(sharedMetricLogic)
@@ -233,46 +235,58 @@ export function SharedMetric(): JSX.Element {
key: ExperimentsTabs.SharedMetrics,
}}
actions={
- <>
- {action === 'update' && (
- <More
- overlay={
- <AccessControlAction
- resourceType={AccessControlResourceType.ExperimentSavedMetric}
- minAccessLevel={AccessControlLevel.Editor}
- userAccessLevel={sharedMetric.user_access_level}
- >
- <LemonButton
- fullWidth
- size="small"
- icon={<IconTrash />}
- status="danger"
- data-attr="shared-metric-delete"
- loading={deleteCheckLoading}
- onClick={() => void handleDelete()}
- >
- Delete
- </LemonButton>
- </AccessControlAction>
- }
- />
- )}
- <AccessControlAction
- resourceType={AccessControlResourceType.ExperimentSavedMetric}
- minAccessLevel={AccessControlLevel.Editor}
+ todayRailNav ? (
+ <QuillSharedMetricActions
+ showDelete={action === 'update'}
userAccessLevel={sharedMetric.user_access_level}
- >
- <LemonButton
- disabledReason={saveDisabledReason}
- loading={metricSaving}
- size="small"
- type="primary"
- onClick={handleSave}
+ deleteLoading={deleteCheckLoading}
+ onDelete={() => void handleDelete()}
+ saveDisabledReason={saveDisabledReason}
+ saving={metricSaving}
+ onSave={handleSave}
+ />
+ ) : (
+ <>
+ {action === 'update' && (
+ <More
+ overlay={
+ <AccessControlAction
+ resourceType={AccessControlResourceType.ExperimentSavedMetric}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={sharedMetric.user_access_level}
+ >
+ <LemonButton
+ fullWidth
+ size="small"
+ icon={<IconTrash />}
+ status="danger"
+ data-attr="shared-metric-delete"
+ loading={deleteCheckLoading}
+ onClick={() => void handleDelete()}
+ >
+ Delete
+ </LemonButton>
+ </AccessControlAction>
+ }
+ />
+ )}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.ExperimentSavedMetric}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={sharedMetric.user_access_level}
>
- Save
- </LemonButton>
- </AccessControlAction>
- </>
+ <LemonButton
+ disabledReason={saveDisabledReason}
+ loading={metricSaving}
+ size="small"
+ type="primary"
+ onClick={handleSave}
+ >
+ Save
+ </LemonButton>
+ </AccessControlAction>
+ </>
+ )
}
/>
diff --git a/frontend/src/scenes/exports/ExportsScene.tsx b/frontend/src/scenes/exports/ExportsScene.tsx
index 906296e536dc..fa9009b68588 100644
--- a/frontend/src/scenes/exports/ExportsScene.tsx
+++ b/frontend/src/scenes/exports/ExportsScene.tsx
@@ -3,6 +3,7 @@ import { useActions, useValues } from 'kea'
import { IconDownload, IconPencil, IconRefresh, IconWarning } from '@posthog/icons'
import { LemonButton, LemonSelect, LemonTable, LemonTag, Spinner, lemonToast } from '@posthog/lemon-ui'
import { LemonTableColumns } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { exportedAssetBlob } from 'lib/components/ExportButton/exporter'
@@ -10,6 +11,7 @@ import { exportsLogic } from 'lib/components/ExportButton/exportsLogic'
import { getExportDisabledReason, getExportPendingLabel } from 'lib/components/ExportButton/exportStatus'
import { takeScreenshotLogic } from 'lib/components/TakeScreenshot/takeScreenshotLogic'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { humanFriendlyNumber } from 'lib/utils/numbers'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
@@ -103,6 +105,7 @@ function ExportActions({ asset }: { asset: ExportedAssetType }): JSX.Element {
export function ExportsScene(): JSX.Element {
const { exports, exportsLoading, assetFormat } = useValues(exportsLogic)
const { loadExports, setAssetFormat } = useActions(exportsLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const columns: LemonTableColumns<ExportedAssetType> = [
{
@@ -153,16 +156,28 @@ export function ExportsScene(): JSX.Element {
resourceType={{ type: 'exports' }}
scope={settingsSectionSceneScope('environment-exports')}
actions={
- <LemonButton
- onClick={loadExports}
- type="primary"
- size="small"
- icon={<IconRefresh />}
- loading={exportsLoading}
- data-attr="export-refresh"
- >
- Refresh
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ onClick={loadExports}
+ variant="primary"
+ loading={exportsLoading}
+ data-attr="export-refresh"
+ >
+ <IconRefresh />
+ Refresh
+ </Button>
+ ) : (
+ <LemonButton
+ onClick={loadExports}
+ type="primary"
+ size="small"
+ icon={<IconRefresh />}
+ loading={exportsLoading}
+ data-attr="export-refresh"
+ >
+ Refresh
+ </LemonButton>
+ )
}
/>
diff --git a/frontend/src/scenes/feature-flags/FeatureFlag.tsx b/frontend/src/scenes/feature-flags/FeatureFlag.tsx
index 30de9387097e..f82686996aef 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlag.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlag.tsx
@@ -6,6 +6,7 @@ import { Suspense, lazy, useEffect, useMemo, useState } from 'react'
import { IconArchive, IconCopy, IconPlusSmall, IconRewind, IconTrash } from '@posthog/icons'
import { LemonSkeleton } from '@posthog/lemon-ui'
+import { Badge, Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { AccessDenied } from 'lib/components/AccessDenied'
@@ -18,6 +19,7 @@ import { SceneMenuBarFileItems } from 'lib/components/Scenes/SceneMenuBarFileIte
import { SceneTags } from 'lib/components/Scenes/SceneTags'
import { SceneTagsCombobox } from 'lib/components/Scenes/SceneTagsCombobox'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useFileSystemLogView } from 'lib/hooks/useFileSystemLogView'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
@@ -250,23 +252,36 @@ export function FeatureFlag({ id }: FeatureFlagLogicProps): JSX.Element {
),
})
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
const editButton = (
<AccessControlAction
resourceType={AccessControlResourceType.FeatureFlag}
minAccessLevel={AccessControlLevel.Editor}
userAccessLevel={featureFlag.user_access_level}
>
- {({ disabledReason }) => (
- <LemonButton
- type="secondary"
- size="small"
- disabledReason={disabledReason}
- onClick={() => editFeatureFlag(true)}
- data-attr={isV1Config ? undefined : 'edit-rules-v2-flag'}
- >
- Edit
- </LemonButton>
- )}
+ {({ disabledReason }) =>
+ todayRailNav ? (
+ <Button
+ variant="outline"
+ disabledReason={disabledReason}
+ onClick={() => editFeatureFlag(true)}
+ data-attr={isV1Config ? undefined : 'edit-rules-v2-flag'}
+ >
+ Edit
+ </Button>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ disabledReason={disabledReason}
+ onClick={() => editFeatureFlag(true)}
+ data-attr={isV1Config ? undefined : 'edit-rules-v2-flag'}
+ >
+ Edit
+ </LemonButton>
+ )
+ }
</AccessControlAction>
)
@@ -572,7 +587,8 @@ export function FeatureFlag({ id }: FeatureFlagLogicProps): JSX.Element {
<SceneMenuBar>
<SceneMenuBarMenu label="File" dataAttr={`${RESOURCE_TYPE}-menubar-file`}>
<SceneMenuBarSubMenu label="Create">
- {featureFlag.id && (
+ {/* Adding to notebooks is deprecated under the rail redesign; gated here so an emptied menu can disable itself. */}
+ {featureFlag.id && !todayRailNav && (
<SceneMenuBarAddToNotebook
dataAttrKey={RESOURCE_TYPE}
notebookSelectButtonProps={{
@@ -695,9 +711,15 @@ export function FeatureFlag({ id }: FeatureFlagLogicProps): JSX.Element {
editButton
) : (
<div className="flex items-center gap-2">
- <LemonTag type="highlight" data-attr="feature-flag-config-format">
- {featureFlagConfigFormatLabel(featureFlag.filters)}
- </LemonTag>
+ {todayRailNav ? (
+ <Badge variant="info" data-attr="feature-flag-config-format">
+ {featureFlagConfigFormatLabel(featureFlag.filters)}
+ </Badge>
+ ) : (
+ <LemonTag type="highlight" data-attr="feature-flag-config-format">
+ {featureFlagConfigFormatLabel(featureFlag.filters)}
+ </LemonTag>
+ )}
{isRulesV2EditableConfig(featureFlag.filters, featureFlags) && editButton}
</div>
)
diff --git a/frontend/src/scenes/feature-flags/FeatureFlagForm.tsx b/frontend/src/scenes/feature-flags/FeatureFlagForm.tsx
index 8cd13dd7f059..68c6fed30837 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlagForm.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlagForm.tsx
@@ -49,6 +49,7 @@ import {
Spinner,
Tooltip,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { approvalsGateLogic } from 'lib/approvals/approvalsGateLogic'
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
@@ -208,6 +209,7 @@ export function FeatureFlagForm({ id }: FeatureFlagLogicProps): JSX.Element {
const { tags: availableTags } = useValues(tagsModel)
const { isApprovalRequired } = useValues(approvalsGateLogic)
const { allCohorts } = useValues(cohortsModel)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const hasEvaluationContexts = useFeatureFlag('FLAG_EVALUATION_TAGS') // NB: the tag was named "flag-evaluation-tags" before we renamed the concept – i.e. this powers evaluation contexts even though the name implies tags
const isNewFeatureFlag = id === 'new' || id === undefined
const requiresApprovalToEnable = isNewFeatureFlag && isApprovalRequired(ApprovalActionKey.FEATURE_FLAG_ENABLE)
@@ -223,6 +225,15 @@ export function FeatureFlagForm({ id }: FeatureFlagLogicProps): JSX.Element {
}
}, [requiresApprovalToEnable, featureFlag.active, startNewFlagDisabled])
+ const cancelEditing = (): void => {
+ if (isEditingFlag) {
+ editFeatureFlag(false)
+ loadFeatureFlag()
+ } else {
+ router.actions.push(urls.featureFlags())
+ }
+ }
+
const handleShowImplementation = (): void => {
setShowImplementation(true)
setTimeout(() => {
@@ -435,32 +446,41 @@ export function FeatureFlagForm({ id }: FeatureFlagLogicProps): JSX.Element {
: undefined
}
actions={
- <>
- <LemonButton
- data-attr="cancel-feature-flag"
- type="secondary"
- size="small"
- onClick={() => {
- if (isEditingFlag) {
- editFeatureFlag(false)
- loadFeatureFlag()
- } else {
- router.actions.push(urls.featureFlags())
- }
- }}
- >
- Cancel
- </LemonButton>
- <LemonButton
- type="primary"
- data-attr="save-feature-flag"
- htmlType="submit"
- form="feature-flag"
- size="small"
- >
- Save
- </LemonButton>
- </>
+ todayRailNav ? (
+ <>
+ <Button data-attr="cancel-feature-flag" variant="outline" onClick={cancelEditing}>
+ Cancel
+ </Button>
+ <Button
+ variant="primary"
+ data-attr="save-feature-flag"
+ type="submit"
+ form="feature-flag"
+ >
+ Save
+ </Button>
+ </>
+ ) : (
+ <>
+ <LemonButton
+ data-attr="cancel-feature-flag"
+ type="secondary"
+ size="small"
+ onClick={cancelEditing}
+ >
+ Cancel
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ data-attr="save-feature-flag"
+ htmlType="submit"
+ form="feature-flag"
+ size="small"
+ >
+ Save
+ </LemonButton>
+ </>
+ )
}
/>
diff --git a/frontend/src/scenes/feature-flags/FeatureFlagRulesV2Editor.tsx b/frontend/src/scenes/feature-flags/FeatureFlagRulesV2Editor.tsx
index 6b307c2f82e4..937fdda2bf6d 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlagRulesV2Editor.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlagRulesV2Editor.tsx
@@ -11,8 +11,10 @@ import {
LemonSelect,
LemonTextArea,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { urls } from 'scenes/urls'
@@ -33,6 +35,7 @@ export function FeatureFlagRulesV2Editor({ id }: FeatureFlagLogicProps): JSX.Ele
const isNew = id === 'new'
const keyInputId = useId()
const descriptionInputId = useId()
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<div className="flex flex-col gap-4" data-attr="feature-flag-rules-v2-editor">
@@ -40,26 +43,51 @@ export function FeatureFlagRulesV2Editor({ id }: FeatureFlagLogicProps): JSX.Ele
name={draft.key || 'New rules v2 flag'}
resourceType={{ type: !isNew && featureFlag.active ? 'feature_flag' : 'feature_flag_off' }}
actions={
- <>
- <LemonButton
- type="secondary"
- size="small"
- data-attr="cancel-rules-v2-flag"
- onClick={() => (isNew ? router.actions.push(urls.featureFlags()) : editFeatureFlag(false))}
- >
- Cancel
- </LemonButton>
- <LemonButton
- type="primary"
- size="small"
- data-attr="save-rules-v2-flag"
- loading={saving}
- disabledReason={saveDisabledReason}
- onClick={saveRulesV2Flag}
- >
- Save
- </LemonButton>
- </>
+ todayRailNav ? (
+ <>
+ <Button
+ variant="outline"
+ data-attr="cancel-rules-v2-flag"
+ onClick={() =>
+ isNew ? router.actions.push(urls.featureFlags()) : editFeatureFlag(false)
+ }
+ >
+ Cancel
+ </Button>
+ <Button
+ variant="primary"
+ data-attr="save-rules-v2-flag"
+ loading={saving}
+ disabledReason={saveDisabledReason}
+ onClick={saveRulesV2Flag}
+ >
+ Save
+ </Button>
+ </>
+ ) : (
+ <>
+ <LemonButton
+ type="secondary"
+ size="small"
+ data-attr="cancel-rules-v2-flag"
+ onClick={() =>
+ isNew ? router.actions.push(urls.featureFlags()) : editFeatureFlag(false)
+ }
+ >
+ Cancel
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ size="small"
+ data-attr="save-rules-v2-flag"
+ loading={saving}
+ disabledReason={saveDisabledReason}
+ onClick={saveRulesV2Flag}
+ >
+ Save
+ </LemonButton>
+ </>
+ )
}
/>
<SceneContent>
diff --git a/frontend/src/scenes/feature-flags/FeatureFlags.tsx b/frontend/src/scenes/feature-flags/FeatureFlags.tsx
index 2f2ef065bd22..450a32787788 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlags.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlags.tsx
@@ -15,6 +15,7 @@ import PropertyFiltersDisplay from 'lib/components/PropertyFilters/components/Pr
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
import { LemonTable, LemonTableColumn, LemonTableColumns } from 'lib/lemon-ui/LemonTable'
@@ -80,6 +81,7 @@ import { FLAGS_PER_PAGE, FeatureFlagsTab, featureFlagsLogic, flagMatchesType } f
import { BULK_ARCHIVE_MAX_FLAGS, flagSelectionLogic } from './flagSelectionLogic'
import { OverlayForNewFeatureFlagMenu } from './NewFeatureFlagMenu'
import ProjectsGrid from './projects-grid/ProjectsGrid'
+import { QuillFeatureFlagsActions } from './QuillFeatureFlagsActions'
// "Feature Flags open feedback" in project 2: https://us.posthog.com/project/2/surveys/01a08364-0b1f-0000-5d00-170b29838bc5
// Button-only: its URL condition never matches, so this button is the survey's sole entry point.
@@ -815,6 +817,7 @@ export function FeatureFlags(): JSX.Element {
const showRequestUsageTab = !!enabledFeatureFlags[FEATURE_FLAGS.FEATURE_FLAG_REQUEST_USAGE]
const showRulesV2Editor = !!enabledFeatureFlags[FEATURE_FLAGS.FEATURE_FLAG_RULES_V2_EDITOR]
const { currentTeam } = useValues(teamLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<SceneContent className="feature_flags">
@@ -825,61 +828,70 @@ export function FeatureFlags(): JSX.Element {
type: 'feature_flag',
}}
actions={
- <>
- <FeedbackSurveyButton
- surveyId={FEATURE_FLAGS_FEEDBACK_SURVEY_ID}
- data-attr="feature-flags-feedback-button"
+ todayRailNav ? (
+ <QuillFeatureFlagsActions
+ feedbackSurveyId={FEATURE_FLAGS_FEEDBACK_SURVEY_ID}
+ showRulesV2Editor={showRulesV2Editor}
+ rulesV2DisabledReason={rulesV2CreateDisabledReason(currentTeam, enabledFeatureFlags)}
+ newFeatureFlagUrl={newFeatureFlagUrl}
/>
- {showRulesV2Editor && (
+ ) : (
+ <>
+ <FeedbackSurveyButton
+ surveyId={FEATURE_FLAGS_FEEDBACK_SURVEY_ID}
+ data-attr="feature-flags-feedback-button"
+ />
+ {showRulesV2Editor && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.FeatureFlag}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={urls.featureFlagNew({ format: 'rules_v2' })}
+ disabledReason={rulesV2CreateDisabledReason(currentTeam, enabledFeatureFlags)}
+ data-attr="new-rules-v2-feature-flag"
+ >
+ New rules v2 flag
+ </LemonButton>
+ </AccessControlAction>
+ )}
<AccessControlAction
resourceType={AccessControlResourceType.FeatureFlag}
minAccessLevel={AccessControlLevel.Editor}
>
- <LemonButton
- type="secondary"
- size="small"
- to={urls.featureFlagNew({ format: 'rules_v2' })}
- disabledReason={rulesV2CreateDisabledReason(currentTeam, enabledFeatureFlags)}
- data-attr="new-rules-v2-feature-flag"
+ <Shortcut
+ name="NewFeatureFlag"
+ keybind={[keyBinds.new]}
+ intent="New feature flag"
+ interaction="click"
+ scope={Scene.FeatureFlags}
>
- New rules v2 flag
- </LemonButton>
+ <LemonButton
+ type="primary"
+ to={newFeatureFlagUrl}
+ data-attr="new-feature-flag"
+ size="small"
+ icon={<IconPlusSmall />}
+ sideAction={{
+ dropdown: {
+ placement: 'bottom-end',
+ className: 'new-feature-flag-overlay',
+ actionable: true,
+ closeOnClickInside: false,
+ overlay: <OverlayForNewFeatureFlagMenu />,
+ },
+ 'data-attr': 'new-feature-flag-dropdown',
+ }}
+ tooltip="New feature flag"
+ >
+ New
+ </LemonButton>
+ </Shortcut>
</AccessControlAction>
- )}
- <AccessControlAction
- resourceType={AccessControlResourceType.FeatureFlag}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <Shortcut
- name="NewFeatureFlag"
- keybind={[keyBinds.new]}
- intent="New feature flag"
- interaction="click"
- scope={Scene.FeatureFlags}
- >
- <LemonButton
- type="primary"
- to={newFeatureFlagUrl}
- data-attr="new-feature-flag"
- size="small"
- icon={<IconPlusSmall />}
- sideAction={{
- dropdown: {
- placement: 'bottom-end',
- className: 'new-feature-flag-overlay',
- actionable: true,
- closeOnClickInside: false,
- overlay: <OverlayForNewFeatureFlagMenu />,
- },
- 'data-attr': 'new-feature-flag-dropdown',
- }}
- tooltip="New feature flag"
- >
- New
- </LemonButton>
- </Shortcut>
- </AccessControlAction>
- </>
+ </>
+ )
}
/>
<LemonTabs
diff --git a/frontend/src/scenes/feature-flags/NewFeatureFlagMenu.tsx b/frontend/src/scenes/feature-flags/NewFeatureFlagMenu.tsx
index ef5c9948a1ce..cc41773369dd 100644
--- a/frontend/src/scenes/feature-flags/NewFeatureFlagMenu.tsx
+++ b/frontend/src/scenes/feature-flags/NewFeatureFlagMenu.tsx
@@ -35,9 +35,9 @@ interface DropdownTemplateMetadata {
}
// Remote config has its own dedicated menu item below, so the preset dropdown excludes it.
-type PresetTemplateKey = Exclude<TemplateKey, 'remote-config'>
+export type PresetTemplateKey = Exclude<TemplateKey, 'remote-config'>
-const TEMPLATE_METADATA: Record<PresetTemplateKey, DropdownTemplateMetadata> = {
+export const TEMPLATE_METADATA: Record<PresetTemplateKey, DropdownTemplateMetadata> = {
simple: {
name: 'Simple flag',
description: 'On/off for all users',
@@ -60,10 +60,10 @@ const TEMPLATE_METADATA: Record<PresetTemplateKey, DropdownTemplateMetadata> = {
},
}
-const TEMPLATES: PresetTemplateKey[] = ['simple', 'targeted', 'multivariate', 'targeted-multivariate']
+export const TEMPLATES: PresetTemplateKey[] = ['simple', 'targeted', 'multivariate', 'targeted-multivariate']
-const AI_TOOL_DEFINITION = getToolDefinition('create_feature_flag')!
-const AI_SUGGESTIONS = [
+export const AI_TOOL_DEFINITION = getToolDefinition('create_feature_flag')!
+export const AI_SUGGESTIONS = [
'Create a flag to gradually roll out…',
'Create a flag that starts at 10% rollout for…',
'Create a multivariate flag for…',
diff --git a/frontend/src/scenes/feature-flags/QuillFeatureFlagsActions.tsx b/frontend/src/scenes/feature-flags/QuillFeatureFlagsActions.tsx
new file mode 100644
index 000000000000..646cb986e217
--- /dev/null
+++ b/frontend/src/scenes/feature-flags/QuillFeatureFlagsActions.tsx
@@ -0,0 +1,77 @@
+import { IconPlus } from '@posthog/icons'
+import { Button, ButtonGroup } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { FeedbackSurveyButton } from 'lib/components/FeedbackSurveyButton/FeedbackSurveyButton'
+import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { Scene } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { QuillNewFeatureFlagMenu } from './QuillNewFeatureFlagMenu'
+
+export interface QuillFeatureFlagsActionsProps {
+ feedbackSurveyId: string
+ showRulesV2Editor: boolean
+ rulesV2DisabledReason: string | null | undefined
+ newFeatureFlagUrl: string
+}
+
+export function QuillFeatureFlagsActions({
+ feedbackSurveyId,
+ showRulesV2Editor,
+ rulesV2DisabledReason,
+ newFeatureFlagUrl,
+}: QuillFeatureFlagsActionsProps): JSX.Element {
+ const createDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.FeatureFlag,
+ AccessControlLevel.Editor
+ )
+
+ return (
+ <>
+ <FeedbackSurveyButton surveyId={feedbackSurveyId} data-attr="feature-flags-feedback-button" />
+ {showRulesV2Editor && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.FeatureFlag}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={urls.featureFlagNew({ format: 'rules_v2' })} />}
+ disabledReason={rulesV2DisabledReason}
+ data-attr="new-rules-v2-feature-flag"
+ >
+ New rules v2 flag
+ </Button>
+ </AccessControlAction>
+ )}
+ <ButtonGroup>
+ <Shortcut
+ name="NewFeatureFlag"
+ keybind={[keyBinds.new]}
+ intent="New feature flag"
+ interaction="click"
+ scope={Scene.FeatureFlags}
+ disabledReason={createDisabledReason}
+ >
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={newFeatureFlagUrl} />}
+ disabledReason={createDisabledReason}
+ tooltip="New feature flag"
+ data-attr="new-feature-flag"
+ >
+ <IconPlus />
+ New
+ </Button>
+ </Shortcut>
+ <QuillNewFeatureFlagMenu disabledReason={createDisabledReason} />
+ </ButtonGroup>
+ </>
+ )
+}
diff --git a/frontend/src/scenes/feature-flags/QuillNewFeatureFlagMenu.tsx b/frontend/src/scenes/feature-flags/QuillNewFeatureFlagMenu.tsx
new file mode 100644
index 000000000000..fc8680544b19
--- /dev/null
+++ b/frontend/src/scenes/feature-flags/QuillNewFeatureFlagMenu.tsx
@@ -0,0 +1,190 @@
+import { useActions, useValues } from 'kea'
+import React from 'react'
+
+import { IconChevronDown, IconCode, IconFlask, IconSparkles, IconWrench } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuSub,
+ DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic'
+import { addProductIntentForCrossSell } from 'lib/utils/product-intents'
+import { SIDE_PANEL_PANEL_ID, maxLogic } from 'scenes/max/maxLogic'
+import { createSuggestionGroup } from 'scenes/max/utils'
+import { urls } from 'scenes/urls'
+
+import { sidePanelLogic } from '~/layout/navigation-3000/sidepanel/sidePanelLogic'
+import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
+import { SidePanelTab } from '~/types'
+
+import { INTENT_KEYS, INTENT_METADATA } from 'products/feature_flags/frontend/featureFlagTemplateConstants'
+
+import { AI_SUGGESTIONS, AI_TOOL_DEFINITION, TEMPLATES, TEMPLATE_METADATA } from './NewFeatureFlagMenu'
+
+export function QuillNewFeatureFlagMenu({ disabledReason }: { disabledReason?: string | null }): JSX.Element {
+ const { featureFlags } = useValues(enabledFeaturesLogic)
+ const { setActiveGroup } = useActions(maxLogic({ panelId: SIDE_PANEL_PANEL_ID }))
+ const { openSidePanel } = useActions(sidePanelLogic)
+
+ const intentsEnabled = !!featureFlags[FEATURE_FLAGS.FEATURE_FLAG_CREATION_INTENTS]
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="primary"
+ size="icon"
+ aria-label="New feature flag options"
+ tooltip="New feature flag options"
+ disabledReason={disabledReason}
+ data-attr="new-feature-flag-dropdown"
+ />
+ }
+ >
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-64">
+ {TEMPLATES.map((template) => {
+ const metadata = TEMPLATE_METADATA[template]
+ if (intentsEnabled) {
+ return (
+ <DropdownMenuSub key={template}>
+ <DropdownMenuSubTrigger
+ data-attr="new-feature-flag-menu-item"
+ data-attr-template={template}
+ description={metadata.description}
+ >
+ <metadata.icon />
+ {metadata.name}
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent className="min-w-64">
+ {INTENT_KEYS.map((intentKey) => {
+ const intentMeta = INTENT_METADATA[intentKey]
+ return (
+ <DropdownMenuItem
+ key={intentKey}
+ render={
+ <Button
+ size="row"
+ left
+ render={
+ <LinkPrimitive
+ to={urls.featureFlagNew({
+ template,
+ intent: intentKey,
+ })}
+ />
+ }
+ />
+ }
+ data-attr="new-feature-flag-menu-intent"
+ data-attr-intent={intentKey}
+ description={intentMeta.description}
+ >
+ <intentMeta.icon />
+ {intentMeta.name}
+ </DropdownMenuItem>
+ )
+ })}
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ render={
+ <Button
+ size="row"
+ left
+ render={<LinkPrimitive to={urls.featureFlagNew({ template })} />}
+ />
+ }
+ data-attr="new-feature-flag-menu-skip-intent"
+ >
+ <span className="text-xs text-secondary">Skip — no evaluation warnings</span>
+ </DropdownMenuItem>
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+ )
+ }
+ return (
+ <DropdownMenuItem
+ key={template}
+ render={
+ <Button
+ size="row"
+ left
+ render={<LinkPrimitive to={urls.featureFlagNew({ template })} />}
+ />
+ }
+ data-attr="new-feature-flag-menu-item"
+ data-attr-template={template}
+ description={metadata.description}
+ >
+ <metadata.icon />
+ {metadata.name}
+ </DropdownMenuItem>
+ )
+ })}
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ render={
+ <Button
+ size="row"
+ left
+ render={<LinkPrimitive to={urls.featureFlagNew({ type: 'remote_config' })} />}
+ />
+ }
+ data-attr="new-feature-flag-menu-item"
+ data-attr-template="remote_config"
+ description="Deliver configuration values to your app"
+ >
+ <IconCode />
+ Remote config
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ data-attr="new-experiment-menu-item"
+ data-attr-flag-type="experiment"
+ description="Run A/B tests with statistical analysis"
+ render={<Button size="row" left render={<LinkPrimitive to={urls.experiment('new')} />} />}
+ onClick={() => {
+ void addProductIntentForCrossSell({
+ from: ProductKey.FEATURE_FLAGS,
+ to: ProductKey.EXPERIMENTS,
+ intent_context: ProductIntentContext.EXPERIMENT_CREATED,
+ })
+ }}
+ >
+ <IconFlask />
+ Experiment
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ data-attr="new-feature-flag-ai-menu-item"
+ data-attr-flag-type="ai"
+ description="Not sure? Ask AI to do it for you"
+ onClick={() => {
+ setActiveGroup(
+ createSuggestionGroup(
+ AI_TOOL_DEFINITION.name,
+ React.createElement(IconWrench),
+ AI_SUGGESTIONS
+ )
+ )
+ openSidePanel(SidePanelTab.Max, 'Create a feature flag for ')
+ }}
+ >
+ <IconSparkles />
+ Ask AI
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/frontend/src/scenes/health/HealthScene.tsx b/frontend/src/scenes/health/HealthScene.tsx
index 636d64f1c907..5ef71e53d1cc 100644
--- a/frontend/src/scenes/health/HealthScene.tsx
+++ b/frontend/src/scenes/health/HealthScene.tsx
@@ -5,6 +5,7 @@ import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
import { supportLogic } from 'lib/components/Support/supportLogic'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { humanFriendlyDuration } from 'lib/utils/durations'
import { SceneExport } from 'scenes/sceneTypes'
@@ -20,6 +21,7 @@ import { HealthIssueSummaryCards } from './components/HealthIssueSummaryCards'
import { PlatformStatusBanner } from './components/PlatformStatusBanner'
import { healthSceneLogic } from './healthSceneLogic'
import { buildHealthOverviewPrompt, HEALTH_OVERVIEW_QUESTIONS } from './healthUtils'
+import { QuillHealthSceneActions } from './QuillHealthSceneActions'
export const HealthScene = (): JSX.Element => {
const { showDismissed, healthIssuesLoading, isRefreshInFlight, nextRefreshAvailableAt, issues } =
@@ -28,6 +30,7 @@ export const HealthScene = (): JSX.Element => {
const { openSupportForm } = useActions(supportLogic)
const { openSidePanel } = useActions(sidePanelStateLogic)
const { featureFlags } = useValues(featureFlagLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const askAiEnabled = !!featureFlags[FEATURE_FLAGS.HEALTH_ASK_AI]
@@ -49,69 +52,77 @@ export const HealthScene = (): JSX.Element => {
description="See an at-a-glance view of the health of your project."
resourceType={{ type: 'health' }}
actions={
- <>
- <LemonButton
- icon={<IconBell />}
- type="secondary"
- size="small"
- to={urls.healthAlerts()}
- tooltip="Subscribe to alerts when any health check fires"
- >
- Alerts
- </LemonButton>
+ todayRailNav ? (
+ <QuillHealthSceneActions
+ askAiEnabled={askAiEnabled}
+ refreshTooltip={refreshTooltip}
+ cooldownLabel={cooldownLabel}
+ />
+ ) : (
+ <>
+ <LemonButton
+ icon={<IconBell />}
+ type="secondary"
+ size="small"
+ to={urls.healthAlerts()}
+ tooltip="Subscribe to alerts when any health check fires"
+ >
+ Alerts
+ </LemonButton>
- {askAiEnabled && (
+ {askAiEnabled && (
+ <LemonMenu
+ items={HEALTH_OVERVIEW_QUESTIONS.map((question) => ({
+ label: question,
+ onClick: () =>
+ openSidePanel(
+ SidePanelTab.Max,
+ `!${buildHealthOverviewPrompt(issues, question)}`
+ ),
+ }))}
+ placement="bottom-end"
+ >
+ <LemonButton
+ icon={<IconSparkles />}
+ type="secondary"
+ size="small"
+ tooltip="Ask PostHog AI about your health issues"
+ >
+ Ask PostHog AI
+ </LemonButton>
+ </LemonMenu>
+ )}
+ <LemonButton
+ icon={<IconSupport />}
+ type="secondary"
+ size="small"
+ onClick={() => openSupportForm({ kind: 'support' })}
+ >
+ Get help from our team
+ </LemonButton>
+ <LemonButton
+ icon={<IconRefresh />}
+ type="tertiary"
+ size="small"
+ tooltip={refreshTooltip}
+ loading={isRefreshInFlight || healthIssuesLoading}
+ disabledReason={cooldownLabel}
+ onClick={() => refreshHealthData()}
+ />
<LemonMenu
- items={HEALTH_OVERVIEW_QUESTIONS.map((question) => ({
- label: question,
- onClick: () =>
- openSidePanel(
- SidePanelTab.Max,
- `!${buildHealthOverviewPrompt(issues, question)}`
- ),
- }))}
+ items={[
+ {
+ label: 'Show dismissed',
+ icon: showDismissed ? <IconCheck /> : undefined,
+ onClick: () => setShowDismissed(!showDismissed),
+ },
+ ]}
placement="bottom-end"
>
- <LemonButton
- icon={<IconSparkles />}
- type="secondary"
- size="small"
- tooltip="Ask PostHog AI about your health issues"
- >
- Ask PostHog AI
- </LemonButton>
+ <LemonButton icon={<IconEllipsis />} type="tertiary" size="small" />
</LemonMenu>
- )}
- <LemonButton
- icon={<IconSupport />}
- type="secondary"
- size="small"
- onClick={() => openSupportForm({ kind: 'support' })}
- >
- Get help from our team
- </LemonButton>
- <LemonButton
- icon={<IconRefresh />}
- type="tertiary"
- size="small"
- tooltip={refreshTooltip}
- loading={isRefreshInFlight || healthIssuesLoading}
- disabledReason={cooldownLabel}
- onClick={() => refreshHealthData()}
- />
- <LemonMenu
- items={[
- {
- label: 'Show dismissed',
- icon: showDismissed ? <IconCheck /> : undefined,
- onClick: () => setShowDismissed(!showDismissed),
- },
- ]}
- placement="bottom-end"
- >
- <LemonButton icon={<IconEllipsis />} type="tertiary" size="small" />
- </LemonMenu>
- </>
+ </>
+ )
}
/>
diff --git a/frontend/src/scenes/health/QuillHealthSceneActions.tsx b/frontend/src/scenes/health/QuillHealthSceneActions.tsx
new file mode 100644
index 000000000000..9b8838a97885
--- /dev/null
+++ b/frontend/src/scenes/health/QuillHealthSceneActions.tsx
@@ -0,0 +1,98 @@
+import { useActions, useValues } from 'kea'
+
+import { IconBell, IconEllipsis, IconRefresh, IconSparkles, IconSupport } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuCheckboxItem,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { supportLogic } from 'lib/components/Support/supportLogic'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { urls } from 'scenes/urls'
+
+import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
+import { SidePanelTab } from '~/types'
+
+import { healthSceneLogic } from './healthSceneLogic'
+import { buildHealthOverviewPrompt, HEALTH_OVERVIEW_QUESTIONS } from './healthUtils'
+
+export interface QuillHealthSceneActionsProps {
+ askAiEnabled: boolean
+ refreshTooltip: string
+ cooldownLabel: string | undefined
+}
+
+export function QuillHealthSceneActions({
+ askAiEnabled,
+ refreshTooltip,
+ cooldownLabel,
+}: QuillHealthSceneActionsProps): JSX.Element {
+ const { showDismissed, healthIssuesLoading, isRefreshInFlight, issues } = useValues(healthSceneLogic)
+ const { refreshHealthData, setShowDismissed } = useActions(healthSceneLogic)
+ const { openSupportForm } = useActions(supportLogic)
+ const { openSidePanel } = useActions(sidePanelStateLogic)
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={urls.healthAlerts()} />}
+ tooltip="Subscribe to alerts when any health check fires"
+ >
+ <IconBell />
+ Alerts
+ </Button>
+
+ {askAiEnabled && (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={<Button variant="outline" tooltip="Ask PostHog AI about your health issues" />}
+ >
+ <IconSparkles />
+ Ask PostHog AI
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-56">
+ {HEALTH_OVERVIEW_QUESTIONS.map((question) => (
+ <DropdownMenuItem
+ key={question}
+ onClick={() =>
+ openSidePanel(SidePanelTab.Max, `!${buildHealthOverviewPrompt(issues, question)}`)
+ }
+ >
+ {question}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ <Button variant="outline" onClick={() => openSupportForm({ kind: 'support' })}>
+ <IconSupport />
+ Get help from our team
+ </Button>
+ <Button
+ size="icon"
+ aria-label={refreshTooltip}
+ tooltip={refreshTooltip}
+ loading={isRefreshInFlight || healthIssuesLoading}
+ disabledReason={cooldownLabel}
+ onClick={() => refreshHealthData()}
+ >
+ <IconRefresh />
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger render={<Button size="icon" aria-label="More options" tooltip="More options" />}>
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuCheckboxItem checked={showDismissed} onCheckedChange={setShowDismissed}>
+ Show dismissed
+ </DropdownMenuCheckboxItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/health/pipelineStatus/PipelineStatusScene.tsx b/frontend/src/scenes/health/pipelineStatus/PipelineStatusScene.tsx
index 723c1e1ceef4..bfc863455faa 100644
--- a/frontend/src/scenes/health/pipelineStatus/PipelineStatusScene.tsx
+++ b/frontend/src/scenes/health/pipelineStatus/PipelineStatusScene.tsx
@@ -2,10 +2,13 @@ import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { IconBell, IconRefresh } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -29,6 +32,11 @@ export function PipelineStatusScene(): JSX.Element {
const { loadHealthIssues } = useActions(pipelineHealthLogic)
const { filteredIssues, filteredIssueCount, isIssueDismissed } = useValues(pipelineStatusSceneLogic)
const { dismissIssue, undismissIssue } = useActions(pipelineStatusSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ const trackAlertsClick = (): void => {
+ posthog.capture('health_alerts_entry_point_clicked', { source: 'pipeline_status' })
+ }
return (
<SceneContent>
@@ -40,31 +48,53 @@ export function PipelineStatusScene(): JSX.Element {
type: 'pipeline_status',
}}
actions={
- <>
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconBell className="size-4" />}
- to={urls.healthAlerts(['external_data_failure', 'materialized_view_failure'])}
- onClick={() => {
- posthog.capture('health_alerts_entry_point_clicked', {
- source: 'pipeline_status',
- })
- }}
- tooltip="Subscribe to alerts when a pipeline fails"
- >
- Alerts
- </LemonButton>
- <LemonButton
- type="primary"
- size="small"
- icon={<IconRefresh className="size-4" />}
- disabledReason={healthIssuesLoading ? 'Refreshing...' : undefined}
- onClick={() => loadHealthIssues()}
- >
- {healthIssuesLoading ? 'Refreshing...' : 'Refresh'}
- </LemonButton>
- </>
+ todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ <Button
+ variant="outline"
+ render={
+ <LinkPrimitive
+ to={urls.healthAlerts(['external_data_failure', 'materialized_view_failure'])}
+ />
+ }
+ onClick={trackAlertsClick}
+ tooltip="Subscribe to alerts when a pipeline fails"
+ >
+ <IconBell />
+ Alerts
+ </Button>
+ <Button
+ variant="primary"
+ disabledReason={healthIssuesLoading ? 'Refreshing...' : undefined}
+ onClick={() => loadHealthIssues()}
+ >
+ <IconRefresh />
+ {healthIssuesLoading ? 'Refreshing...' : 'Refresh'}
+ </Button>
+ </div>
+ ) : (
+ <>
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconBell className="size-4" />}
+ to={urls.healthAlerts(['external_data_failure', 'materialized_view_failure'])}
+ onClick={trackAlertsClick}
+ tooltip="Subscribe to alerts when a pipeline fails"
+ >
+ Alerts
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ size="small"
+ icon={<IconRefresh className="size-4" />}
+ disabledReason={healthIssuesLoading ? 'Refreshing...' : undefined}
+ onClick={() => loadHealthIssues()}
+ >
+ {healthIssuesLoading ? 'Refreshing...' : 'Refresh'}
+ </LemonButton>
+ </>
+ )
}
/>
diff --git a/frontend/src/scenes/hog-functions/HogFunctionScene.tsx b/frontend/src/scenes/hog-functions/HogFunctionScene.tsx
index 3870cede68fe..f5303461fe01 100644
--- a/frontend/src/scenes/hog-functions/HogFunctionScene.tsx
+++ b/frontend/src/scenes/hog-functions/HogFunctionScene.tsx
@@ -20,6 +20,7 @@ import { LemonDivider } from '@posthog/lemon-ui'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
import { NotFound } from 'lib/components/NotFound'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useFileSystemLogView } from 'lib/hooks/useFileSystemLogView'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
@@ -60,6 +61,7 @@ import { HogInvocations } from './invocations/HogInvocations'
import { TransformationInvocations } from './invocations/TransformationInvocations'
import { HogFunctionMetrics } from './metrics/HogFunctionMetrics'
import { HogFunctionSkeleton } from './misc/HogFunctionSkeleton'
+import { QuillHogFunctionSceneActions } from './QuillHogFunctionSceneActions'
import { HogFunctionRuns } from './runs/HogFunctionRuns'
const HOG_FUNCTION_SCENE_TABS = ['configuration', 'metrics', 'runs', 'invocations', 'backfills', 'history'] as const
@@ -428,6 +430,7 @@ export const scene: SceneExport<HogFunctionConfigurationLogicProps> = {
function HogFunctionHeader(): JSX.Element {
const { configuration, logicProps, loading, isLegacyPlugin } = useValues(hogFunctionConfigurationLogic)
const { setConfigurationValue, duplicate, deleteHogFunction } = useActions(hogFunctionConfigurationLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<>
@@ -452,32 +455,40 @@ function HogFunctionHeader(): JSX.Element {
onDescriptionChange={(value) => setConfigurationValue('description', value)}
canEdit
actions={
- <>
- {!logicProps.templateId && (
- <>
- <More
- size="small"
- overlay={
- <>
- {!isLegacyPlugin && (
- <LemonButton fullWidth onClick={() => duplicate()}>
- Duplicate
+ todayRailNav ? (
+ <QuillHogFunctionSceneActions />
+ ) : (
+ <>
+ {!logicProps.templateId && (
+ <>
+ <More
+ size="small"
+ overlay={
+ <>
+ {!isLegacyPlugin && (
+ <LemonButton fullWidth onClick={() => duplicate()}>
+ Duplicate
+ </LemonButton>
+ )}
+ <LemonDivider />
+ <LemonButton
+ status="danger"
+ fullWidth
+ onClick={() => deleteHogFunction()}
+ >
+ Delete
</LemonButton>
- )}
- <LemonDivider />
- <LemonButton status="danger" fullWidth onClick={() => deleteHogFunction()}>
- Delete
- </LemonButton>
- </>
- }
- />
- <LemonDivider vertical />
- </>
- )}
- <HogFunctionConfigurationClearChangesButton />
- <HogFunctionConfigurationSaveButton />
- {logicProps.id ? <HogFunctionPublishDraftButton logicProps={logicProps} /> : null}
- </>
+ </>
+ }
+ />
+ <LemonDivider vertical />
+ </>
+ )}
+ <HogFunctionConfigurationClearChangesButton />
+ <HogFunctionConfigurationSaveButton />
+ {logicProps.id ? <HogFunctionPublishDraftButton logicProps={logicProps} /> : null}
+ </>
+ )
}
/>
</>
diff --git a/frontend/src/scenes/hog-functions/QuillHogFunctionSceneActions.tsx b/frontend/src/scenes/hog-functions/QuillHogFunctionSceneActions.tsx
new file mode 100644
index 000000000000..555ca3e8415d
--- /dev/null
+++ b/frontend/src/scenes/hog-functions/QuillHogFunctionSceneActions.tsx
@@ -0,0 +1,75 @@
+import { useActions, useValues } from 'kea'
+
+import { IconEllipsis } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { hogFunctionConfigurationLogic } from './configuration/hogFunctionConfigurationLogic'
+
+export function QuillHogFunctionSceneActions(): JSX.Element {
+ const {
+ configuration,
+ logicProps,
+ isLegacyPlugin,
+ configurationChanged,
+ template,
+ isConfigurationSubmitting,
+ willReEnableOnSave,
+ willChangeEnabledOnSave,
+ hogFunction,
+ } = useValues(hogFunctionConfigurationLogic)
+ const { duplicate, deleteHogFunction, resetForm, submitConfiguration } = useActions(hogFunctionConfigurationLogic)
+
+ return (
+ <>
+ {!logicProps.templateId && (
+ <DropdownMenu>
+ <DropdownMenuTrigger render={<Button size="icon" aria-label="More" tooltip="More" />}>
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {!isLegacyPlugin && (
+ <>
+ <DropdownMenuItem onClick={() => duplicate()}>Duplicate</DropdownMenuItem>
+ <DropdownMenuSeparator />
+ </>
+ )}
+ <DropdownMenuItem variant="destructive" onClick={() => deleteHogFunction()}>
+ Delete
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ {configurationChanged ? (
+ <Button
+ variant="outline"
+ type="reset"
+ onClick={() => resetForm()}
+ disabledReason={isConfigurationSubmitting ? 'Saving in progress…' : undefined}
+ >
+ Clear changes
+ </Button>
+ ) : null}
+ <Button
+ variant="primary"
+ type="submit"
+ onClick={submitConfiguration}
+ loading={isConfigurationSubmitting}
+ disabledReason={!configurationChanged && hogFunction ? 'No changes' : undefined}
+ >
+ {template ? 'Create' : 'Save'}
+ {willReEnableOnSave
+ ? ' & re-enable'
+ : willChangeEnabledOnSave
+ ? ` & ${configuration.enabled ? 'enable' : 'disable'}`
+ : ''}
+ </Button>
+ </>
+ )
+}
diff --git a/frontend/src/scenes/library/LibraryCreateButton.tsx b/frontend/src/scenes/library/LibraryCreateButton.tsx
index aa7e2b318ddb..9f616ee9e663 100644
--- a/frontend/src/scenes/library/LibraryCreateButton.tsx
+++ b/frontend/src/scenes/library/LibraryCreateButton.tsx
@@ -3,7 +3,10 @@ import { useValues } from 'kea'
import { IconPlus } from '@posthog/icons'
import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+
import { libraryLogic } from './libraryLogic'
+import { QuillLibraryCreateButton } from './QuillLibraryCreateButton'
interface LibraryCreateButtonProps {
objectType: string
@@ -14,6 +17,10 @@ interface LibraryCreateButtonProps {
/** Creates an object of one Library type. Types with several kinds (insights) open a menu of kinds. */
export function LibraryCreateButton({ objectType, label }: LibraryCreateButtonProps): JSX.Element | null {
const { createItemsByType, objectTypeByValue } = useValues(libraryLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillLibraryCreateButton objectType={objectType} label={label} />
+ }
const items = createItemsByType[objectType] ?? []
const typeLabel = objectTypeByValue[objectType]?.label.toLowerCase() ?? 'object'
if (!items.length) {
diff --git a/frontend/src/scenes/library/QuillLibraryCreateButton.tsx b/frontend/src/scenes/library/QuillLibraryCreateButton.tsx
new file mode 100644
index 000000000000..1ae23c0c4ba5
--- /dev/null
+++ b/frontend/src/scenes/library/QuillLibraryCreateButton.tsx
@@ -0,0 +1,64 @@
+import { useValues } from 'kea'
+
+import { IconPlus } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { navigateToHref } from 'lib/utils/navigateToHref'
+
+import { libraryLogic } from './libraryLogic'
+
+interface QuillLibraryCreateButtonProps {
+ objectType: string
+ /** Shown on the button. Without it the button is a small plus icon. */
+ label?: string
+}
+
+export function QuillLibraryCreateButton({ objectType, label }: QuillLibraryCreateButtonProps): JSX.Element | null {
+ const { createItemsByType, objectTypeByValue } = useValues(libraryLogic)
+ const items = createItemsByType[objectType] ?? []
+ const typeLabel = objectTypeByValue[objectType]?.label.toLowerCase() ?? 'object'
+ if (!items.length) {
+ return null
+ }
+ const newLabel = `New ${typeLabel}`
+ const buttonProps = label ? ({ variant: 'primary' } as const) : ({ variant: 'default', size: 'icon-sm' } as const)
+ const content = (
+ <>
+ <IconPlus />
+ {label}
+ </>
+ )
+
+ if (items.length === 1) {
+ return (
+ <Button
+ {...buttonProps}
+ render={<LinkPrimitive to={items[0].href} />}
+ aria-label={newLabel}
+ tooltip={label ? undefined : newLabel}
+ data-attr="library-new-object"
+ >
+ {content}
+ </Button>
+ )
+ }
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger render={<Button {...buttonProps} aria-label={newLabel} />}>
+ {content}
+ </DropdownMenuTrigger>
+ <DropdownMenuContent className="min-w-40">
+ {items.map((item) => (
+ <DropdownMenuItem
+ key={item.href}
+ onClick={() => navigateToHref(item.href)}
+ data-attr="library-new-object"
+ >
+ {item.path.split('/').pop() ?? item.path}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx b/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx
index ce428573bf1f..e30427b588ae 100644
--- a/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx
+++ b/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx
@@ -4,9 +4,12 @@ import { useEffect } from 'react'
import { IconComment, IconGear, IconSparkles } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonSwitch, LemonTabs, LemonSkeleton, Spinner, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { supportLogic } from 'lib/components/Support/supportLogic'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { MaxTool } from 'scenes/max/MaxTool'
import { useMaxTool } from 'scenes/max/useMaxTool'
@@ -679,6 +682,7 @@ export function MarketingAnalyticsScene(): JSX.Element {
!!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_NEW_DASHBOARD]
useEffect(() => (setupEnabled ? setupPlanLogic.mount() : undefined), [setupEnabled])
const { activeTab } = useValues(marketingAnalyticsLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<BindLogic logic={marketingAnalyticsLogic} props={{}}>
@@ -693,36 +697,77 @@ export function MarketingAnalyticsScene(): JSX.Element {
type: sceneConfigurations[Scene.MarketingAnalytics]?.iconType || 'marketing_analytics',
}}
actions={
- <>
- {featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] && (
+ todayRailNav ? (
+ <>
+ {featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] && (
+ <Button
+ variant="outline"
+ onClick={() => openSupportForm({ kind: 'feedback', isEmailFormOpen: true })}
+ >
+ <IconComment />
+ Send feedback
+ </Button>
+ )}
+ <Button
+ variant="outline"
+ render={
+ <LinkPrimitive
+ to="https://posthog.com/docs/web-analytics/marketing-analytics"
+ target="_blank"
+ />
+ }
+ data-attr="marketing-analytics-docs-button"
+ >
+ Documentation
+ </Button>
+ <Button
+ variant="outline"
+ render={
+ <LinkPrimitive
+ to={urls.settings(
+ 'environment-marketing-analytics',
+ 'marketing-settings'
+ )}
+ />
+ }
+ data-attr="marketing-analytics-settings-button"
+ >
+ <IconGear />
+ Settings
+ </Button>
+ </>
+ ) : (
+ <>
+ {featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] && (
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconComment />}
+ onClick={() => openSupportForm({ kind: 'feedback', isEmailFormOpen: true })}
+ >
+ Send feedback
+ </LemonButton>
+ )}
+ <LemonButton
+ to="https://posthog.com/docs/web-analytics/marketing-analytics"
+ type="secondary"
+ targetBlank
+ size="small"
+ data-attr="marketing-analytics-docs-button"
+ >
+ Documentation
+ </LemonButton>
<LemonButton
type="secondary"
size="small"
- icon={<IconComment />}
- onClick={() => openSupportForm({ kind: 'feedback', isEmailFormOpen: true })}
+ icon={<IconGear />}
+ to={urls.settings('environment-marketing-analytics', 'marketing-settings')}
+ data-attr="marketing-analytics-settings-button"
>
- Send feedback
+ Settings
</LemonButton>
- )}
- <LemonButton
- to="https://posthog.com/docs/web-analytics/marketing-analytics"
- type="secondary"
- targetBlank
- size="small"
- data-attr="marketing-analytics-docs-button"
- >
- Documentation
- </LemonButton>
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconGear />}
- to={urls.settings('environment-marketing-analytics', 'marketing-settings')}
- data-attr="marketing-analytics-settings-button"
- >
- Settings
- </LemonButton>
- </>
+ </>
+ )
}
/>
<MarketingAnalyticsAIToolWrapper>
diff --git a/frontend/src/scenes/max/Max.tsx b/frontend/src/scenes/max/Max.tsx
index 47a8979ae8cd..067a7c48b951 100644
--- a/frontend/src/scenes/max/Max.tsx
+++ b/frontend/src/scenes/max/Max.tsx
@@ -14,6 +14,7 @@ import {
import { LemonBanner, Link, Spinner, Tooltip } from '@posthog/lemon-ui'
import { Button, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
@@ -205,6 +206,19 @@ export const MaxInstance = React.memo(function MaxInstance({
const { closeSidePanel } = useActions(sidePanelLogic)
const { selectedTabOptions } = useValues(sidePanelStateLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ const openInContextPanel = (): void => {
+ openSidePanelMax(conversationId ?? undefined)
+ }
+
+ const copyChatLink = (): void => {
+ copyToClipboard(
+ urls.absolute(urls.currentProject(urls.ai(conversationId ?? undefined))),
+ 'conversation sharing link'
+ )
+ }
+
const isNewView = effectivePhaiView === 'new'
const isReportChat = !!sidePanel && selectedTabOptions === REPORT_AI_PANEL
const isScoutChat = !!sidePanel && selectedTabOptions === SCOUT_AI_PANEL
@@ -371,35 +385,45 @@ export const MaxInstance = React.memo(function MaxInstance({
name={null}
resourceType={{ type: 'chat' }}
actions={
- <>
- {tabId && conversationId ? (
- <LemonButton
- size="small"
- type="secondary"
- sideIcon={<IconShare />}
- onClick={() => {
- copyToClipboard(
- urls.absolute(urls.currentProject(urls.ai(conversationId ?? undefined))),
- 'conversation sharing link'
- )
- }}
- >
- Copy link to chat
- </LemonButton>
- ) : undefined}
- {tabId ? (
- <LemonButton
- size="small"
- type="secondary"
- sideIcon={<IconOpenSidebar />}
- onClick={() => {
- openSidePanelMax(conversationId ?? undefined)
- }}
- >
- Open in context panel
- </LemonButton>
- ) : undefined}
- </>
+ todayRailNav ? (
+ <>
+ {tabId && conversationId ? (
+ <Button variant="outline" onClick={copyChatLink}>
+ Copy link to chat
+ <IconShare />
+ </Button>
+ ) : undefined}
+ {tabId ? (
+ <Button variant="outline" onClick={openInContextPanel}>
+ Open in context panel
+ <IconOpenSidebar />
+ </Button>
+ ) : undefined}
+ </>
+ ) : (
+ <>
+ {tabId && conversationId ? (
+ <LemonButton
+ size="small"
+ type="secondary"
+ sideIcon={<IconShare />}
+ onClick={copyChatLink}
+ >
+ Copy link to chat
+ </LemonButton>
+ ) : undefined}
+ {tabId ? (
+ <LemonButton
+ size="small"
+ type="secondary"
+ sideIcon={<IconOpenSidebar />}
+ onClick={openInContextPanel}
+ >
+ Open in context panel
+ </LemonButton>
+ ) : undefined}
+ </>
+ )
}
/>
<div className="grow flex flex-col">{content}</div>
diff --git a/frontend/src/scenes/notebooks/NotebookCanvasScene.tsx b/frontend/src/scenes/notebooks/NotebookCanvasScene.tsx
index 7c495e9ffd72..d025b3cf71ff 100644
--- a/frontend/src/scenes/notebooks/NotebookCanvasScene.tsx
+++ b/frontend/src/scenes/notebooks/NotebookCanvasScene.tsx
@@ -2,19 +2,21 @@ import { useActions } from 'kea'
import { useMemo } from 'react'
import { IconEllipsis } from '@posthog/icons'
-import { LemonButton, LemonMenu, lemonToast } from '@posthog/lemon-ui'
+import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
import { uuid } from 'lib/utils/dom'
-import { getTextFromFile, selectFiles } from 'lib/utils/file-utils'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
+import { loadNotebookFromJSON } from './loadNotebookFromJSON'
import { Notebook } from './Notebook/Notebook'
import { NotebookLogicProps, notebookLogic } from './Notebook/notebookLogic'
+import { QuillNotebookCanvasActions } from './QuillNotebookCanvasActions'
export const scene: SceneExport = {
component: NotebookCanvas,
@@ -29,6 +31,7 @@ export function NotebookCanvas(): JSX.Element {
}
const { duplicateNotebook, exportJSON, setLocalContent } = useActions(notebookLogic(logicProps))
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<SceneContent className="h-full">
@@ -43,58 +46,42 @@ export function NotebookCanvas(): JSX.Element {
key: 'notebooks',
}}
actions={
- <>
- <LemonMenu
- items={[
- {
- label: 'Clear canvas',
- onClick: () => setLocalContent({ type: 'doc', content: [] }),
- },
- {
- label: 'Export as JSON',
- onClick: () => exportJSON(),
- },
- {
- label: 'Load from JSON',
- onClick: () => {
- void selectFiles({
- contentType: 'application/json',
- multiple: false,
- })
- .then(async (files) => {
- if (!files.length) {
- return
- }
- const text = await getTextFromFile(files[0])
- const data = JSON.parse(text)
- if (data.type !== 'doc') {
- throw new Error('Not a notebook')
- }
- // Looks like a notebook
- setLocalContent(data)
- })
- .catch((e) => {
- lemonToast.error(e.message)
- })
+ todayRailNav ? (
+ <QuillNotebookCanvasActions logicProps={logicProps} />
+ ) : (
+ <>
+ <LemonMenu
+ items={[
+ {
+ label: 'Clear canvas',
+ onClick: () => setLocalContent({ type: 'doc', content: [] }),
},
- },
- ]}
- >
- <LemonButton icon={<IconEllipsis />} size="small" />
- </LemonMenu>
- <LemonButton
- type="secondary"
- onClick={() => {
- void copyToClipboard(window.location.href, 'Canvas URL')
- }}
- size="small"
- >
- Share
- </LemonButton>
- <LemonButton type="primary" onClick={duplicateNotebook} size="small">
- Save as Notebook
- </LemonButton>
- </>
+ {
+ label: 'Export as JSON',
+ onClick: () => exportJSON(),
+ },
+ {
+ label: 'Load from JSON',
+ onClick: () => loadNotebookFromJSON(setLocalContent),
+ },
+ ]}
+ >
+ <LemonButton icon={<IconEllipsis />} size="small" />
+ </LemonMenu>
+ <LemonButton
+ type="secondary"
+ onClick={() => {
+ void copyToClipboard(window.location.href, 'Canvas URL')
+ }}
+ size="small"
+ >
+ Share
+ </LemonButton>
+ <LemonButton type="primary" onClick={duplicateNotebook} size="small">
+ Save as Notebook
+ </LemonButton>
+ </>
+ )
}
/>
<div className="relative flex-1">
diff --git a/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx b/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx
index f2adbcdec382..94af05c7058b 100644
--- a/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx
+++ b/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx
@@ -7,6 +7,7 @@ import { LemonDivider, LemonDropdown, LemonTag, ProfilePicture } from '@posthog/
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { MemberSelect } from 'lib/components/MemberSelect'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconWithCount } from 'lib/lemon-ui/icons'
import { LemonButton, LemonButtonProps } from 'lib/lemon-ui/LemonButton'
import { LemonInput } from 'lib/lemon-ui/LemonInput/LemonInput'
@@ -19,12 +20,13 @@ import {
notebookSelectButtonLogic,
} from 'scenes/notebooks/NotebookSelectButton/notebookSelectButtonLogic'
-import { notebooksModel, openNotebook } from '~/models/notebooksModel'
+import { notebooksModel } from '~/models/notebooksModel'
import { AccessControlLevel, AccessControlResourceType } from '~/types'
import type { notebookNodeLogicType } from '../Nodes/notebookNodeLogic'
import type { notebookLogicType } from '../Notebook/notebookLogic'
-import { NotebookListItemType, NotebookTarget } from '../types'
+import { NotebookListItemType } from '../types'
+import { createNotebookForResource, openNotebookForResource } from './notebookSelectActions'
import { NOTEBOOK_DROPDOWN_LIMIT } from './notebookSelectButtonLogic'
export type NotebookSelectProps = NotebookSelectButtonLogicProps & {
@@ -137,35 +139,30 @@ export function NotebookSelectList(props: NotebookSelectProps): JSX.Element {
const logic = notebookSelectButtonLogic({ ...props })
const { resource, newNotebookTitle } = props
- const notebookResource = resource && typeof resource !== 'boolean' ? resource : null
const { notebooksLoading, notebooksContainingResource, notebooksNotContainingResource, searchQuery, createdBy } =
useValues(logic as any)
const { setShowPopover, setSearchQuery, setCreatedBy, loadNotebooksContainingResource, loadAllNotebooks } =
useActions(logic as any)
const { createNotebook } = useActions(notebooksModel)
- const openAndAddToNotebook = (notebookShortId: string, exists: boolean): void => {
- void openNotebook(notebookShortId, NotebookTarget.Popover, (theNotebookLogic) => {
- if (!exists && props.resource) {
- theNotebookLogic.actions.insertAfterLastNode([props.resource])
- }
- props.onNotebookOpened?.(theNotebookLogic)
+ const openAndAddToNotebook = (notebookShortId: string, exists: boolean): void =>
+ openNotebookForResource({
+ notebookShortId,
+ alreadyContainsResource: exists,
+ resource,
+ onNotebookOpened: props.onNotebookOpened,
})
- }
const openNewNotebook = (): void => {
- const title = newNotebookTitle ?? `Notes ${dayjs().format('DD/MM')}`
-
- createNotebook(
- NotebookTarget.Popover,
- title,
- notebookResource ? [notebookResource] : undefined,
- (theNotebookLogic) => {
+ createNotebookForResource({
+ resource,
+ newNotebookTitle,
+ createNotebook,
+ onNotebookOpened: (theNotebookLogic) => {
props.onNotebookOpened?.(theNotebookLogic)
loadNotebooksContainingResource()
- }
- )
-
+ },
+ })
setShowPopover(false)
}
@@ -303,19 +300,30 @@ export function NotebookSelectPopover({
)
}
-export function NotebookSelectButton({ children, onNotebookOpened, ...props }: NotebookSelectButtonProps): JSX.Element {
+export function NotebookSelectButton({
+ children,
+ onNotebookOpened,
+ ...props
+}: NotebookSelectButtonProps): JSX.Element | null {
// if nodeLogic is available then the button is on a resource that _is already and currently in a notebook_
const nodeLogic = useNotebookNode()
const logic = notebookSelectButtonLogic({ ...props, onNotebookOpened })
const { showPopover, notebooksContainingResource } = useValues(logic)
const { loadNotebooksContainingResource } = useActions(logic)
+ // The rail redesign (`today-rail-nav`) deprecates adding to notebooks from outside a notebook. See QuillNotebookSelectButton to bring it back.
+ // Inside a notebook the button stays, because it hands the resource to the notebook already open.
+ const hidden = useFeatureFlag('TODAY_RAIL_NAV') && !nodeLogic
useEffect(() => {
- if (!nodeLogic) {
+ if (!nodeLogic && !hidden) {
loadNotebooksContainingResource()
}
// oxlint-disable-next-line exhaustive-deps
- }, [nodeLogic])
+ }, [nodeLogic, hidden])
+
+ if (hidden) {
+ return null
+ }
const button = (
<LemonButton
diff --git a/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookFilterMenu.tsx b/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookFilterMenu.tsx
new file mode 100644
index 000000000000..64631f9db838
--- /dev/null
+++ b/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookFilterMenu.tsx
@@ -0,0 +1,66 @@
+import { useActions, useValues } from 'kea'
+import { useMemo } from 'react'
+
+import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from '@posthog/quill'
+
+import { fullName } from 'lib/utils/strings'
+import { membersLogic } from 'scenes/organization/membersLogic'
+import { userLogic } from 'scenes/userLogic'
+
+import { TodayFilterMenuTrigger } from '~/layout/today/TodayFilterMenuTrigger'
+import { TodayRecentRadioSubmenu } from '~/layout/today/TodayRecentRadioSubmenu'
+
+const ANY_USER = 'any'
+
+/** The notebook picker's filters, laid out like the rail's: one row per filter, and a way to clear them. */
+export function QuillNotebookFilterMenu({
+ createdBy,
+ setCreatedBy,
+}: {
+ /** The creator's user uuid, or null for anyone. */
+ createdBy: string | null
+ setCreatedBy: (userUuid: string | null) => void
+}): JSX.Element {
+ const { meFirstMembers } = useValues(membersLogic)
+ const { user } = useValues(userLogic)
+ const { ensureAllMembersLoaded } = useActions(membersLogic)
+
+ const createdByOptions = useMemo(
+ () => [
+ { value: ANY_USER, label: 'Any user' },
+ ...meFirstMembers.map(({ user: member }) => ({
+ value: member.uuid,
+ label: member.uuid === user?.uuid ? 'Me' : fullName(member),
+ })),
+ ],
+ [meFirstMembers, user]
+ )
+
+ return (
+ <DropdownMenu onOpenChange={(open) => open && ensureAllMembersLoaded()}>
+ <TodayFilterMenuTrigger active={createdBy !== null} dataAttr="notebooks-select-button-filter" />
+ <DropdownMenuContent align="end" className="min-w-56">
+ <TodayRecentRadioSubmenu
+ label="Created by"
+ options={createdByOptions}
+ value={createdBy ?? ANY_USER}
+ defaultValue={ANY_USER}
+ onChange={(value) => setCreatedBy(value === ANY_USER ? null : value)}
+ dataAttr="notebooks-select-button-created-by"
+ />
+ {createdBy !== null && (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={() => setCreatedBy(null)}
+ data-attr="notebooks-select-button-filter-clear"
+ >
+ Clear filters
+ </DropdownMenuItem>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookMenuItem.tsx b/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookMenuItem.tsx
new file mode 100644
index 000000000000..d0980c3a8c14
--- /dev/null
+++ b/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookMenuItem.tsx
@@ -0,0 +1,39 @@
+import { Badge, DropdownMenuItem } from '@posthog/quill'
+
+import { QuillPersonAvatar } from 'lib/components/QuillPersonAvatar/QuillPersonAvatar'
+import { TZLabel } from 'lib/components/TZLabel'
+
+import { NotebookListItemType } from '../types'
+import { SESSION_SUMMARY_PREFIX, isSessionSummaryTitle, stripSessionSummaryPrefix } from './NotebookSelectButton'
+
+export function QuillNotebookMenuItem({
+ notebook,
+ onClick,
+}: {
+ notebook: NotebookListItemType
+ onClick: () => void
+}): JSX.Element {
+ const isSessionSummary = isSessionSummaryTitle(notebook.title || undefined)
+ const title =
+ (isSessionSummary ? stripSessionSummaryPrefix(notebook.title || undefined) : notebook.title) ||
+ `Untitled (${notebook.short_id})`
+ const author = notebook.created_by?.first_name || notebook.created_by?.email || 'Unknown'
+
+ return (
+ <DropdownMenuItem
+ onClick={onClick}
+ description={
+ <span className="ph-no-capture">
+ <span>{author} · </span>
+ <TZLabel time={notebook.last_modified_at ?? notebook.created_at} />
+ </span>
+ }
+ >
+ {notebook.created_by && (
+ <QuillPersonAvatar name={notebook.created_by.first_name} email={notebook.created_by.email} size="xs" />
+ )}
+ <span className="truncate">{title}</span>
+ {isSessionSummary && <Badge>{SESSION_SUMMARY_PREFIX}</Badge>}
+ </DropdownMenuItem>
+ )
+}
diff --git a/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookMenuNote.tsx b/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookMenuNote.tsx
new file mode 100644
index 000000000000..4fe176bc33ff
--- /dev/null
+++ b/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookMenuNote.tsx
@@ -0,0 +1,6 @@
+import type { ReactNode } from 'react'
+
+/** A line of plain text in the notebook menu, such as an empty or loading state. It is not an item, so it takes no focus. */
+export function QuillNotebookMenuNote({ children }: { children: ReactNode }): JSX.Element {
+ return <div className="px-2 py-1.5 text-xs text-muted-foreground">{children}</div>
+}
diff --git a/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookSelectButton.tsx b/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookSelectButton.tsx
new file mode 100644
index 000000000000..5f796f89d1ba
--- /dev/null
+++ b/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookSelectButton.tsx
@@ -0,0 +1,235 @@
+import { useActions, useValues } from 'kea'
+import { type KeyboardEvent, useEffect } from 'react'
+
+import { IconNotebook, IconPlus, IconSearch } from '@posthog/icons'
+import {
+ Badge,
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupInput,
+} from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { useNotebookNode } from 'scenes/notebooks/Nodes/NotebookNodeContext'
+
+import { notebooksModel } from '~/models/notebooksModel'
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { NotebookListItemType } from '../types'
+import { createNotebookForResource, openNotebookForResource } from './notebookSelectActions'
+import type { NotebookSelectProps } from './NotebookSelectButton'
+import { NOTEBOOK_DROPDOWN_LIMIT, notebookSelectButtonLogic } from './notebookSelectButtonLogic'
+import { QuillNotebookFilterMenu } from './QuillNotebookFilterMenu'
+import { QuillNotebookMenuItem } from './QuillNotebookMenuItem'
+import { QuillNotebookMenuNote } from './QuillNotebookMenuNote'
+
+// A menu treats typed letters as jumps to a matching item, which would steal keys from the search field.
+// Arrow down and escape still reach the menu, so the list stays reachable and the menu closes as usual.
+function keepTypingInField(event: KeyboardEvent<HTMLInputElement>): void {
+ if (event.key !== 'ArrowDown' && event.key !== 'Escape') {
+ event.stopPropagation()
+ }
+}
+
+/**
+ * Not rendered anywhere. The rail redesign (`today-rail-nav`) deprecates adding to notebooks from outside a notebook:
+ * under the flag, `NotebookSelectButton` and `SceneAddToNotebookDropdownMenu` render nothing, and the replay menu and
+ * the insight, feature flag and cohort menu bars leave their "Add to notebook" entry out. To bring the picker back,
+ * remove those gates and render this component where the flag is on, with the same `resource` the Lemon button gets.
+ */
+export function QuillNotebookSelectButton({
+ resource,
+ newNotebookTitle,
+ onNotebookOpened,
+}: NotebookSelectProps): JSX.Element {
+ // Inside a notebook, the resource is already in one, so the button hands it straight to the callback.
+ const nodeLogic = useNotebookNode()
+ const logic = notebookSelectButtonLogic({ resource })
+ const {
+ showPopover,
+ notebooksLoading,
+ notebooksContainingResource,
+ notebooksNotContainingResource,
+ searchQuery,
+ createdBy,
+ } = useValues(logic)
+ const { setShowPopover, setSearchQuery, setCreatedBy, loadNotebooksContainingResource, loadAllNotebooks } =
+ useActions(logic)
+ const { createNotebook } = useActions(notebooksModel)
+
+ useEffect(() => {
+ if (!nodeLogic) {
+ loadNotebooksContainingResource()
+ }
+ // oxlint-disable-next-line exhaustive-deps
+ }, [nodeLogic])
+
+ const containingCount = notebooksContainingResource.length
+ const triggerContent = (
+ <>
+ <IconNotebook />
+ Notebooks
+ {containingCount > 0 && <Badge>{containingCount}</Badge>}
+ </>
+ )
+
+ if (nodeLogic) {
+ return (
+ <Button
+ variant="outline"
+ tooltip="Add to notebook"
+ onClick={() => onNotebookOpened?.(nodeLogic.props.notebookLogic, nodeLogic)}
+ data-attr="notebooks-add-button-in-a-notebook"
+ >
+ {triggerContent}
+ </Button>
+ )
+ }
+
+ const openAndAddToNotebook = (notebook: NotebookListItemType, alreadyContainsResource: boolean): void =>
+ openNotebookForResource({
+ notebookShortId: notebook.short_id,
+ alreadyContainsResource,
+ resource,
+ onNotebookOpened,
+ })
+ const emptyList = searchQuery.length ? 'No matching notebooks' : undefined
+ const atLimit =
+ notebooksContainingResource.length >= NOTEBOOK_DROPDOWN_LIMIT ||
+ notebooksNotContainingResource.length >= NOTEBOOK_DROPDOWN_LIMIT
+
+ return (
+ <DropdownMenu
+ // The filter menu opens its own popup outside this menu, which a modal menu would block.
+ modal={false}
+ open={!!showPopover}
+ onOpenChange={(open) => {
+ setShowPopover(open)
+ if (open) {
+ loadAllNotebooks()
+ if (resource) {
+ loadNotebooksContainingResource()
+ }
+ }
+ }}
+ >
+ <DropdownMenuTrigger
+ render={<Button variant="outline" tooltip="Add to notebook" data-attr="notebooks-add-button" />}
+ >
+ {triggerContent}
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-80">
+ <div className="flex items-center gap-1 p-1">
+ <InputGroup size="sm" className="flex-1">
+ <InputGroupAddon align="inline-start">
+ <IconSearch />
+ </InputGroupAddon>
+ <InputGroupInput
+ placeholder="Filter notebooks..."
+ aria-label="Filter notebooks"
+ value={searchQuery}
+ onChange={(event) => setSearchQuery(event.target.value)}
+ onKeyDown={keepTypingInField}
+ autoFocus
+ />
+ </InputGroup>
+ <QuillNotebookFilterMenu createdBy={createdBy} setCreatedBy={setCreatedBy} />
+ </div>
+ <DropdownMenuGroup>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Notebook}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <DropdownMenuItem
+ onClick={() =>
+ createNotebookForResource({
+ resource,
+ newNotebookTitle,
+ createNotebook,
+ onNotebookOpened: (theNotebookLogic) => {
+ onNotebookOpened?.(theNotebookLogic)
+ loadNotebooksContainingResource()
+ },
+ })
+ }
+ data-attr="notebooks-select-button-create"
+ >
+ <IconPlus />
+ New notebook
+ </DropdownMenuItem>
+ </AccessControlAction>
+ <DropdownMenuItem
+ onClick={() =>
+ openNotebookForResource({
+ notebookShortId: 'scratchpad',
+ alreadyContainsResource: false,
+ resource,
+ onNotebookOpened,
+ })
+ }
+ >
+ <IconNotebook />
+ My scratchpad
+ </DropdownMenuItem>
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
+ {notebooksLoading && !notebooksContainingResource.length && !notebooksNotContainingResource.length ? (
+ <QuillNotebookMenuNote>Loading...</QuillNotebookMenuNote>
+ ) : (
+ <>
+ {resource ? (
+ <>
+ <DropdownMenuGroup>
+ <DropdownMenuLabel>Continue in</DropdownMenuLabel>
+ {notebooksContainingResource.length ? (
+ notebooksContainingResource.map((notebook) => (
+ <QuillNotebookMenuItem
+ key={notebook.short_id}
+ notebook={notebook}
+ onClick={() => openAndAddToNotebook(notebook, true)}
+ />
+ ))
+ ) : (
+ <QuillNotebookMenuNote>
+ {emptyList ?? 'Not already in any notebooks'}
+ </QuillNotebookMenuNote>
+ )}
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
+ </>
+ ) : null}
+ <DropdownMenuGroup>
+ {resource ? <DropdownMenuLabel>Add to</DropdownMenuLabel> : null}
+ {notebooksNotContainingResource.length ? (
+ notebooksNotContainingResource.map((notebook) => (
+ <QuillNotebookMenuItem
+ key={notebook.short_id}
+ notebook={notebook}
+ onClick={() => openAndAddToNotebook(notebook, false)}
+ />
+ ))
+ ) : (
+ <QuillNotebookMenuNote>
+ {emptyList ?? "You don't have any notebooks"}
+ </QuillNotebookMenuNote>
+ )}
+ </DropdownMenuGroup>
+ {atLimit && (
+ <QuillNotebookMenuNote>
+ Showing first {NOTEBOOK_DROPDOWN_LIMIT} results. Use search to narrow down.
+ </QuillNotebookMenuNote>
+ )}
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/frontend/src/scenes/notebooks/NotebookSelectButton/notebookSelectActions.ts b/frontend/src/scenes/notebooks/NotebookSelectButton/notebookSelectActions.ts
new file mode 100644
index 000000000000..7e824913e3e7
--- /dev/null
+++ b/frontend/src/scenes/notebooks/NotebookSelectButton/notebookSelectActions.ts
@@ -0,0 +1,51 @@
+import { BuiltLogic } from 'kea'
+
+import { dayjs } from 'lib/dayjs'
+
+import { type notebooksModelType, openNotebook } from '~/models/notebooksModel'
+
+import type { notebookLogicType } from '../Notebook/notebookLogic'
+import { NotebookNodeResource, NotebookTarget } from '../types'
+
+type OnNotebookOpened = (notebookLogic: BuiltLogic<notebookLogicType>) => void
+
+/** Opens a notebook in the popover, and adds the resource unless the notebook already holds it. */
+export function openNotebookForResource({
+ notebookShortId,
+ alreadyContainsResource,
+ resource,
+ onNotebookOpened,
+}: {
+ notebookShortId: string
+ alreadyContainsResource: boolean
+ resource?: NotebookNodeResource | boolean
+ onNotebookOpened?: OnNotebookOpened
+}): void {
+ void openNotebook(notebookShortId, NotebookTarget.Popover, (theNotebookLogic) => {
+ if (!alreadyContainsResource && resource) {
+ theNotebookLogic.actions.insertAfterLastNode([resource])
+ }
+ onNotebookOpened?.(theNotebookLogic)
+ })
+}
+
+/** Creates a notebook that starts with the resource, and opens it in the popover. */
+export function createNotebookForResource({
+ resource,
+ newNotebookTitle,
+ createNotebook,
+ onNotebookOpened,
+}: {
+ resource?: NotebookNodeResource | boolean
+ newNotebookTitle?: string
+ createNotebook: notebooksModelType['actions']['createNotebook']
+ onNotebookOpened?: OnNotebookOpened
+}): void {
+ const notebookResource = resource && typeof resource !== 'boolean' ? resource : null
+ createNotebook(
+ NotebookTarget.Popover,
+ newNotebookTitle ?? `Notes ${dayjs().format('DD/MM')}`,
+ notebookResource ? [notebookResource] : undefined,
+ onNotebookOpened
+ )
+}
diff --git a/frontend/src/scenes/notebooks/NotebooksScene.tsx b/frontend/src/scenes/notebooks/NotebooksScene.tsx
index 9e6a0ec28a5a..f5440ea797d8 100644
--- a/frontend/src/scenes/notebooks/NotebooksScene.tsx
+++ b/frontend/src/scenes/notebooks/NotebooksScene.tsx
@@ -2,10 +2,13 @@ import { useValues } from 'kea'
import { router } from 'kea-router'
import { LemonButton, LemonTabs } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { notebooksTableLogic } from 'scenes/notebooks/NotebooksTable/notebooksTableLogic'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -29,6 +32,7 @@ export const scene: SceneExport = {
export function NotebooksScene(): JSX.Element {
const { searchParams } = useValues(router)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const activeTab = searchParams.tab === 'widgets' ? 'widgets' : 'notebooks'
return (
@@ -50,15 +54,26 @@ export function NotebooksScene(): JSX.Element {
interaction="click"
scope={Scene.Notebooks}
>
- <LemonButton
- size="small"
- data-attr="new-notebook"
- to={urls.notebook('new')}
- type="primary"
- tooltip="New notebook"
- >
- New notebook
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ data-attr="new-notebook"
+ render={<LinkPrimitive to={urls.notebook('new')} />}
+ variant="primary"
+ tooltip="New notebook"
+ >
+ New notebook
+ </Button>
+ ) : (
+ <LemonButton
+ size="small"
+ data-attr="new-notebook"
+ to={urls.notebook('new')}
+ type="primary"
+ tooltip="New notebook"
+ >
+ New notebook
+ </LemonButton>
+ )}
</Shortcut>
</AccessControlAction>
}
diff --git a/frontend/src/scenes/notebooks/QuillNotebookCanvasActions.tsx b/frontend/src/scenes/notebooks/QuillNotebookCanvasActions.tsx
new file mode 100644
index 000000000000..5f30b8e8cfa6
--- /dev/null
+++ b/frontend/src/scenes/notebooks/QuillNotebookCanvasActions.tsx
@@ -0,0 +1,58 @@
+import { useActions } from 'kea'
+
+import { IconEllipsis } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@posthog/quill'
+
+import { copyToClipboard } from 'lib/utils/copyToClipboard'
+
+import { loadNotebookFromJSON } from './loadNotebookFromJSON'
+import { NotebookLogicProps, notebookLogic } from './Notebook/notebookLogic'
+
+export function QuillNotebookCanvasActions({ logicProps }: { logicProps: NotebookLogicProps }): JSX.Element {
+ const { duplicateNotebook, exportJSON, setLocalContent } = useActions(notebookLogic(logicProps))
+
+ return (
+ <>
+ <DropdownMenu>
+ <Tooltip>
+ <TooltipTrigger
+ delay={0}
+ render={<DropdownMenuTrigger render={<Button size="icon" aria-label="More actions" />} />}
+ >
+ <IconEllipsis />
+ </TooltipTrigger>
+ <TooltipContent>More actions</TooltipContent>
+ </Tooltip>
+ <DropdownMenuContent align="end" className="min-w-40">
+ <DropdownMenuItem onClick={() => setLocalContent({ type: 'doc', content: [] })}>
+ Clear canvas
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={() => exportJSON()}>Export as JSON</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => loadNotebookFromJSON(setLocalContent)}>
+ Load from JSON
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ <Button
+ variant="outline"
+ onClick={() => {
+ void copyToClipboard(window.location.href, 'Canvas URL')
+ }}
+ >
+ Share
+ </Button>
+ <Button variant="primary" onClick={duplicateNotebook}>
+ Save as Notebook
+ </Button>
+ </>
+ )
+}
diff --git a/frontend/src/scenes/notebooks/loadNotebookFromJSON.ts b/frontend/src/scenes/notebooks/loadNotebookFromJSON.ts
new file mode 100644
index 000000000000..0c386eaed871
--- /dev/null
+++ b/frontend/src/scenes/notebooks/loadNotebookFromJSON.ts
@@ -0,0 +1,26 @@
+import { lemonToast } from '@posthog/lemon-ui'
+
+import { JSONContent } from 'lib/components/RichContentEditor/types'
+import { getTextFromFile, selectFiles } from 'lib/utils/file-utils'
+
+export function loadNotebookFromJSON(setLocalContent: (jsonContent: JSONContent) => void): void {
+ void selectFiles({
+ contentType: 'application/json',
+ multiple: false,
+ })
+ .then(async (files) => {
+ if (!files.length) {
+ return
+ }
+ const text = await getTextFromFile(files[0])
+ const data = JSON.parse(text)
+ if (data.type !== 'doc') {
+ throw new Error('Not a notebook')
+ }
+ // Looks like a notebook
+ setLocalContent(data)
+ })
+ .catch((e) => {
+ lemonToast.error(e.message)
+ })
+}
diff --git a/frontend/src/scenes/onboarding/shared/sdkHealth/SdkHealthScene.tsx b/frontend/src/scenes/onboarding/shared/sdkHealth/SdkHealthScene.tsx
index 2a6160e25fd3..f9dc8bacc117 100644
--- a/frontend/src/scenes/onboarding/shared/sdkHealth/SdkHealthScene.tsx
+++ b/frontend/src/scenes/onboarding/shared/sdkHealth/SdkHealthScene.tsx
@@ -3,9 +3,12 @@ import posthog from 'posthog-js'
import { IconBell, IconRefresh } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonTag, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'
import { pluralize } from 'lib/utils/strings'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
@@ -36,6 +39,11 @@ export function SdkHealthScene(): JSX.Element {
const { isDev } = useValues(preflightLogic)
const { loadReport, snoozeSdkHealth, unsnooze } = useActions(sdkHealthLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ const trackAlertsClick = (): void => {
+ posthog.capture('health_alerts_entry_point_clicked', { source: 'sdk_health' })
+ }
useOnMountEffect(() => {
posthog.capture('sdk doctor loaded', { needsUpdatingCount })
@@ -73,29 +81,49 @@ export function SdkHealthScene(): JSX.Element {
type: 'sdk_health',
}}
actions={
- <>
- <LemonButton
- size="small"
- type="secondary"
- to={urls.healthAlerts(['sdk_outdated'])}
- onClick={() => {
- posthog.capture('health_alerts_entry_point_clicked', { source: 'sdk_health' })
- }}
- icon={<IconBell className="size-4" />}
- tooltip="Subscribe to alerts when SDKs go outdated"
- >
- Alerts
- </LemonButton>
- <LemonButton
- size="small"
- type="primary"
- disabledReason={loading ? 'Scan in progress' : undefined}
- onClick={scanEvents}
- icon={<IconRefresh className="size-4" />}
- >
- {loading ? 'Scanning events...' : 'Scan events'}
- </LemonButton>
- </>
+ todayRailNav ? (
+ <>
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={urls.healthAlerts(['sdk_outdated'])} />}
+ onClick={trackAlertsClick}
+ tooltip="Subscribe to alerts when SDKs go outdated"
+ >
+ <IconBell />
+ Alerts
+ </Button>
+ <Button
+ variant="primary"
+ disabledReason={loading ? 'Scan in progress' : undefined}
+ onClick={scanEvents}
+ >
+ <IconRefresh />
+ {loading ? 'Scanning events...' : 'Scan events'}
+ </Button>
+ </>
+ ) : (
+ <>
+ <LemonButton
+ size="small"
+ type="secondary"
+ to={urls.healthAlerts(['sdk_outdated'])}
+ onClick={trackAlertsClick}
+ icon={<IconBell className="size-4" />}
+ tooltip="Subscribe to alerts when SDKs go outdated"
+ >
+ Alerts
+ </LemonButton>
+ <LemonButton
+ size="small"
+ type="primary"
+ disabledReason={loading ? 'Scan in progress' : undefined}
+ onClick={scanEvents}
+ icon={<IconRefresh className="size-4" />}
+ >
+ {loading ? 'Scanning events...' : 'Scan events'}
+ </LemonButton>
+ </>
+ )
}
/>
diff --git a/frontend/src/scenes/product-tours/ProductTourEdit.tsx b/frontend/src/scenes/product-tours/ProductTourEdit.tsx
index 9b69709b2b3a..7536b18a735c 100644
--- a/frontend/src/scenes/product-tours/ProductTourEdit.tsx
+++ b/frontend/src/scenes/product-tours/ProductTourEdit.tsx
@@ -2,7 +2,9 @@ import { useActions, useValues } from 'kea'
import { Form } from 'kea-forms'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -11,6 +13,7 @@ import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { ProductTourStatusTag } from './components/ProductToursTable'
+import { QuillProductTourStatusBadge } from './components/QuillProductTourStatusBadge'
import { ProductTourStepsEditor } from './editor'
import { productTourLogic } from './productTourLogic'
@@ -26,6 +29,7 @@ export function ProductTourEdit({ id }: { id: string }): JSX.Element {
const { discardDraft, submitProductTourForm, setProductTourFormValue, openToolbarModal } = useActions(
productTourLogic({ id })
)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!productTour) {
return <LemonSkeleton />
@@ -47,34 +51,63 @@ export function ProductTourEdit({ id }: { id: string }): JSX.Element {
path: urls.productTour(id),
}}
actions={
- <div className="flex items-center gap-2">
- <ProductTourStatusTag
- tour={productTour}
- isEditing={isEditingProductTour}
- draftSaveStatus={draftSaveStatus}
- />
- <LemonButton type="secondary" size="small" onClick={() => openToolbarModal('preview')}>
- Preview
- </LemonButton>
- <LemonButton
- type="secondary"
- size="small"
- onClick={discardDraft}
- loading={draftActionInProgress === 'discard'}
- disabledReason={draftActionInProgress ? 'Discarding draft...' : undefined}
- >
- Cancel
- </LemonButton>
- <LemonButton
- type="primary"
- size="small"
- onClick={submitProductTourForm}
- loading={isProductTourFormSubmitting}
- disabledReason={draftActionInProgress ? 'Saving...' : undefined}
- >
- Save
- </LemonButton>
- </div>
+ todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ <QuillProductTourStatusBadge
+ tour={productTour}
+ isEditing={isEditingProductTour}
+ draftSaveStatus={draftSaveStatus}
+ />
+ <Button variant="outline" onClick={() => openToolbarModal('preview')}>
+ Preview
+ </Button>
+ <Button
+ variant="outline"
+ onClick={discardDraft}
+ loading={draftActionInProgress === 'discard'}
+ disabledReason={draftActionInProgress ? 'Discarding draft...' : undefined}
+ >
+ Cancel
+ </Button>
+ <Button
+ variant="primary"
+ onClick={submitProductTourForm}
+ loading={isProductTourFormSubmitting}
+ disabledReason={draftActionInProgress ? 'Saving...' : undefined}
+ >
+ Save
+ </Button>
+ </div>
+ ) : (
+ <div className="flex items-center gap-2">
+ <ProductTourStatusTag
+ tour={productTour}
+ isEditing={isEditingProductTour}
+ draftSaveStatus={draftSaveStatus}
+ />
+ <LemonButton type="secondary" size="small" onClick={() => openToolbarModal('preview')}>
+ Preview
+ </LemonButton>
+ <LemonButton
+ type="secondary"
+ size="small"
+ onClick={discardDraft}
+ loading={draftActionInProgress === 'discard'}
+ disabledReason={draftActionInProgress ? 'Discarding draft...' : undefined}
+ >
+ Cancel
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ size="small"
+ onClick={submitProductTourForm}
+ loading={isProductTourFormSubmitting}
+ disabledReason={draftActionInProgress ? 'Saving...' : undefined}
+ >
+ Save
+ </LemonButton>
+ </div>
+ )
}
/>
diff --git a/frontend/src/scenes/product-tours/ProductTourView.tsx b/frontend/src/scenes/product-tours/ProductTourView.tsx
index 5a898df15feb..3d99cdf0ccc1 100644
--- a/frontend/src/scenes/product-tours/ProductTourView.tsx
+++ b/frontend/src/scenes/product-tours/ProductTourView.tsx
@@ -2,7 +2,7 @@ import { BindLogic, useActions, useValues } from 'kea'
import { router } from 'kea-router'
import { useState } from 'react'
-import { IconCode, IconCursorClick, IconDocument, IconTrash } from '@posthog/icons'
+import { IconTrash } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonDialog, LemonDivider, LemonSelect, LemonTag } from '@posthog/lemon-ui'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
@@ -49,72 +49,10 @@ import {
} from '~/types'
import { ProductTourStatsSummary } from './components/ProductTourStatsSummary'
-import { LaunchValidationIssue, LaunchValidationIssueType, productTourLogic } from './productTourLogic'
+import { productTourDialogHandlers } from './productTourDialogHandlers'
+import { productTourLogic } from './productTourLogic'
import { getProductTourStatus, isAnnouncement, isProductTourRunning, productToursLogic } from './productToursLogic'
-
-const ISSUE_CONFIG: Record<
- LaunchValidationIssueType,
- { icon: JSX.Element; label: string; instruction: string; docsLink?: string }
-> = {
- missing_element: {
- icon: <IconCursorClick />,
- label: 'Missing target element',
- instruction:
- 'Click "Select element in Toolbar" to choose an element on your page, or "Remove element" to position the step as a simple pop-up.',
- docsLink: 'https://posthog.com/docs/product-tours/element-selection#automatic-element-targeting',
- },
- missing_selector: {
- icon: <IconCode />,
- label: 'Missing CSS selector',
- instruction:
- 'Enter a CSS selector in the step settings, or click "Remove element" to position the step as a simple pop-up.',
- docsLink: 'https://posthog.com/docs/product-tours/element-selection#manual-element-targeting',
- },
-}
-
-function formatStepList(stepNumbers: number[]): string {
- if (stepNumbers.length === 1) {
- return `Step ${stepNumbers[0]}`
- }
- return `Steps ${stepNumbers.slice(0, -1).join(', ')} and ${stepNumbers[stepNumbers.length - 1]}`
-}
-
-function LaunchValidationContent({ issues }: { issues: LaunchValidationIssue[] }): JSX.Element {
- return (
- <div className="flex flex-col gap-2">
- {issues.map((issue) => {
- const config = ISSUE_CONFIG[issue.type]
- return (
- <div
- key={issue.type}
- className="flex items-start gap-3 p-3 rounded-lg bg-warning-highlight border border-warning"
- >
- <span className="text-warning text-lg mt-0.5">{config.icon}</span>
- <div className="flex flex-col items-start gap-2">
- <div className="flex flex-col gap-0.5 text-sm">
- <span className="font-medium">
- {formatStepList(issue.stepNumbers)}: {config.label}
- </span>
- <span className="text-muted">{config.instruction}</span>
- </div>
- {config.docsLink && (
- <LemonButton
- size="small"
- type="primary"
- icon={<IconDocument />}
- targetBlank
- to={config.docsLink}
- >
- Read the docs
- </LemonButton>
- )}
- </div>
- </div>
- )
- })}
- </div>
- )
-}
+import { QuillProductTourViewActions } from './QuillProductTourViewActions'
export function ProductTourView({ id }: { id: string }): JSX.Element {
const {
@@ -140,6 +78,14 @@ export function ProductTourView({ id }: { id: string }): JSX.Element {
const [tabKey, setTabKey] = useState(() => (router.values.searchParams.activity ? 'history' : 'overview'))
const sceneMenuBarEnabled = useFeatureFlag('SCENE_MENU_BAR')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ const { handleLaunch, handleStop, handleResume } = productTourDialogHandlers({
+ launchValidationIssues,
+ editingProductTour,
+ launchProductTour,
+ stopProductTour,
+ resumeProductTour,
+ })
if (productTourLoading || !productTour) {
return <LemonSkeleton />
@@ -230,122 +176,33 @@ export function ProductTourView({ id }: { id: string }): JSX.Element {
resourceType={{ type: 'product_tour' }}
isLoading={productTourLoading}
actions={
- <>
- <LemonButton type="secondary" size="small" onClick={() => openToolbarModal('preview')}>
- Preview
- </LemonButton>
- <LemonButton type="secondary" size="small" onClick={() => editingProductTour(true)}>
- Edit
- </LemonButton>
- {status === ProgressStatus.Draft && (
- <LemonButton
- type="primary"
- size="small"
- onClick={() => {
- if (launchValidationIssues.length > 0) {
- LemonDialog.open({
- title: 'Tour not ready to launch',
- content: <LaunchValidationContent issues={launchValidationIssues} />,
- maxWidth: 600,
- primaryButton: {
- children: 'Edit tour',
- type: 'secondary',
- onClick: () => editingProductTour(true),
- size: 'small',
- },
- secondaryButton: {
- children: 'Cancel',
- type: 'tertiary',
- size: 'small',
- },
- })
- return
- }
- LemonDialog.open({
- title: 'Launch this product tour?',
- content: (
- <div className="text-sm text-secondary">
- The tour will immediately start displaying to users matching the display
- conditions.
- </div>
- ),
- primaryButton: {
- children: 'Launch',
- type: 'primary',
- onClick: launchProductTour,
- size: 'small',
- },
- secondaryButton: {
- children: 'Cancel',
- type: 'tertiary',
- size: 'small',
- },
- })
- }}
- >
- Launch
+ todayRailNav ? (
+ <QuillProductTourViewActions id={id} productTour={productTour} />
+ ) : (
+ <>
+ <LemonButton type="secondary" size="small" onClick={() => openToolbarModal('preview')}>
+ Preview
</LemonButton>
- )}
- {isRunning && (
- <LemonButton
- type="secondary"
- status="danger"
- size="small"
- onClick={() => {
- LemonDialog.open({
- title: 'Stop this product tour?',
- content: (
- <div className="text-sm text-secondary">
- The tour will no longer be displayed to users.
- </div>
- ),
- primaryButton: {
- children: 'Stop',
- type: 'primary',
- onClick: stopProductTour,
- size: 'small',
- },
- secondaryButton: {
- children: 'Cancel',
- type: 'tertiary',
- size: 'small',
- },
- })
- }}
- >
- Stop
+ <LemonButton type="secondary" size="small" onClick={() => editingProductTour(true)}>
+ Edit
</LemonButton>
- )}
- {status === ProgressStatus.Complete && !productTour.archived && (
- <LemonButton
- type="secondary"
- size="small"
- onClick={() => {
- LemonDialog.open({
- title: 'Resume this product tour?',
- content: (
- <div className="text-sm text-secondary">
- Once resumed, the tour will be visible to your users again.
- </div>
- ),
- primaryButton: {
- children: 'Resume',
- type: 'primary',
- onClick: resumeProductTour,
- size: 'small',
- },
- secondaryButton: {
- children: 'Cancel',
- type: 'tertiary',
- size: 'small',
- },
- })
- }}
- >
- Resume
- </LemonButton>
- )}
- </>
+ {status === ProgressStatus.Draft && (
+ <LemonButton type="primary" size="small" onClick={handleLaunch}>
+ Launch
+ </LemonButton>
+ )}
+ {isRunning && (
+ <LemonButton type="secondary" status="danger" size="small" onClick={handleStop}>
+ Stop
+ </LemonButton>
+ )}
+ {status === ProgressStatus.Complete && !productTour.archived && (
+ <LemonButton type="secondary" size="small" onClick={handleResume}>
+ Resume
+ </LemonButton>
+ )}
+ </>
+ )
}
/>
diff --git a/frontend/src/scenes/product-tours/ProductTours.tsx b/frontend/src/scenes/product-tours/ProductTours.tsx
index 02bf10ee1f13..c3e288bd19b6 100644
--- a/frontend/src/scenes/product-tours/ProductTours.tsx
+++ b/frontend/src/scenes/product-tours/ProductTours.tsx
@@ -2,8 +2,10 @@ import { useActions, useValues } from 'kea'
import { useState } from 'react'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { sceneConfigurations } from 'scenes/scenes'
@@ -31,14 +33,26 @@ function NewTourButton(): JSX.Element {
const { productTours } = useValues(productToursLogic)
const { createAnnouncement, createBanner, createTour } = useActions(productToursLogic)
const [isModalOpen, setIsModalOpen] = useState(false)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const existingTourNames = new Set(productTours.map((tour) => tour.name).filter(Boolean))
return (
<>
- <LemonButton size="small" type="primary" onClick={() => setIsModalOpen(true)} data-attr="new-product-tour">
- New
- </LemonButton>
+ {todayRailNav ? (
+ <Button variant="primary" onClick={() => setIsModalOpen(true)} data-attr="new-product-tour">
+ New
+ </Button>
+ ) : (
+ <LemonButton
+ size="small"
+ type="primary"
+ onClick={() => setIsModalOpen(true)}
+ data-attr="new-product-tour"
+ >
+ New
+ </LemonButton>
+ )}
<NewProductTourModal
isOpen={isModalOpen}
onClose={() => setIsModalOpen(false)}
diff --git a/frontend/src/scenes/product-tours/QuillProductTourViewActions.tsx b/frontend/src/scenes/product-tours/QuillProductTourViewActions.tsx
new file mode 100644
index 000000000000..f047b3a5ed7b
--- /dev/null
+++ b/frontend/src/scenes/product-tours/QuillProductTourViewActions.tsx
@@ -0,0 +1,59 @@
+import { useActions, useValues } from 'kea'
+
+import { Button } from '@posthog/quill'
+
+import { ProductTour, ProgressStatus } from '~/types'
+
+import { productTourDialogHandlers } from './productTourDialogHandlers'
+import { productTourLogic } from './productTourLogic'
+import { getProductTourStatus, isProductTourRunning } from './productToursLogic'
+
+export function QuillProductTourViewActions({
+ id,
+ productTour,
+}: {
+ id: string
+ productTour: ProductTour
+}): JSX.Element {
+ const { launchValidationIssues } = useValues(productTourLogic({ id }))
+ const { editingProductTour, launchProductTour, stopProductTour, resumeProductTour, openToolbarModal } = useActions(
+ productTourLogic({ id })
+ )
+
+ const { handleLaunch, handleStop, handleResume } = productTourDialogHandlers({
+ launchValidationIssues,
+ editingProductTour,
+ launchProductTour,
+ stopProductTour,
+ resumeProductTour,
+ })
+
+ const status = getProductTourStatus(productTour)
+ const isRunning = isProductTourRunning(productTour)
+
+ return (
+ <>
+ <Button variant="outline" onClick={() => openToolbarModal('preview')}>
+ Preview
+ </Button>
+ <Button variant="outline" onClick={() => editingProductTour(true)}>
+ Edit
+ </Button>
+ {status === ProgressStatus.Draft && (
+ <Button variant="primary" onClick={handleLaunch}>
+ Launch
+ </Button>
+ )}
+ {isRunning && (
+ <Button variant="destructive-outline" onClick={handleStop}>
+ Stop
+ </Button>
+ )}
+ {status === ProgressStatus.Complete && !productTour.archived && (
+ <Button variant="outline" onClick={handleResume}>
+ Resume
+ </Button>
+ )}
+ </>
+ )
+}
diff --git a/frontend/src/scenes/product-tours/components/LaunchValidationContent.tsx b/frontend/src/scenes/product-tours/components/LaunchValidationContent.tsx
new file mode 100644
index 000000000000..dc1d6c072925
--- /dev/null
+++ b/frontend/src/scenes/product-tours/components/LaunchValidationContent.tsx
@@ -0,0 +1,68 @@
+import { IconCode, IconCursorClick, IconDocument } from '@posthog/icons'
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { LaunchValidationIssue, LaunchValidationIssueType } from '../productTourLogic'
+
+const ISSUE_CONFIG: Record<
+ LaunchValidationIssueType,
+ { icon: JSX.Element; label: string; instruction: string; docsLink?: string }
+> = {
+ missing_element: {
+ icon: <IconCursorClick />,
+ label: 'Missing target element',
+ instruction:
+ 'Click "Select element in Toolbar" to choose an element on your page, or "Remove element" to position the step as a simple pop-up.',
+ docsLink: 'https://posthog.com/docs/product-tours/element-selection#automatic-element-targeting',
+ },
+ missing_selector: {
+ icon: <IconCode />,
+ label: 'Missing CSS selector',
+ instruction:
+ 'Enter a CSS selector in the step settings, or click "Remove element" to position the step as a simple pop-up.',
+ docsLink: 'https://posthog.com/docs/product-tours/element-selection#manual-element-targeting',
+ },
+}
+
+function formatStepList(stepNumbers: number[]): string {
+ if (stepNumbers.length === 1) {
+ return `Step ${stepNumbers[0]}`
+ }
+ return `Steps ${stepNumbers.slice(0, -1).join(', ')} and ${stepNumbers[stepNumbers.length - 1]}`
+}
+
+export function LaunchValidationContent({ issues }: { issues: LaunchValidationIssue[] }): JSX.Element {
+ return (
+ <div className="flex flex-col gap-2">
+ {issues.map((issue) => {
+ const config = ISSUE_CONFIG[issue.type]
+ return (
+ <div
+ key={issue.type}
+ className="flex items-start gap-3 p-3 rounded-lg bg-warning-highlight border border-warning"
+ >
+ <span className="text-warning text-lg mt-0.5">{config.icon}</span>
+ <div className="flex flex-col items-start gap-2">
+ <div className="flex flex-col gap-0.5 text-sm">
+ <span className="font-medium">
+ {formatStepList(issue.stepNumbers)}: {config.label}
+ </span>
+ <span className="text-muted">{config.instruction}</span>
+ </div>
+ {config.docsLink && (
+ <LemonButton
+ size="small"
+ type="primary"
+ icon={<IconDocument />}
+ targetBlank
+ to={config.docsLink}
+ >
+ Read the docs
+ </LemonButton>
+ )}
+ </div>
+ </div>
+ )
+ })}
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/product-tours/components/QuillProductTourStatusBadge.tsx b/frontend/src/scenes/product-tours/components/QuillProductTourStatusBadge.tsx
new file mode 100644
index 000000000000..925467a2b5d7
--- /dev/null
+++ b/frontend/src/scenes/product-tours/components/QuillProductTourStatusBadge.tsx
@@ -0,0 +1,36 @@
+import { IconCheckCircle, IconCircleDashed } from '@posthog/icons'
+import { Badge, Spinner } from '@posthog/quill'
+
+import { ProductTour, ProgressStatus } from '~/types'
+
+import { getProductTourStatus } from '../productToursLogic'
+
+const STATUS_CONFIG: Record<ProgressStatus, { label: string; variant: 'success' | 'default' | 'completed' }> = {
+ [ProgressStatus.Draft]: { label: 'Draft', variant: 'default' },
+ [ProgressStatus.Running]: { label: 'Running', variant: 'success' },
+ [ProgressStatus.Complete]: { label: 'Complete', variant: 'completed' },
+}
+
+export function QuillProductTourStatusBadge({
+ tour,
+ isEditing,
+ draftSaveStatus,
+}: {
+ tour: ProductTour
+ isEditing?: boolean
+ draftSaveStatus?: 'unsaved' | 'saving' | 'saved' | null
+}): JSX.Element {
+ const config = STATUS_CONFIG[getProductTourStatus(tour)]
+ return (
+ <Badge variant={config.variant}>
+ {isEditing && (
+ <>
+ {draftSaveStatus === 'unsaved' && <IconCircleDashed />}
+ {draftSaveStatus === 'saving' && <Spinner />}
+ {draftSaveStatus === 'saved' && <IconCheckCircle className="text-success" />}
+ </>
+ )}
+ {config.label}
+ </Badge>
+ )
+}
diff --git a/frontend/src/scenes/product-tours/productTourDialogHandlers.tsx b/frontend/src/scenes/product-tours/productTourDialogHandlers.tsx
new file mode 100644
index 000000000000..faff6ab6b0fe
--- /dev/null
+++ b/frontend/src/scenes/product-tours/productTourDialogHandlers.tsx
@@ -0,0 +1,105 @@
+import { LemonDialog } from '@posthog/lemon-ui'
+
+import { LaunchValidationContent } from './components/LaunchValidationContent'
+import { LaunchValidationIssue } from './productTourLogic'
+
+export function productTourDialogHandlers({
+ launchValidationIssues,
+ editingProductTour,
+ launchProductTour,
+ stopProductTour,
+ resumeProductTour,
+}: {
+ launchValidationIssues: LaunchValidationIssue[]
+ editingProductTour: (editing: boolean) => void
+ launchProductTour: () => void
+ stopProductTour: () => void
+ resumeProductTour: () => void
+}): {
+ handleLaunch: () => void
+ handleStop: () => void
+ handleResume: () => void
+} {
+ const handleLaunch = (): void => {
+ if (launchValidationIssues.length > 0) {
+ LemonDialog.open({
+ title: 'Tour not ready to launch',
+ content: <LaunchValidationContent issues={launchValidationIssues} />,
+ maxWidth: 600,
+ primaryButton: {
+ children: 'Edit tour',
+ type: 'secondary',
+ onClick: () => editingProductTour(true),
+ size: 'small',
+ },
+ secondaryButton: {
+ children: 'Cancel',
+ type: 'tertiary',
+ size: 'small',
+ },
+ })
+ return
+ }
+ LemonDialog.open({
+ title: 'Launch this product tour?',
+ content: (
+ <div className="text-sm text-secondary">
+ The tour will immediately start displaying to users matching the display conditions.
+ </div>
+ ),
+ primaryButton: {
+ children: 'Launch',
+ type: 'primary',
+ onClick: launchProductTour,
+ size: 'small',
+ },
+ secondaryButton: {
+ children: 'Cancel',
+ type: 'tertiary',
+ size: 'small',
+ },
+ })
+ }
+
+ const handleStop = (): void => {
+ LemonDialog.open({
+ title: 'Stop this product tour?',
+ content: <div className="text-sm text-secondary">The tour will no longer be displayed to users.</div>,
+ primaryButton: {
+ children: 'Stop',
+ type: 'primary',
+ onClick: stopProductTour,
+ size: 'small',
+ },
+ secondaryButton: {
+ children: 'Cancel',
+ type: 'tertiary',
+ size: 'small',
+ },
+ })
+ }
+
+ const handleResume = (): void => {
+ LemonDialog.open({
+ title: 'Resume this product tour?',
+ content: (
+ <div className="text-sm text-secondary">
+ Once resumed, the tour will be visible to your users again.
+ </div>
+ ),
+ primaryButton: {
+ children: 'Resume',
+ type: 'primary',
+ onClick: resumeProductTour,
+ size: 'small',
+ },
+ secondaryButton: {
+ children: 'Cancel',
+ type: 'tertiary',
+ size: 'small',
+ },
+ })
+ }
+
+ return { handleLaunch, handleStop, handleResume }
+}
diff --git a/frontend/src/scenes/project-homepage/today/TodayActionButton.tsx b/frontend/src/scenes/project-homepage/today/TodayActionButton.tsx
deleted file mode 100644
index 18038a2507c0..000000000000
--- a/frontend/src/scenes/project-homepage/today/TodayActionButton.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import type { ComponentProps } from 'react'
-
-import { Button, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'
-
-type TodayActionButtonProps = ComponentProps<typeof Button> & {
- disabledReason?: string | null
- tooltip?: string
-}
-
-export function TodayActionButton({
- disabledReason,
- tooltip,
- disabled,
- ...props
-}: TodayActionButtonProps): JSX.Element {
- const label = disabledReason || tooltip
- const button = <Button {...props} disabled={disabled || !!disabledReason} />
- if (!label) {
- return button
- }
- return (
- <Tooltip>
- <TooltipTrigger render={button} delay={props.size?.startsWith('icon') ? 0 : undefined} />
- <TooltipContent>{label}</TooltipContent>
- </Tooltip>
- )
-}
diff --git a/frontend/src/scenes/project-homepage/today/TodayImplementMenu.tsx b/frontend/src/scenes/project-homepage/today/TodayImplementMenu.tsx
index 9ae2119d3d75..f9e80f22a923 100644
--- a/frontend/src/scenes/project-homepage/today/TodayImplementMenu.tsx
+++ b/frontend/src/scenes/project-homepage/today/TodayImplementMenu.tsx
@@ -15,7 +15,6 @@ import { captureInboxReportAction } from 'products/signals/frontend/inbox/inboxA
import { inboxTaskKickoffLogic } from 'products/signals/frontend/inbox/inboxTaskKickoffLogic'
import { SignalReport } from 'products/signals/frontend/inbox/types'
-import { TodayActionButton } from './TodayActionButton'
import { reportWorkKind, reportWorkPrompt } from './todayNextStep'
import { todayReportLogic } from './todayReportLogic'
@@ -59,14 +58,14 @@ export function TodayImplementMenu({
if (disabledReason) {
return (
- <TodayActionButton
+ <Button
variant="primary"
className="me-1 gap-1.5"
disabledReason={disabledReason}
data-attr="today-report-implement-with"
>
{label}
- </TodayActionButton>
+ </Button>
)
}
diff --git a/frontend/src/scenes/project-homepage/today/TodayReportFeedback.tsx b/frontend/src/scenes/project-homepage/today/TodayReportFeedback.tsx
index a079b59c74d3..efdab52724c7 100644
--- a/frontend/src/scenes/project-homepage/today/TodayReportFeedback.tsx
+++ b/frontend/src/scenes/project-homepage/today/TodayReportFeedback.tsx
@@ -3,14 +3,12 @@ import { useActions, useValues } from 'kea'
import { type ChangeEvent, type KeyboardEvent, useState } from 'react'
import { IconThumbsDown, IconThumbsDownFilled, IconThumbsUp, IconThumbsUpFilled, IconX } from '@posthog/icons'
-import { Text, Textarea } from '@posthog/quill'
+import { Button, Text, Textarea } from '@posthog/quill'
import { useReportFeedbackCelebration } from 'products/signals/frontend/inbox/components/detail/ReportFeedbackCelebration'
import { inboxReportDetailLogic } from 'products/signals/frontend/inbox/logics/inboxReportDetailLogic'
import { SignalReport } from 'products/signals/frontend/inbox/types'
-import { TodayActionButton } from './TodayActionButton'
-
const NOTE_MAX_LENGTH = 4000
export function TodayReportFeedback({ report }: { report: SignalReport }): JSX.Element {
@@ -55,7 +53,7 @@ export function TodayReportFeedback({ report }: { report: SignalReport }): JSX.E
</span>
</Text>
<span className="relative inline-flex">
- <TodayActionButton
+ <Button
size="icon-sm"
aria-label="This report was useful"
aria-pressed={isPositive}
@@ -69,10 +67,10 @@ export function TodayReportFeedback({ report }: { report: SignalReport }): JSX.E
data-attr="today-report-feedback-up"
>
{isPositive ? <IconThumbsUpFilled /> : <IconThumbsUp />}
- </TodayActionButton>
+ </Button>
{celebration}
</span>
- <TodayActionButton
+ <Button
size="icon-sm"
aria-label="This report was not useful"
aria-pressed={isNegative}
@@ -86,7 +84,7 @@ export function TodayReportFeedback({ report }: { report: SignalReport }): JSX.E
data-attr="today-report-feedback-down"
>
{isNegative ? <IconThumbsDownFilled /> : <IconThumbsDown />}
- </TodayActionButton>
+ </Button>
</div>
{/* The question lives under the row so it never pushes the thumbs sideways. */}
{askingWhy && (
@@ -98,14 +96,14 @@ export function TodayReportFeedback({ report }: { report: SignalReport }): JSX.E
<Text size="xs" weight="medium" render={<span />} className="grow">
{isPositive ? 'What made it useful?' : 'What was off?'}
</Text>
- <TodayActionButton
+ <Button
size="icon-sm"
aria-label="Dismiss"
onClick={() => setQuestionDismissed(true)}
data-attr="today-report-feedback-question-dismiss"
>
<IconX />
- </TodayActionButton>
+ </Button>
</div>
<div className="flex items-end gap-1.5">
<Textarea
@@ -130,7 +128,7 @@ export function TodayReportFeedback({ report }: { report: SignalReport }): JSX.E
/>
{/* Shown only once there is text, so there is never a disabled button to look at. */}
{feedbackNoteDraft.trim() && (
- <TodayActionButton
+ <Button
variant="primary"
size="sm"
loading={feedbackNoteSubmitting}
@@ -138,7 +136,7 @@ export function TodayReportFeedback({ report }: { report: SignalReport }): JSX.E
data-attr="today-report-feedback-note-send"
>
Send
- </TodayActionButton>
+ </Button>
)}
</div>
</div>
diff --git a/frontend/src/scenes/project-homepage/today/TodayReportHeader.tsx b/frontend/src/scenes/project-homepage/today/TodayReportHeader.tsx
index d58914e863a6..18d54a6cdefb 100644
--- a/frontend/src/scenes/project-homepage/today/TodayReportHeader.tsx
+++ b/frontend/src/scenes/project-homepage/today/TodayReportHeader.tsx
@@ -15,7 +15,6 @@ import { todayShellLogic } from '~/layout/today/todayShellLogic'
import { SignalReport } from 'products/signals/frontend/inbox/types'
import { hasOpenImplementationPr } from 'products/signals/frontend/inbox/utils/reportActions'
-import { TodayActionButton } from './TodayActionButton'
import { TodayEvidenceAge } from './TodayEvidenceAge'
import { TodayMarkedText } from './TodayMarkedText'
import { resolveDisabledReason } from './todayNextStep'
@@ -161,21 +160,20 @@ export function TodayReportHeader({ report }: { report: SignalReport }): JSX.Ele
) : (
<div className="-mx-2 flex shrink-0 items-center gap-0.5">
{!isSample && (
- <TodayActionButton
+ <Button
size="sm"
variant="link-muted"
- nativeButton={false}
render={<LinkPrimitive to={urls.inboxReport('reports', report.id)} />}
tooltip="Open the full report in the Inbox"
data-attr="today-report-open-inbox"
>
<IconDocument />
Full report
- </TodayActionButton>
+ </Button>
)}
{stateBadge ?? (
<>
- <TodayActionButton
+ <Button
size="sm"
variant="link-muted"
onClick={() => giveVerdict('resolve')}
@@ -185,8 +183,8 @@ export function TodayReportHeader({ report }: { report: SignalReport }): JSX.Ele
>
<IconCheckCircle />
Resolve
- </TodayActionButton>
- <TodayActionButton
+ </Button>
+ <Button
size="sm"
variant="link-muted"
onClick={() => giveVerdict('dismiss')}
@@ -196,7 +194,7 @@ export function TodayReportHeader({ report }: { report: SignalReport }): JSX.Ele
>
<IconHide />
Dismiss
- </TodayActionButton>
+ </Button>
</>
)}
</div>
diff --git a/frontend/src/scenes/project-homepage/today/TodayReportNextStep.tsx b/frontend/src/scenes/project-homepage/today/TodayReportNextStep.tsx
index 04eca38482be..b2f4eaa60903 100644
--- a/frontend/src/scenes/project-homepage/today/TodayReportNextStep.tsx
+++ b/frontend/src/scenes/project-homepage/today/TodayReportNextStep.tsx
@@ -2,7 +2,7 @@ import { useActions, useValues } from 'kea'
import { useRef } from 'react'
import { IconClock, IconPullRequest, IconSparkles } from '@posthog/icons'
-import { Text } from '@posthog/quill'
+import { Button, Text } from '@posthog/quill'
import { LinkPrimitive } from 'lib/lemon-ui/Link'
@@ -14,7 +14,6 @@ import type {
} from 'products/signals/frontend/inbox/logics/inboxReportDetailLogic'
import { SignalReport } from 'products/signals/frontend/inbox/types'
-import { TodayActionButton } from './TodayActionButton'
import { TodayImplementMenu } from './TodayImplementMenu'
import { TodayPrimaryAction, startDisabledReason, todayNextStep } from './todayNextStep'
import { todayReportLogic } from './todayReportLogic'
@@ -36,22 +35,21 @@ function PrimaryAction({
const { openReportTask } = useActions(inboxTaskKickoffLogic)
if (primary.kind === 'review') {
return (
- <TodayActionButton
+ <Button
variant="primary"
className="me-1"
- nativeButton={false}
render={<LinkPrimitive to={primary.url} target="_blank" />}
disabledReason={isSample ? SAMPLE_REPORT_REASON : null}
data-attr="today-report-review-pr"
>
<IconPullRequest />
<span>{primary.label}</span>
- </TodayActionButton>
+ </Button>
)
}
if (primary.kind === 'open_task') {
return (
- <TodayActionButton
+ <Button
variant="primary"
className="me-1"
onClick={() => openReportTask(report, primary.taskId, primary.runId)}
@@ -59,7 +57,7 @@ function PrimaryAction({
>
<IconClock />
<span>{primary.label}</span>
- </TodayActionButton>
+ </Button>
)
}
return (
@@ -124,7 +122,7 @@ export function TodayReportNextStep({
})}
/>
)}
- <TodayActionButton
+ <Button
className={primary ? undefined : '-ms-2'}
onClick={focusComposer}
disabledReason={askDisabledReason}
@@ -132,7 +130,7 @@ export function TodayReportNextStep({
>
<IconSparkles />
Ask about it
- </TodayActionButton>
+ </Button>
</div>
{note && (
<Text size="xs" render={<p />} className="flex items-center gap-1.5">
diff --git a/frontend/src/scenes/session-recordings/SessionRecordings.tsx b/frontend/src/scenes/session-recordings/SessionRecordings.tsx
index b458998a30f0..4af97c47c070 100644
--- a/frontend/src/scenes/session-recordings/SessionRecordings.tsx
+++ b/frontend/src/scenes/session-recordings/SessionRecordings.tsx
@@ -5,6 +5,7 @@ import { useState } from 'react'
import { IconDocument, IconGear, IconHeadset } from '@posthog/icons'
import { LemonButton, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { PostHogCaptureOnViewed } from '@posthog/react'
import { isAccessDeniedError, shouldReportApiFailure } from 'lib/api-error'
@@ -16,6 +17,7 @@ import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { lemonBannerLogic } from 'lib/lemon-ui/LemonBanner/lemonBannerLogic'
import { LemonTab, LemonTabs } from 'lib/lemon-ui/LemonTabs'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { cn } from 'lib/utils/css-classes'
@@ -48,6 +50,7 @@ function Header(): JSX.Element {
const { currentTeam } = useValues(teamLogic)
const recordingsDisabled = currentTeam && !currentTeam?.session_recording_opt_in
const [loading, setLoading] = useState(false)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const handleNewPlaylist = async (): Promise<void> => {
setLoading(true)
try {
@@ -112,29 +115,52 @@ function Header(): JSX.Element {
interaction="click"
scope={Scene.Replay}
>
- <LemonButton
- type="primary"
- onClick={handleNewPlaylist}
- data-attr="save-recordings-playlist-button"
- loading={loading}
- size="small"
- tooltip="New collection"
- >
- New collection
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ onClick={handleNewPlaylist}
+ data-attr="save-recordings-playlist-button"
+ loading={loading}
+ tooltip="New collection"
+ >
+ New collection
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ onClick={handleNewPlaylist}
+ data-attr="save-recordings-playlist-button"
+ loading={loading}
+ size="small"
+ tooltip="New collection"
+ >
+ New collection
+ </LemonButton>
+ )}
</Shortcut>
</AccessControlAction>
)}
- <LemonButton
- icon={<IconGear />}
- type="secondary"
- size="small"
- to={urls.replaySettings()}
- data-attr="session-recordings-settings-button"
- >
- Settings
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={urls.replaySettings()} />}
+ data-attr="session-recordings-settings-button"
+ >
+ <IconGear />
+ Settings
+ </Button>
+ ) : (
+ <LemonButton
+ icon={<IconGear />}
+ type="secondary"
+ size="small"
+ to={urls.replaySettings()}
+ data-attr="session-recordings-settings-button"
+ >
+ Settings
+ </LemonButton>
+ )}
</div>
)
}
diff --git a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistScene.tsx b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistScene.tsx
index e997c804f8d7..2022f01a5527 100644
--- a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistScene.tsx
+++ b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistScene.tsx
@@ -4,6 +4,7 @@ import { useEffect, useMemo } from 'react'
import { IconCopy, IconPlus, IconTrash } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { SceneDuplicate } from 'lib/components/Scenes/SceneDuplicate'
@@ -13,6 +14,7 @@ import { SceneMetalyticsSummaryButton } from 'lib/components/Scenes/SceneMetalyt
import { ScenePin } from 'lib/components/Scenes/ScenePin'
import { SceneActivityIndicator } from 'lib/components/Scenes/SceneUpdateActivityInfo'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useFileSystemLogView } from 'lib/hooks/useFileSystemLogView'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -85,6 +87,7 @@ export function SessionRecordingsPlaylistScene(): JSX.Element {
const { setShowFilters } = useActions(playerSettingsLogic)
const { featureFlags } = useValues(featureFlagLogic)
const sceneMenuBarEnabled = !!featureFlags[FEATURE_FLAGS.SCENE_MENU_BAR]
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const isNewPlaylist = useMemo(() => {
if (!playlist || playlistLoading) {
@@ -210,7 +213,28 @@ export function SessionRecordingsPlaylistScene(): JSX.Element {
saveOnBlur
renameDebounceMs={100}
actions={
- playlist.is_synthetic ? undefined : playlist.type === 'collection' ? (
+ playlist.is_synthetic ? undefined : todayRailNav ? (
+ playlist.type === 'collection' ? (
+ <Button
+ variant="primary"
+ onClick={() => setAddRecordingsModalOpen(true)}
+ data-attr="collection-add-recordings"
+ >
+ <IconPlus />
+ Add recordings
+ </Button>
+ ) : (
+ <Button
+ data-attr="collection-save-or-show-filters"
+ variant="primary"
+ disabledReason={showFilters && !hasChanges ? 'No changes to save' : undefined}
+ loading={hasChanges && playlistLoading}
+ onClick={() => (showFilters ? updatePlaylist() : setShowFilters(!showFilters))}
+ >
+ {showFilters ? <>Save changes</> : <>Edit</>}
+ </Button>
+ )
+ ) : playlist.type === 'collection' ? (
<LemonButton
type="primary"
size="small"
diff --git a/frontend/src/scenes/sessions/SessionProfileScene.tsx b/frontend/src/scenes/sessions/SessionProfileScene.tsx
index f88b6d439cd1..54239248aa0b 100644
--- a/frontend/src/scenes/sessions/SessionProfileScene.tsx
+++ b/frontend/src/scenes/sessions/SessionProfileScene.tsx
@@ -2,10 +2,12 @@ import { BindLogic, useActions, useValues } from 'kea'
import { IconRefresh } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'
import { NotFound } from 'lib/components/NotFound'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { SpinnerOverlay } from 'lib/lemon-ui/Spinner/Spinner'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
@@ -33,6 +35,7 @@ export function SessionProfileScene(): JSX.Element {
const { sessionId, sessionData, isInitialLoading, sessionDataLoading, sessionEventsLoading } =
useValues(sessionProfileLogic)
const { loadSessionData } = useActions(sessionProfileLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!sessionData && !isInitialLoading) {
return <NotFound object="session" />
@@ -55,15 +58,26 @@ export function SessionProfileScene(): JSX.Element {
key: 'sessions',
}}
actions={
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconRefresh />}
- onClick={() => loadSessionData()}
- loading={sessionDataLoading || sessionEventsLoading}
- >
- Refresh
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="outline"
+ onClick={() => loadSessionData()}
+ loading={sessionDataLoading || sessionEventsLoading}
+ >
+ <IconRefresh />
+ Refresh
+ </Button>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconRefresh />}
+ onClick={() => loadSessionData()}
+ loading={sessionDataLoading || sessionEventsLoading}
+ >
+ Refresh
+ </LemonButton>
+ )
}
/>
diff --git a/frontend/src/scenes/surveys/SurveyEdit.tsx b/frontend/src/scenes/surveys/SurveyEdit.tsx
index 6e575121ed18..e200ceef98a3 100644
--- a/frontend/src/scenes/surveys/SurveyEdit.tsx
+++ b/frontend/src/scenes/surveys/SurveyEdit.tsx
@@ -21,6 +21,7 @@ import {
Link,
Popover,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import api from 'lib/api'
import { FlagSelector } from 'lib/components/FlagSelector'
@@ -29,8 +30,10 @@ import { PropertyValue } from 'lib/components/PropertyFilters/components/Propert
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { LemonRadio, LemonRadioOption } from 'lib/lemon-ui/LemonRadio'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic'
import { formatDate } from 'lib/utils/datetime'
@@ -308,6 +311,7 @@ export default function SurveyEdit({ id }: { id: string }): JSX.Element {
} = useActions(surveyLogic)
const { setPreferredEditor } = useActions(surveysLogic)
const { featureFlags } = useValues(enabledFeaturesLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const surveyTranslationsEnabled = !!featureFlags[FEATURE_FLAGS.SURVEYS_TRANSLATIONS]
const hostedEditorEnabled = !!featureFlags[FEATURE_FLAGS.SURVEYS_HOSTED_EDITOR]
const canConvertToHosted = hostedEditorEnabled && survey.type !== SurveyType.ExternalSurvey
@@ -466,53 +470,94 @@ export default function SurveyEdit({ id }: { id: string }): JSX.Element {
renameDebounceMs={0}
forceEdit
actions={
- <>
- {canUseSurveyWizard(survey) && (
+ todayRailNav ? (
+ <>
+ {canUseSurveyWizard(survey) && (
+ <Button
+ data-attr="switch-to-wizard"
+ render={<LinkPrimitive to={urls.surveyWizard(id)} />}
+ onClick={() => setPreferredEditor('guided')}
+ >
+ Guided editor
+ </Button>
+ )}
+ {canConvertToHosted && (
+ <Button data-attr="convert-to-hosted-survey" onClick={convertToHostedSurvey}>
+ Convert to hosted
+ </Button>
+ )}
+ <Button
+ data-attr="cancel-survey"
+ variant="outline"
+ loading={surveyLoading}
+ onClick={handleCancelClick}
+ >
+ Cancel
+ </Button>
+ <Button
+ variant="primary"
+ data-attr="save-survey"
+ type="submit"
+ loading={surveyLoading}
+ form="survey"
+ disabledReason={
+ hasVisibleTranslationValidationErrors
+ ? 'Cannot save: please fix translation validation errors below'
+ : undefined
+ }
+ >
+ {id === 'new' ? 'Save as draft' : 'Save'}
+ </Button>
+ </>
+ ) : (
+ <>
+ {canUseSurveyWizard(survey) && (
+ <LemonButton
+ data-attr="switch-to-wizard"
+ type="tertiary"
+ size="small"
+ to={urls.surveyWizard(id)}
+ onClick={() => setPreferredEditor('guided')}
+ >
+ Guided editor
+ </LemonButton>
+ )}
+ {canConvertToHosted && (
+ <LemonButton
+ data-attr="convert-to-hosted-survey"
+ type="tertiary"
+ size="small"
+ onClick={convertToHostedSurvey}
+ >
+ Convert to hosted
+ </LemonButton>
+ )}
<LemonButton
- data-attr="switch-to-wizard"
- type="tertiary"
+ data-attr="cancel-survey"
+ type="secondary"
+ loading={surveyLoading}
+ onClick={handleCancelClick}
size="small"
- to={urls.surveyWizard(id)}
- onClick={() => setPreferredEditor('guided')}
>
- Guided editor
+ Cancel
</LemonButton>
- )}
- {canConvertToHosted && (
<LemonButton
- data-attr="convert-to-hosted-survey"
- type="tertiary"
+ type="primary"
+ data-attr="save-survey"
+ htmlType="submit"
+ loading={surveyLoading}
+ form="survey"
size="small"
- onClick={convertToHostedSurvey}
+ disabledReason={
+ hasVisibleTranslationValidationErrors
+ ? 'Cannot save: please fix translation validation errors below'
+ : undefined
+ }
>
- Convert to hosted
+ {id === 'new' ? 'Save as draft' : 'Save'}
</LemonButton>
- )}
- <LemonButton
- data-attr="cancel-survey"
- type="secondary"
- loading={surveyLoading}
- onClick={handleCancelClick}
- size="small"
- >
- Cancel
- </LemonButton>
- <LemonButton
- type="primary"
- data-attr="save-survey"
- htmlType="submit"
- loading={surveyLoading}
- form="survey"
- size="small"
- disabledReason={
- hasVisibleTranslationValidationErrors
- ? 'Cannot save: please fix translation validation errors below'
- : undefined
- }
- >
- {id === 'new' ? 'Save as draft' : 'Save'}
- </LemonButton>
- </>
+ </>
+ )
}
/>
<SurveyPublicContentNotice />
diff --git a/frontend/src/scenes/surveys/SurveyViewRedesign/QuillSurveyStatusAction.tsx b/frontend/src/scenes/surveys/SurveyViewRedesign/QuillSurveyStatusAction.tsx
new file mode 100644
index 000000000000..947a3ed5d7d6
--- /dev/null
+++ b/frontend/src/scenes/surveys/SurveyViewRedesign/QuillSurveyStatusAction.tsx
@@ -0,0 +1,55 @@
+import { useActions, useValues } from 'kea'
+
+import { Button } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { QuillLaunchSurveyButton } from 'scenes/surveys/components/QuillLaunchSurveyButton'
+import { openResumeSurveyDialog, openStopSurveyDialog } from 'scenes/surveys/surveyDialogs'
+import { surveyLogic } from 'scenes/surveys/surveyLogic'
+import { getSurveyStatus } from 'scenes/surveys/surveysLogic'
+
+import { AccessControlLevel, AccessControlResourceType, ProgressStatus } from '~/types'
+
+export function QuillSurveyStatusAction(): JSX.Element | null {
+ const { survey } = useValues(surveyLogic)
+ const { stopSurvey, resumeSurvey } = useActions(surveyLogic)
+ const status = getSurveyStatus(survey)
+
+ if (status === ProgressStatus.Draft) {
+ return <QuillLaunchSurveyButton />
+ }
+
+ if (survey.archived) {
+ return null
+ }
+
+ if (status === ProgressStatus.Complete) {
+ return (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Survey}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={survey.user_access_level}
+ >
+ <Button variant="outline" onClick={() => openResumeSurveyDialog(survey, () => resumeSurvey())}>
+ Resume
+ </Button>
+ </AccessControlAction>
+ )
+ }
+
+ return (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Survey}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={survey.user_access_level}
+ >
+ <Button
+ data-attr="stop-survey"
+ variant="destructive-outline"
+ onClick={() => openStopSurveyDialog(() => stopSurvey())}
+ >
+ Stop
+ </Button>
+ </AccessControlAction>
+ )
+}
diff --git a/frontend/src/scenes/surveys/SurveyViewRedesign/SurveyViewRedesign.tsx b/frontend/src/scenes/surveys/SurveyViewRedesign/SurveyViewRedesign.tsx
index 145ae3129b0b..970962532435 100644
--- a/frontend/src/scenes/surveys/SurveyViewRedesign/SurveyViewRedesign.tsx
+++ b/frontend/src/scenes/surveys/SurveyViewRedesign/SurveyViewRedesign.tsx
@@ -3,7 +3,8 @@ import { router } from 'kea-router'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { IconArchive, IconCode, IconCopy, IconDownload, IconTrash } from '@posthog/icons'
-import { LemonButton, LemonDialog, LemonDivider, LemonTag, Tooltip } from '@posthog/lemon-ui'
+import { LemonButton, LemonDivider, LemonTag, Tooltip } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
@@ -16,6 +17,7 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { userHasAccess } from 'lib/utils/accessControlUtils'
@@ -33,6 +35,7 @@ import {
openArchiveSurveyDialog,
openDeleteSurveyDialog,
openResumeSurveyDialog,
+ openStopSurveyDialog,
} from 'scenes/surveys/surveyDialogs'
import { SurveyHeadline } from 'scenes/surveys/SurveyHeadline'
import { SurveyTab, surveyLogic } from 'scenes/surveys/surveyLogic'
@@ -77,6 +80,7 @@ import { SurveyResponseColumnsMenu } from 'products/surveys/frontend/components/
import { SurveyResultsRefreshStatus } from '../components/SurveyResultsRefreshStatus'
import { NEW_SURVEY } from '../constants'
+import { QuillSurveyStatusAction } from './QuillSurveyStatusAction'
import { SurveyDraftContent } from './SurveyDraftContent'
import { SurveyResultsFiltersBar } from './SurveyFilters'
import { SurveyResponseExpandedRow } from './SurveyResponseExpandedRow'
@@ -108,6 +112,7 @@ export function SurveyViewRedesign(): JSX.Element {
const [sqlHelperOpen, setSqlHelperOpen] = useState(false)
const autoOpenedDraftPanelForSurveyIdRef = useRef<string | null>(null)
const isRemovingSidePanel = useFeatureFlag('UX_REMOVE_SIDEPANEL')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const panelTabSearchParam = 'survey_panel_tab'
const panelTabs = useMemo(
@@ -437,23 +442,38 @@ export function SurveyViewRedesign(): JSX.Element {
minAccessLevel={AccessControlLevel.Editor}
userAccessLevel={survey.user_access_level}
>
- <LemonButton
- data-attr="edit-survey"
- onClick={
- canUseSurveyWizard(survey) && preferredEditor === 'guided'
- ? undefined
- : () => editingSurvey(true)
- }
- to={
- canUseSurveyWizard(survey) && preferredEditor === 'guided'
- ? urls.surveyWizard(survey.id)
- : undefined
- }
- type="secondary"
- size="small"
- >
- Edit
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ data-attr="edit-survey"
+ variant="outline"
+ {...(canUseSurveyWizard(survey) && preferredEditor === 'guided'
+ ? {
+ nativeButton: false,
+ render: <LinkPrimitive to={urls.surveyWizard(survey.id)} />,
+ }
+ : { onClick: () => editingSurvey(true) })}
+ >
+ Edit
+ </Button>
+ ) : (
+ <LemonButton
+ data-attr="edit-survey"
+ onClick={
+ canUseSurveyWizard(survey) && preferredEditor === 'guided'
+ ? undefined
+ : () => editingSurvey(true)
+ }
+ to={
+ canUseSurveyWizard(survey) && preferredEditor === 'guided'
+ ? urls.surveyWizard(survey.id)
+ : undefined
+ }
+ type="secondary"
+ size="small"
+ >
+ Edit
+ </LemonButton>
+ )}
</AccessControlAction>
<SurveyStatusAction />
</>
@@ -536,6 +556,10 @@ function SurveyNotificationsContent(): JSX.Element {
function SurveyStatusAction(): JSX.Element | null {
const { survey } = useValues(surveyLogic)
const { stopSurvey, resumeSurvey } = useActions(surveyLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillSurveyStatusAction />
+ }
const status = getSurveyStatus(survey)
if (status === ProgressStatus.Draft) {
@@ -575,27 +599,7 @@ function SurveyStatusAction(): JSX.Element | null {
type="secondary"
status="danger"
size="small"
- onClick={() => {
- LemonDialog.open({
- title: 'Stop this survey?',
- content: (
- <div className="text-sm text-secondary">
- The survey will no longer be displayed to users.
- </div>
- ),
- primaryButton: {
- children: 'Stop',
- type: 'primary',
- onClick: () => stopSurvey(),
- size: 'small',
- },
- secondaryButton: {
- children: 'Cancel',
- type: 'tertiary',
- size: 'small',
- },
- })
- }}
+ onClick={() => openStopSurveyDialog(() => stopSurvey())}
>
Stop
</LemonButton>
diff --git a/frontend/src/scenes/surveys/Surveys.tsx b/frontend/src/scenes/surveys/Surveys.tsx
index 59e32b2dd1d9..9c8a6f78167f 100644
--- a/frontend/src/scenes/surveys/Surveys.tsx
+++ b/frontend/src/scenes/surveys/Surveys.tsx
@@ -1,12 +1,15 @@
import { useActions, useValues } from 'kea'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { SurveyFeedbackButton } from 'scenes/surveys/components/SurveyFeedbackButton'
@@ -35,6 +38,7 @@ export const scene: SceneExport = {
function NewSurveyButton(): JSX.Element {
const { addProductIntent } = useActions(surveysLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const trackAddNewClick = (): void => {
addProductIntent({
@@ -52,16 +56,28 @@ function NewSurveyButton(): JSX.Element {
interaction="click"
scope={Scene.Surveys}
>
- <LemonButton
- size="small"
- to={urls.surveyWizard()}
- type="primary"
- data-attr="new-survey"
- tooltip="New survey"
- onClick={trackAddNewClick}
- >
- New survey
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.surveyWizard()} />}
+ data-attr="new-survey"
+ tooltip="New survey"
+ onClick={trackAddNewClick}
+ >
+ New survey
+ </Button>
+ ) : (
+ <LemonButton
+ size="small"
+ to={urls.surveyWizard()}
+ type="primary"
+ data-attr="new-survey"
+ tooltip="New survey"
+ onClick={trackAddNewClick}
+ >
+ New survey
+ </LemonButton>
+ )}
</Shortcut>
</AccessControlAction>
)
diff --git a/frontend/src/scenes/surveys/components/LaunchSurveyButton.tsx b/frontend/src/scenes/surveys/components/LaunchSurveyButton.tsx
index a09fcdb0db41..247a6d1aeffb 100644
--- a/frontend/src/scenes/surveys/components/LaunchSurveyButton.tsx
+++ b/frontend/src/scenes/surveys/components/LaunchSurveyButton.tsx
@@ -1,27 +1,19 @@
import { useActions, useValues } from 'kea'
import { ReactNode } from 'react'
-import { LemonButton, LemonDialog } from '@posthog/lemon-ui'
+import { LemonButton } from '@posthog/lemon-ui'
import { AccessControlAction } from 'lib/components/AccessControlAction'
-import { copyToClipboard } from 'lib/utils/copyToClipboard'
-import { HostedSurveyRespondentHint } from 'scenes/surveys/components/HostedSurveyRespondentHint'
-import { SdkVersionWarnings } from 'scenes/surveys/components/SdkVersionWarnings'
-import { SurveyConditionsList } from 'scenes/surveys/components/SurveyConditions'
-import { SurveysDisabledLaunchWarning } from 'scenes/surveys/components/SurveysDisabledLaunchWarning'
-import { getSurveyUrl } from 'scenes/surveys/CopySurveyLink'
import { surveyLogic } from 'scenes/surveys/surveyLogic'
-import { getSurveyDisplayConditionsSummary } from 'scenes/surveys/utils'
-import { AccessControlLevel, AccessControlResourceType, SurveyType } from '~/types'
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { openLaunchSurveyDialog } from './launchSurveyDialog'
export function LaunchSurveyButton({ children = 'Launch' }: { children?: ReactNode }): JSX.Element {
const { survey, surveyWarnings } = useValues(surveyLogic)
const { launchSurvey } = useActions(surveyLogic)
- const isHostedSurvey = survey.type === SurveyType.ExternalSurvey
- const conditionsSummary = isHostedSurvey ? [] : getSurveyDisplayConditionsSummary(survey)
-
return (
<AccessControlAction
resourceType={AccessControlResourceType.Survey}
@@ -32,53 +24,7 @@ export function LaunchSurveyButton({ children = 'Launch' }: { children?: ReactNo
type="primary"
data-attr="launch-survey"
size="small"
- onClick={() => {
- LemonDialog.open({
- title: 'Launch this survey?',
- content: (
- <div className="flex flex-col gap-3">
- <SdkVersionWarnings warnings={surveyWarnings} />
- {isHostedSurvey ? (
- <div className="flex flex-col gap-3 text-sm">
- <p className="text-secondary m-0">
- Once launched, anyone with the link can answer the survey. We'll copy the
- link to your clipboard so you can share it right away.
- </p>
- <HostedSurveyRespondentHint />
- </div>
- ) : conditionsSummary.length > 0 ? (
- <div className="text-sm">
- <div className="text-secondary mb-1">
- This survey will be shown to users who match:
- </div>
- <SurveyConditionsList conditions={conditionsSummary} />
- </div>
- ) : (
- <div className="text-sm text-secondary">
- This survey will be shown to all users.
- </div>
- )}
- <SurveysDisabledLaunchWarning surveyType={survey.type} />
- </div>
- ),
- primaryButton: {
- children: isHostedSurvey ? 'Launch and copy link' : 'Launch',
- type: 'primary',
- onClick: () => {
- if (isHostedSurvey) {
- void copyToClipboard(getSurveyUrl(survey.id), 'survey link')
- }
- launchSurvey()
- },
- size: 'small',
- },
- secondaryButton: {
- children: 'Cancel',
- type: 'tertiary',
- size: 'small',
- },
- })
- }}
+ onClick={() => openLaunchSurveyDialog({ survey, surveyWarnings, launchSurvey })}
>
{children}
</LemonButton>
diff --git a/frontend/src/scenes/surveys/components/QuillLaunchSurveyButton.tsx b/frontend/src/scenes/surveys/components/QuillLaunchSurveyButton.tsx
new file mode 100644
index 000000000000..cf1f2fb3aa6c
--- /dev/null
+++ b/frontend/src/scenes/surveys/components/QuillLaunchSurveyButton.tsx
@@ -0,0 +1,32 @@
+import { useActions, useValues } from 'kea'
+import { ReactNode } from 'react'
+
+import { Button } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { surveyLogic } from 'scenes/surveys/surveyLogic'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { openLaunchSurveyDialog } from './launchSurveyDialog'
+
+export function QuillLaunchSurveyButton({ children = 'Launch' }: { children?: ReactNode }): JSX.Element {
+ const { survey, surveyWarnings } = useValues(surveyLogic)
+ const { launchSurvey } = useActions(surveyLogic)
+
+ return (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Survey}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={survey.user_access_level}
+ >
+ <Button
+ variant="primary"
+ data-attr="launch-survey"
+ onClick={() => openLaunchSurveyDialog({ survey, surveyWarnings, launchSurvey })}
+ >
+ {children}
+ </Button>
+ </AccessControlAction>
+ )
+}
diff --git a/frontend/src/scenes/surveys/components/QuillSurveyFeedbackButton.tsx b/frontend/src/scenes/surveys/components/QuillSurveyFeedbackButton.tsx
new file mode 100644
index 000000000000..2719d11a1840
--- /dev/null
+++ b/frontend/src/scenes/surveys/components/QuillSurveyFeedbackButton.tsx
@@ -0,0 +1,9 @@
+import { Button } from '@posthog/quill'
+
+export function QuillSurveyFeedbackButton(): JSX.Element {
+ return (
+ <Button id="surveys-page-feedback-button" tooltip="Have any questions or feedback?">
+ Feedback
+ </Button>
+ )
+}
diff --git a/frontend/src/scenes/surveys/components/SurveyFeedbackButton.tsx b/frontend/src/scenes/surveys/components/SurveyFeedbackButton.tsx
index b9981bd569c0..64b31efc33b5 100644
--- a/frontend/src/scenes/surveys/components/SurveyFeedbackButton.tsx
+++ b/frontend/src/scenes/surveys/components/SurveyFeedbackButton.tsx
@@ -1,10 +1,19 @@
import { LemonButton } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+
+import { QuillSurveyFeedbackButton } from './QuillSurveyFeedbackButton'
+
/**
* This button does not have any logic attached to it, as that's added using a survey from PostHog.
* On prod, the survey is https://us.posthog.com/project/2/surveys/0196afd4-6617-0000-0bbf-8b0db5b160f9
*/
export function SurveyFeedbackButton(): JSX.Element {
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillSurveyFeedbackButton />
+ }
+
return (
<LemonButton size="small" id="surveys-page-feedback-button" tooltip="Have any questions or feedback?">
Feedback
diff --git a/frontend/src/scenes/surveys/components/launchSurveyDialog.tsx b/frontend/src/scenes/surveys/components/launchSurveyDialog.tsx
new file mode 100644
index 000000000000..b5ae1fa25f90
--- /dev/null
+++ b/frontend/src/scenes/surveys/components/launchSurveyDialog.tsx
@@ -0,0 +1,68 @@
+import { LemonDialog } from '@posthog/lemon-ui'
+
+import { copyToClipboard } from 'lib/utils/copyToClipboard'
+import { HostedSurveyRespondentHint } from 'scenes/surveys/components/HostedSurveyRespondentHint'
+import { SdkVersionWarnings } from 'scenes/surveys/components/SdkVersionWarnings'
+import { SurveyConditionsList } from 'scenes/surveys/components/SurveyConditions'
+import { SurveysDisabledLaunchWarning } from 'scenes/surveys/components/SurveysDisabledLaunchWarning'
+import { NewSurvey } from 'scenes/surveys/constants'
+import { getSurveyUrl } from 'scenes/surveys/CopySurveyLink'
+import { SurveyFeatureWarning } from 'scenes/surveys/surveyVersionRequirements'
+import { getSurveyDisplayConditionsSummary } from 'scenes/surveys/utils'
+
+import { Survey, SurveyType } from '~/types'
+
+export function openLaunchSurveyDialog({
+ survey,
+ surveyWarnings,
+ launchSurvey,
+}: {
+ survey: Survey | NewSurvey
+ surveyWarnings: SurveyFeatureWarning[]
+ launchSurvey: () => void
+}): void {
+ const isHostedSurvey = survey.type === SurveyType.ExternalSurvey
+ const conditionsSummary = isHostedSurvey ? [] : getSurveyDisplayConditionsSummary(survey)
+
+ LemonDialog.open({
+ title: 'Launch this survey?',
+ content: (
+ <div className="flex flex-col gap-3">
+ <SdkVersionWarnings warnings={surveyWarnings} />
+ {isHostedSurvey ? (
+ <div className="flex flex-col gap-3 text-sm">
+ <p className="text-secondary m-0">
+ Once launched, anyone with the link can answer the survey. We'll copy the link to your
+ clipboard so you can share it right away.
+ </p>
+ <HostedSurveyRespondentHint />
+ </div>
+ ) : conditionsSummary.length > 0 ? (
+ <div className="text-sm">
+ <div className="text-secondary mb-1">This survey will be shown to users who match:</div>
+ <SurveyConditionsList conditions={conditionsSummary} />
+ </div>
+ ) : (
+ <div className="text-sm text-secondary">This survey will be shown to all users.</div>
+ )}
+ <SurveysDisabledLaunchWarning surveyType={survey.type} />
+ </div>
+ ),
+ primaryButton: {
+ children: isHostedSurvey ? 'Launch and copy link' : 'Launch',
+ type: 'primary',
+ onClick: () => {
+ if (isHostedSurvey) {
+ void copyToClipboard(getSurveyUrl(survey.id), 'survey link')
+ }
+ launchSurvey()
+ },
+ size: 'small',
+ },
+ secondaryButton: {
+ children: 'Cancel',
+ type: 'tertiary',
+ size: 'small',
+ },
+ })
+}
diff --git a/frontend/src/scenes/surveys/surveyDialogs.tsx b/frontend/src/scenes/surveys/surveyDialogs.tsx
index f373b4aaadd5..0e78b749b9ee 100644
--- a/frontend/src/scenes/surveys/surveyDialogs.tsx
+++ b/frontend/src/scenes/surveys/surveyDialogs.tsx
@@ -108,6 +108,24 @@ export function openResumeSurveyDialog(survey: Pick<Survey, 'id' | 'type'>, onCo
})
}
+export function openStopSurveyDialog(onConfirm: () => void): void {
+ LemonDialog.open({
+ title: 'Stop this survey?',
+ content: <div className="text-sm text-secondary">The survey will no longer be displayed to users.</div>,
+ primaryButton: {
+ children: 'Stop',
+ type: 'primary',
+ onClick: onConfirm,
+ size: 'small',
+ },
+ secondaryButton: {
+ children: 'Cancel',
+ type: 'tertiary',
+ size: 'small',
+ },
+ })
+}
+
export function canDeleteSurvey(survey: Pick<Survey, 'archived' | 'start_date'>): boolean {
return survey.archived || !survey.start_date
}
diff --git a/frontend/src/scenes/themes/CustomCssScene.tsx b/frontend/src/scenes/themes/CustomCssScene.tsx
index 8f59210ce1fc..7128e1c3798e 100644
--- a/frontend/src/scenes/themes/CustomCssScene.tsx
+++ b/frontend/src/scenes/themes/CustomCssScene.tsx
@@ -3,7 +3,9 @@ import { router } from 'kea-router'
import { IconWrench } from '@posthog/icons'
import { LemonButton, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { CodeEditor } from 'lib/monaco/CodeEditor'
import { SceneExport } from 'scenes/sceneTypes'
@@ -86,11 +88,17 @@ body[theme=light] {
export function CustomCssScene(): JSX.Element {
const { persistedCustomCss, previewingCustomCss } = useValues(themeLogic)
const { saveCustomCss, setPreviewingCustomCss } = useActions(themeLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
useOnMountEffect(() => {
setPreviewingCustomCss(previewingCustomCss || persistedCustomCss || '')
})
+ const saveAndSet = (): void => {
+ saveCustomCss()
+ router.actions.push(urls.projectRoot())
+ }
+
const onPreview = (): void => {
router.actions.push(urls.projectRoot())
}
@@ -104,21 +112,25 @@ export function CustomCssScene(): JSX.Element {
forceIcon: <IconWrench />,
}}
actions={
- <>
- <LemonButton type="secondary" onClick={onPreview} size="small">
- Preview
- </LemonButton>
- <LemonButton
- type="primary"
- onClick={() => {
- saveCustomCss()
- router.actions.push(urls.projectRoot())
- }}
- size="small"
- >
- Save and set
- </LemonButton>
- </>
+ todayRailNav ? (
+ <>
+ <Button variant="outline" onClick={onPreview}>
+ Preview
+ </Button>
+ <Button variant="primary" onClick={saveAndSet}>
+ Save and set
+ </Button>
+ </>
+ ) : (
+ <>
+ <LemonButton type="secondary" onClick={onPreview} size="small">
+ Preview
+ </LemonButton>
+ <LemonButton type="primary" onClick={saveAndSet} size="small">
+ Save and set
+ </LemonButton>
+ </>
+ )
}
/>
<p>
diff --git a/frontend/src/scenes/web-analytics/WebAnalyticsHeaderButtons.tsx b/frontend/src/scenes/web-analytics/WebAnalyticsHeaderButtons.tsx
index d6a0e8f16834..a3871d5f01cf 100644
--- a/frontend/src/scenes/web-analytics/WebAnalyticsHeaderButtons.tsx
+++ b/frontend/src/scenes/web-analytics/WebAnalyticsHeaderButtons.tsx
@@ -3,9 +3,11 @@ import posthog from 'posthog-js'
import { useState } from 'react'
import { IconBolt, IconPerson } from '@posthog/icons'
+import { Button, Switch } from '@posthog/quill'
import { LiveUserCount } from 'lib/components/LiveUserCount'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconLink } from 'lib/lemon-ui/icons'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonSwitch } from 'lib/lemon-ui/LemonSwitch'
@@ -23,6 +25,7 @@ export function WebAnalyticsHeaderButtons(): JSX.Element {
const { shouldFilterTestAccounts } = useValues(webAnalyticsLogic)
const { setShouldFilterTestAccounts } = useActions(webAnalyticsLogic)
const [showPopover, setShowPopover] = useState(false)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const hasFeatureFlag = featureFlags[FEATURE_FLAGS.SETTINGS_WEB_ANALYTICS_PRE_AGGREGATED_TABLES]
const isUsingNewEngine = currentTeam?.modifiers?.useWebAnalyticsPreAggregatedTables
@@ -53,30 +56,64 @@ export function WebAnalyticsHeaderButtons(): JSX.Element {
dataAttr="web-analytics-live-user-count"
/>
)}
- {showShareButton && (
+ {showShareButton &&
+ (todayRailNav ? (
+ <Button
+ variant="outline"
+ size="icon"
+ aria-label="Share"
+ tooltip="Share"
+ onClick={handleShare}
+ data-attr="web-analytics-share-button"
+ >
+ <IconLink />
+ </Button>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconLink fontSize="16" />}
+ tooltip="Share"
+ tooltipPlacement="top"
+ onClick={handleShare}
+ data-attr="web-analytics-share-button"
+ />
+ ))}
+ {todayRailNav ? (
+ <Button
+ variant="outline"
+ tooltip="Filter out internal and test users"
+ onClick={() => setShouldFilterTestAccounts(!shouldFilterTestAccounts)}
+ data-attr="web-analytics-filter-test-accounts"
+ aria-label="Filter test accounts"
+ aria-pressed={shouldFilterTestAccounts}
+ >
+ <IconPerson />
+ <span className="hidden @min-[30rem]/main-content:inline">Filter test accounts</span>
+ {/* Decorative: the button owns the toggle, so the switch must not take clicks or focus. */}
+ <Switch
+ checked={shouldFilterTestAccounts}
+ size="sm"
+ tabIndex={-1}
+ aria-hidden
+ className="pointer-events-none ml-1"
+ />
+ </Button>
+ ) : (
<LemonButton
type="secondary"
size="small"
- icon={<IconLink fontSize="16" />}
- tooltip="Share"
+ icon={<IconPerson />}
+ tooltip="Filter out internal and test users"
tooltipPlacement="top"
- onClick={handleShare}
- data-attr="web-analytics-share-button"
- />
+ onClick={() => setShouldFilterTestAccounts(!shouldFilterTestAccounts)}
+ data-attr="web-analytics-filter-test-accounts"
+ aria-label="Filter test accounts"
+ >
+ <span className="hidden @min-[30rem]/main-content:inline">Filter test accounts</span>
+ <LemonSwitch checked={shouldFilterTestAccounts} className="ml-1" />
+ </LemonButton>
)}
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconPerson />}
- tooltip="Filter out internal and test users"
- tooltipPlacement="top"
- onClick={() => setShouldFilterTestAccounts(!shouldFilterTestAccounts)}
- data-attr="web-analytics-filter-test-accounts"
- aria-label="Filter test accounts"
- >
- <span className="hidden @min-[30rem]/main-content:inline">Filter test accounts</span>
- <LemonSwitch checked={shouldFilterTestAccounts} className="ml-1" />
- </LemonButton>
{hasFeatureFlag && (
<Popover
visible={showPopover}
diff --git a/frontend/src/styles/base.scss b/frontend/src/styles/base.scss
index 245b42c7910c..6042859d90fd 100644
--- a/frontend/src/styles/base.scss
+++ b/frontend/src/styles/base.scss
@@ -1241,9 +1241,10 @@
visibility: visible;
}
- a:focus-visible,
- button:focus-visible,
- [data-highlighted]:not(:hover) {
+ // Quill controls draw their own focus ring, so the Lemon accent outline must not stack on them.
+ a:focus-visible:not([data-quill]),
+ button:focus-visible:not([data-quill]),
+ [data-highlighted]:not(:hover, [data-quill]) {
outline: 2px solid var(--color-accent);
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 97c87e803e24..ad4ef7dde2b2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -2351,6 +2351,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@storybook/react':
specifier: 'catalog:'
@@ -2396,6 +2399,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -2547,6 +2553,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -2590,6 +2599,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@testing-library/dom':
specifier: '*'
version: 10.4.0
@@ -2637,6 +2649,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -2714,6 +2729,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@testing-library/dom':
specifier: '*'
version: 10.4.0
@@ -2763,6 +2781,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -2889,6 +2910,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/react':
specifier: 'catalog:'
@@ -3050,6 +3074,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -3102,6 +3129,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -3229,6 +3259,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -3278,6 +3311,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@testing-library/dom':
specifier: '*'
version: 10.4.0
@@ -3429,6 +3465,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@storybook/react':
specifier: 'catalog:'
@@ -3469,6 +3508,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -3515,6 +3557,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -3570,6 +3615,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -3675,6 +3723,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@testing-library/dom':
specifier: '*'
version: 10.4.0
@@ -3738,6 +3789,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@testing-library/jest-dom':
specifier: '*'
version: 5.17.0
@@ -3814,6 +3868,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/react':
specifier: 'catalog:'
@@ -3903,6 +3960,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@storybook/react':
specifier: 'catalog:'
@@ -3967,6 +4027,9 @@ importers:
'@posthog/products-error-tracking':
specifier: workspace:*
version: link:../error_tracking
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -4058,6 +4121,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -4124,6 +4190,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -4230,6 +4299,9 @@ importers:
'@posthog/products-error-tracking':
specifier: workspace:*
version: link:../error_tracking
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -4304,6 +4376,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@testing-library/dom':
specifier: '*'
version: 10.4.0
@@ -4362,6 +4437,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -4611,6 +4689,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -4644,6 +4725,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -4681,6 +4765,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -4899,6 +4986,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -4987,6 +5077,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -5011,6 +5104,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/react':
specifier: 'catalog:'
@@ -5069,6 +5165,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -5171,6 +5270,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
@@ -5228,6 +5330,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/react':
specifier: 'catalog:'
@@ -5274,6 +5379,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@storybook/react':
specifier: 'catalog:'
@@ -5324,6 +5432,9 @@ importers:
'@posthog/lemon-ui':
specifier: '*'
version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@storybook/react':
specifier: 'catalog:'
@@ -5450,6 +5561,9 @@ importers:
'@posthog/icons':
specifier: 'catalog:'
+ '@posthog/quill':
+ specifier: workspace:*
+ version: link:../../packages/quill/packages/quill
'@posthog/quill-charts':
specifier: workspace:*
version: link:../../packages/quill/packages/charts
diff --git a/products/actions/frontend/components/NewActionButton.tsx b/products/actions/frontend/components/NewActionButton.tsx
index d927106ba62e..922cb0ffe3b5 100644
--- a/products/actions/frontend/components/NewActionButton.tsx
+++ b/products/actions/frontend/components/NewActionButton.tsx
@@ -3,6 +3,7 @@ import { IconCursorClick, IconPencil } from '@posthog/icons'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { Link } from 'lib/lemon-ui/Link'
import { Scene } from 'scenes/sceneTypes'
@@ -10,7 +11,13 @@ import { urls } from 'scenes/urls'
import { AccessControlLevel, AccessControlResourceType } from '~/types'
+import { QuillNewActionButton } from './QuillNewActionButton'
+
export function NewActionButton({ onSelectOption }: { onSelectOption?: () => void }): JSX.Element {
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillNewActionButton onSelectOption={onSelectOption} />
+ }
return (
<AccessControlAction resourceType={AccessControlResourceType.Action} minAccessLevel={AccessControlLevel.Editor}>
<Shortcut
diff --git a/products/actions/frontend/components/QuillNewActionButton.tsx b/products/actions/frontend/components/QuillNewActionButton.tsx
new file mode 100644
index 000000000000..a367f8af0ec9
--- /dev/null
+++ b/products/actions/frontend/components/QuillNewActionButton.tsx
@@ -0,0 +1,131 @@
+import { IconChevronDown, IconCursorClick, IconPencil } from '@posthog/icons'
+import {
+ Button,
+ ButtonGroup,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { Scene } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+export function QuillNewActionButton({ onSelectOption }: { onSelectOption?: () => void }): JSX.Element {
+ const disabledReason = getAccessControlDisabledReason(AccessControlResourceType.Action, AccessControlLevel.Editor)
+
+ return (
+ <ButtonGroup>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Action}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Shortcut
+ name="NewAction"
+ keybind={[keyBinds.new]}
+ intent="New action"
+ interaction="click"
+ scope={Scene.Actions}
+ >
+ <Button
+ variant="primary"
+ render={
+ <LinkPrimitive
+ to={disabledReason ? undefined : urls.createAction()}
+ onClick={onSelectOption}
+ />
+ }
+ data-attr="create-action"
+ tooltip="New action"
+ >
+ New action
+ </Button>
+ </Shortcut>
+ </AccessControlAction>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="primary"
+ size="icon"
+ aria-label="More ways to create an action"
+ disabledReason={disabledReason}
+ />
+ }
+ >
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-80">
+ <DropdownMenuItem
+ render={
+ <Button
+ size="row"
+ left
+ render={
+ <LinkPrimitive
+ to={disabledReason ? undefined : urls.createAction()}
+ onClick={onSelectOption}
+ />
+ }
+ />
+ }
+ data-attr="new-action-pageview"
+ description={
+ <>
+ Match events by name, URL patterns, or custom properties.{' '}
+ <Button
+ variant="link"
+ size="inline"
+ render={
+ <LinkPrimitive
+ to="https://posthog.com/docs/data/actions"
+ target="_blank"
+ onClick={(e) => e.stopPropagation()}
+ />
+ }
+ >
+ Learn more
+ </Button>
+ </>
+ }
+ >
+ <IconPencil />
+ From event or pageview
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ render={<Button size="row" left render={<LinkPrimitive to={urls.toolbarLaunch()} />} />}
+ data-attr="new-action-inspect"
+ description={
+ <>
+ Use the toolbar to visually select elements on your site.{' '}
+ <Button
+ variant="link"
+ size="inline"
+ render={
+ <LinkPrimitive
+ to="https://posthog.com/docs/toolbar/create-toolbar-actions"
+ target="_blank"
+ onClick={(e) => e.stopPropagation()}
+ />
+ }
+ >
+ Learn more
+ </Button>
+ </>
+ }
+ >
+ <IconCursorClick />
+ Inspect element on site
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </ButtonGroup>
+ )
+}
diff --git a/products/actions/frontend/pages/ActionEdit.tsx b/products/actions/frontend/pages/ActionEdit.tsx
index 474b840eb7ca..0e49aef50885 100644
--- a/products/actions/frontend/pages/ActionEdit.tsx
+++ b/products/actions/frontend/pages/ActionEdit.tsx
@@ -5,6 +5,7 @@ import { useEffect, useMemo } from 'react'
import { IconCopy, IconPlus, IconTrash } from '@posthog/icons'
import { LemonCollapse } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import {
@@ -19,6 +20,7 @@ import { SceneTags } from 'lib/components/Scenes/SceneTags'
import { SceneActivityIndicator } from 'lib/components/Scenes/SceneUpdateActivityInfo'
import ViewRecordingsPlaylistButton from 'lib/components/ViewRecordingButton/ViewRecordingsPlaylistButton'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useFileSystemLogView } from 'lib/hooks/useFileSystemLogView'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonField } from 'lib/lemon-ui/LemonField'
@@ -103,6 +105,7 @@ export function ActionEdit({ action: loadedAction, id, actionLoading, attachTo }
const { canCopyToProject } = useValues(interProjectCopyLogic)
const { featureFlags } = useValues(featureFlagLogic)
const sceneMenuBarEnabled = !!featureFlags[FEATURE_FLAGS.SCENE_MENU_BAR]
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
// Check if user can edit this action
const canEdit = userHasAccess(AccessControlResourceType.Action, AccessControlLevel.Editor, action.user_access_level)
@@ -286,30 +289,75 @@ export function ActionEdit({ action: loadedAction, id, actionLoading, attachTo }
canEdit={canEdit}
forceEdit={!id}
actions={
- <>
- {!id && cancelButton()}
- <LemonButton
- data-attr="save-action-button"
- type="primary"
- htmlType="submit"
- loading={isActionSubmitting}
- onClick={(e) => {
- e.preventDefault()
- if (id) {
- submitAction()
- } else {
- setActionValue('_create_in_folder', 'Unfiled/Insights')
- submitAction()
+ todayRailNav ? (
+ <>
+ {!id && (
+ <Button
+ data-attr="cancel-action-bottom"
+ variant="destructive-outline"
+ onClick={() => {
+ router.actions.push(urls.actions())
+ }}
+ tooltip="Cancel and return to the list of actions"
+ >
+ Cancel
+ </Button>
+ )}
+ <Button
+ data-attr="save-action-button"
+ variant="primary"
+ type="submit"
+ loading={isActionSubmitting}
+ onClick={(e) => {
+ e.preventDefault()
+ if (id) {
+ submitAction()
+ } else {
+ setActionValue('_create_in_folder', 'Unfiled/Insights')
+ submitAction()
+ }
+ }}
+ disabledReason={
+ isActionSubmitting
+ ? 'Saving…'
+ : !actionChanged
+ ? 'No changes to save'
+ : undefined
}
- }}
- size="small"
- disabledReason={
- isActionSubmitting ? 'Saving…' : !actionChanged ? 'No changes to save' : undefined
- }
- >
- {actionChanged ? 'Save' : 'No changes'}
- </LemonButton>
- </>
+ >
+ {actionChanged ? 'Save' : 'No changes'}
+ </Button>
+ </>
+ ) : (
+ <>
+ {!id && cancelButton()}
+ <LemonButton
+ data-attr="save-action-button"
+ type="primary"
+ htmlType="submit"
+ loading={isActionSubmitting}
+ onClick={(e) => {
+ e.preventDefault()
+ if (id) {
+ submitAction()
+ } else {
+ setActionValue('_create_in_folder', 'Unfiled/Insights')
+ submitAction()
+ }
+ }}
+ size="small"
+ disabledReason={
+ isActionSubmitting
+ ? 'Saving…'
+ : !actionChanged
+ ? 'No changes to save'
+ : undefined
+ }
+ >
+ {actionChanged ? 'Save' : 'No changes'}
+ </LemonButton>
+ </>
+ )
}
/>
diff --git a/products/actions/package.json b/products/actions/package.json
index 6399e7ae7560..f69a97d03fa8 100644
--- a/products/actions/package.json
+++ b/products/actions/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/ai_observability/frontend/AIObservabilityScene.tsx b/products/ai_observability/frontend/AIObservabilityScene.tsx
index 5deee0ea2d52..fd959f6e6c4a 100644
--- a/products/ai_observability/frontend/AIObservabilityScene.tsx
+++ b/products/ai_observability/frontend/AIObservabilityScene.tsx
@@ -3,6 +3,7 @@ import { combineUrl, router } from 'kea-router'
import React from 'react'
import { LemonButton, LemonTab, LemonTabs, LemonTag, Link, Spinner } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { DateFilter } from 'lib/components/DateFilter/DateFilter'
@@ -14,6 +15,8 @@ import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { TestAccountFilterSwitch } from 'lib/components/TestAccountFiltersSwitch'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { dateMapping } from 'lib/utils/dateFilters'
@@ -467,6 +470,7 @@ function AIObservabilitySceneContent(): JSX.Element {
const { push } = useActions(router)
const selfDrivingEnabled = Boolean(featureFlags[FEATURE_FLAGS.AI_OBSERVABILITY_SELF_DRIVING])
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
// Tab switching shortcuts
useShortcut({
@@ -647,14 +651,25 @@ function AIObservabilitySceneContent(): JSX.Element {
type: sceneConfigurations[Scene.AIObservability].iconType || 'default_icon_type',
}}
actions={
- <LemonButton
- to={DOCS_URLS_BY_TAB[activeTab] || DEFAULT_DOCS_URL}
- type="secondary"
- targetBlank
- size="small"
- >
- Documentation
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="outline"
+ render={
+ <LinkPrimitive to={DOCS_URLS_BY_TAB[activeTab] || DEFAULT_DOCS_URL} target="_blank" />
+ }
+ >
+ Documentation
+ </Button>
+ ) : (
+ <LemonButton
+ to={DOCS_URLS_BY_TAB[activeTab] || DEFAULT_DOCS_URL}
+ type="secondary"
+ targetBlank
+ size="small"
+ >
+ Documentation
+ </LemonButton>
+ )
}
/>
diff --git a/products/ai_observability/frontend/AIObservabilityTraceScene.tsx b/products/ai_observability/frontend/AIObservabilityTraceScene.tsx
index e66e9b395bb6..8b7633a4889f 100644
--- a/products/ai_observability/frontend/AIObservabilityTraceScene.tsx
+++ b/products/ai_observability/frontend/AIObservabilityTraceScene.tsx
@@ -39,6 +39,7 @@ import {
SpinnerOverlay,
Tooltip,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { JSONViewer } from 'lib/components/JSONViewer'
@@ -46,6 +47,7 @@ import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortc
import { NotFound } from 'lib/components/NotFound'
import ViewRecordingButton, { RecordingPlayerType } from 'lib/components/ViewRecordingButton/ViewRecordingButton'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys'
import { IconWithCount } from 'lib/lemon-ui/icons/icons'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -365,6 +367,7 @@ function TraceNavigation(): JSX.Element {
const { viewMode, newerTraceId, newerTimestamp, olderTraceId, olderTimestamp, neighborsLoading } =
useValues(traceLogic)
const { searchParams } = useValues(router)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const baseSearchParams = sanitizeTraceUrlSearchParams(searchParams)
// Navigate to newer (more recent) or older traces
@@ -400,6 +403,33 @@ function TraceNavigation(): JSX.Element {
[olderTraceId, newerTraceId, olderTimestamp, newerTimestamp, neighborsLoading, viewMode]
)
+ if (todayRailNav) {
+ return (
+ <div className="flex items-center gap-1">
+ <Button
+ variant="outline"
+ aria-label="Newer trace"
+ tooltip="Newer trace"
+ disabled={!newerTraceId || neighborsLoading}
+ onClick={goToNewer}
+ >
+ <IconChevronLeft />
+ <KeyboardShortcut p />
+ </Button>
+ <Button
+ variant="outline"
+ aria-label="Older trace"
+ tooltip="Older trace"
+ disabled={!olderTraceId || neighborsLoading}
+ onClick={goToOlder}
+ >
+ <IconChevronRight />
+ <KeyboardShortcut n />
+ </Button>
+ </div>
+ )
+ }
+
return (
<div className="flex items-center gap-1">
<LemonButton
diff --git a/products/ai_observability/frontend/clusters/AIObservabilityClusterScene.tsx b/products/ai_observability/frontend/clusters/AIObservabilityClusterScene.tsx
index 6cb0a360d331..060de6b7f832 100644
--- a/products/ai_observability/frontend/clusters/AIObservabilityClusterScene.tsx
+++ b/products/ai_observability/frontend/clusters/AIObservabilityClusterScene.tsx
@@ -3,12 +3,15 @@ import { useState } from 'react'
import { IconChevronDown, IconChevronLeft, IconChevronRight } from '@posthog/icons'
import { LemonButton, LemonSkeleton, LemonTag, Link, Spinner, Tooltip } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { PropertyFilters } from 'lib/components/PropertyFilters/PropertyFilters'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { TestAccountFilterSwitch } from 'lib/components/TestAccountFiltersSwitch'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -58,6 +61,7 @@ export function AIObservabilityClusterScene(): JSX.Element {
} = useValues(clusterDetailLogic)
const { setPage, setPropertyFilters, setShouldFilterTestAccounts } = useActions(clusterDetailLogic)
const { groupsTaxonomicTypes } = useValues(groupsModel)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (clusterDataLoading) {
return (
@@ -93,11 +97,21 @@ export function AIObservabilityClusterScene(): JSX.Element {
name={cluster.title}
resourceType={{ type: 'llm_analytics' }}
actions={
- <Link to={urls.aiObservabilityClusters()}>
- <LemonButton type="secondary" size="small" data-attr="clusters-back-button">
+ todayRailNav ? (
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={urls.aiObservabilityClusters()} />}
+ data-attr="clusters-back-button"
+ >
Back to clusters
- </LemonButton>
- </Link>
+ </Button>
+ ) : (
+ <Link to={urls.aiObservabilityClusters()}>
+ <LemonButton type="secondary" size="small" data-attr="clusters-back-button">
+ Back to clusters
+ </LemonButton>
+ </Link>
+ )
}
/>
diff --git a/products/ai_observability/frontend/datasets/AIObservabilityDatasetScene.tsx b/products/ai_observability/frontend/datasets/AIObservabilityDatasetScene.tsx
index cd34f52c685b..be08ebc1aecd 100644
--- a/products/ai_observability/frontend/datasets/AIObservabilityDatasetScene.tsx
+++ b/products/ai_observability/frontend/datasets/AIObservabilityDatasetScene.tsx
@@ -16,6 +16,7 @@ import {
Link,
ProfilePicture,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { AccessDenied } from 'lib/components/AccessDenied'
@@ -23,6 +24,7 @@ import { HighlightedJSONViewer } from 'lib/components/HighlightedJSONViewer'
import { NotFound } from 'lib/components/NotFound'
import { SceneMenuBarFileItems } from 'lib/components/Scenes/SceneMenuBarFileItems'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
@@ -112,6 +114,16 @@ export function AIObservabilityDatasetScene(): JSX.Element {
const { searchParams } = useValues(router)
const { featureFlags } = useValues(featureFlagLogic)
const sceneMenuBarEnabled = !!featureFlags[FEATURE_FLAGS.SCENE_MENU_BAR]
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ const cancelEditing = (): void => {
+ if (isEditingDataset) {
+ editDataset(false)
+ loadDataset()
+ } else {
+ router.actions.push(getDatasetListUrl(searchParams))
+ }
+ }
const displayEditForm = isNewDataset || (isEditingDataset && canEditDataset)
const canChangeDatasetStatus = canManageDataset && !isHistoricalRevision
@@ -186,41 +198,67 @@ export function AIObservabilityDatasetScene(): JSX.Element {
isLoading={datasetLoading}
actions={
!shouldDisplaySkeleton && displayEditForm ? (
- <>
- <LemonButton
- type="secondary"
- data-attr="cancel-dataset"
- onClick={() => {
- if (isEditingDataset) {
- editDataset(false)
- loadDataset()
- } else {
- router.actions.push(getDatasetListUrl(searchParams))
+ todayRailNav ? (
+ <>
+ <Button
+ variant="outline"
+ data-attr="cancel-dataset"
+ onClick={cancelEditing}
+ disabledReason={isDatasetFormSubmitting ? 'Saving…' : undefined}
+ >
+ Cancel
+ </Button>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmAnalytics}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={
+ isDataset(dataset)
+ ? toAccessControlLevel(dataset.user_access_level)
+ : undefined
}
- }}
- disabledReason={isDatasetFormSubmitting ? 'Saving…' : undefined}
- size="small"
- >
- Cancel
- </LemonButton>
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmAnalytics}
- minAccessLevel={AccessControlLevel.Editor}
- userAccessLevel={
- isDataset(dataset) ? toAccessControlLevel(dataset.user_access_level) : undefined
- }
- >
+ >
+ <Button
+ variant="primary"
+ data-attr="save-dataset"
+ onClick={submitDatasetForm}
+ loading={isDatasetFormSubmitting}
+ >
+ {isNewDataset ? 'Create dataset' : 'Save'}
+ </Button>
+ </AccessControlAction>
+ </>
+ ) : (
+ <>
<LemonButton
- type="primary"
- data-attr="save-dataset"
- onClick={submitDatasetForm}
- loading={isDatasetFormSubmitting}
+ type="secondary"
+ data-attr="cancel-dataset"
+ onClick={cancelEditing}
+ disabledReason={isDatasetFormSubmitting ? 'Saving…' : undefined}
size="small"
>
- {isNewDataset ? 'Create dataset' : 'Save'}
+ Cancel
</LemonButton>
- </AccessControlAction>
- </>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmAnalytics}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={
+ isDataset(dataset)
+ ? toAccessControlLevel(dataset.user_access_level)
+ : undefined
+ }
+ >
+ <LemonButton
+ type="primary"
+ data-attr="save-dataset"
+ onClick={submitDatasetForm}
+ loading={isDatasetFormSubmitting}
+ size="small"
+ >
+ {isNewDataset ? 'Create dataset' : 'Save'}
+ </LemonButton>
+ </AccessControlAction>
+ </>
+ )
) : undefined
}
/>
diff --git a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluationsScene.tsx b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluationsScene.tsx
index 4d2b2609ce4b..acd6385aa6f0 100644
--- a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluationsScene.tsx
+++ b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluationsScene.tsx
@@ -26,10 +26,13 @@ import {
Link,
Tooltip,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { DateFilter } from 'lib/components/DateFilter/DateFilter'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
import { fullName } from 'lib/utils/strings'
@@ -726,6 +729,7 @@ export function AIObservabilityEvaluationsScene(): JSX.Element {
// evaluationMetricsLogic connects to it, so attaching leaves the two holding each
// other mounted, and the list never reloads on the next visit to this scene.
useMountedLogic(evaluationMetricsLogic())
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<BindLogic logic={llmEvaluationsLogic} props={{}}>
@@ -738,14 +742,28 @@ export function AIObservabilityEvaluationsScene(): JSX.Element {
type: 'llm_evaluations',
}}
actions={
- <LemonButton
- to="https://posthog.com/docs/ai-evals/evaluations"
- type="secondary"
- targetBlank
- size="small"
- >
- Documentation
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="outline"
+ render={
+ <LinkPrimitive
+ to="https://posthog.com/docs/ai-evals/evaluations"
+ target="_blank"
+ />
+ }
+ >
+ Documentation
+ </Button>
+ ) : (
+ <LemonButton
+ to="https://posthog.com/docs/ai-evals/evaluations"
+ type="secondary"
+ targetBlank
+ size="small"
+ >
+ Documentation
+ </LemonButton>
+ )
}
/>
<EvaluationsTabs activeTab="online-evals">
diff --git a/products/ai_observability/frontend/playground/AIObservabilityPlaygroundScene.tsx b/products/ai_observability/frontend/playground/AIObservabilityPlaygroundScene.tsx
index 9bfdc0a4b7cc..eeb5b9b92245 100644
--- a/products/ai_observability/frontend/playground/AIObservabilityPlaygroundScene.tsx
+++ b/products/ai_observability/frontend/playground/AIObservabilityPlaygroundScene.tsx
@@ -27,9 +27,11 @@ import {
Link,
LemonDivider,
} from '@posthog/lemon-ui'
+import { Button, Spinner as QuillSpinner } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { AnimatedCollapsible } from 'lib/components/AnimatedCollapsible'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconArrowDown, IconArrowUp } from 'lib/lemon-ui/icons'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
@@ -136,8 +138,56 @@ function PlaygroundHeaderActions(): JSX.Element {
const { addPromptConfig, resetPlayground } = useActions(llmPlaygroundPromptsLogic)
const { submitting: playgroundSubmitting } = useValues(llmPlaygroundRunLogic)
const { submitPrompt, abortRun } = useActions(llmPlaygroundRunLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const firstPromptId = promptConfigs[0]?.id
+ if (todayRailNav) {
+ return (
+ <>
+ <Button
+ variant="outline"
+ size="icon"
+ aria-label="Reset playground to default state"
+ onClick={resetPlayground}
+ disabledReason={playgroundSubmitting ? 'Generating...' : undefined}
+ tooltip="Reset playground to default state"
+ data-attr="llma-playground-reset"
+ >
+ <IconRevert />
+ </Button>
+ <Button
+ variant="outline"
+ onClick={() => addPromptConfig(firstPromptId)}
+ disabledReason={playgroundSubmitting ? 'Generating...' : undefined}
+ data-attr="llma-playground-add-prompt"
+ >
+ <IconPlus />
+ Add prompt
+ </Button>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmPlayground}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant={playgroundSubmitting ? 'destructive-outline' : 'primary'}
+ onClick={() => (playgroundSubmitting ? abortRun() : submitPrompt())}
+ disabledReason={
+ playgroundSubmitting
+ ? undefined
+ : !hasRunnablePrompts
+ ? 'Add messages to at least one prompt'
+ : undefined
+ }
+ data-attr="llma-playground-run-button"
+ >
+ {playgroundSubmitting ? <QuillSpinner /> : <IconPlay />}
+ <span>{playgroundSubmitting ? 'Stop' : 'Run'}</span>
+ </Button>
+ </AccessControlAction>
+ </>
+ )
+ }
+
return (
<>
<LemonButton
diff --git a/products/ai_observability/frontend/prompts/LLMPromptScene.tsx b/products/ai_observability/frontend/prompts/LLMPromptScene.tsx
index 3464ec4a7d24..e068d1c0ea6e 100644
--- a/products/ai_observability/frontend/prompts/LLMPromptScene.tsx
+++ b/products/ai_observability/frontend/prompts/LLMPromptScene.tsx
@@ -8,6 +8,7 @@ import { LemonButton, LemonTabs } from '@posthog/lemon-ui'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
import { NotFound } from 'lib/components/NotFound'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { SceneExport } from 'scenes/sceneTypes'
@@ -31,6 +32,7 @@ import {
PublishReviewModal,
cleanPromptSearchParams,
} from './promptSceneComponents'
+import { QuillLLMPromptActions } from './QuillLLMPromptActions'
import { openArchivePromptDialog, openDuplicatePromptDialog } from './utils'
export const scene: SceneExport<PromptLogicProps> = {
@@ -78,6 +80,7 @@ export function LLMPromptScene(): JSX.Element {
cancelEditing,
} = useActions(llmPromptLogic)
const { duplicatePrompt } = useAsyncActions(llmPromptLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const sourcePromptName = !isNewPrompt && prompt && isPrompt(prompt) ? prompt.name : null
const sourcePromptVersion = isHistoricalVersion && isPrompt(prompt) ? prompt.version : null
const openInPlaygroundUrl = sourcePromptName
@@ -108,82 +111,88 @@ export function LLMPromptScene(): JSX.Element {
resourceType={{ type: 'llm_analytics' }}
isLoading={promptLoading}
actions={
- <>
- {openInPlaygroundUrl ? (
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconPlay />}
- to={openInPlaygroundUrl}
- data-attr="llma-playground-open-from-prompt"
+ todayRailNav ? (
+ <QuillLLMPromptActions openInPlaygroundUrl={openInPlaygroundUrl} />
+ ) : (
+ <>
+ {openInPlaygroundUrl ? (
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconPlay />}
+ to={openInPlaygroundUrl}
+ data-attr="llma-playground-open-from-prompt"
+ >
+ Open in Playground
+ </LemonButton>
+ ) : null}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmAnalytics}
+ minAccessLevel={AccessControlLevel.Editor}
>
- Open in Playground
- </LemonButton>
- ) : null}
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmAnalytics}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonButton
- type="primary"
- icon={<IconPencil />}
- onClick={() => {
- if (isPrompt(prompt)) {
- setPromptFormValues({ name: prompt.name, prompt: prompt.prompt })
- setMode(PromptMode.Edit)
+ <LemonButton
+ type="primary"
+ icon={<IconPencil />}
+ onClick={() => {
+ if (isPrompt(prompt)) {
+ setPromptFormValues({ name: prompt.name, prompt: prompt.prompt })
+ setMode(PromptMode.Edit)
+ }
+ }}
+ size="small"
+ tooltip={
+ isHistoricalVersion
+ ? 'Start a new version from this historical version'
+ : undefined
}
- }}
- size="small"
- tooltip={
- isHistoricalVersion ? 'Start a new version from this historical version' : undefined
- }
- data-attr="llma-prompt-new-version-button"
- >
- New version
- </LemonButton>
- </AccessControlAction>
+ data-attr="llma-prompt-new-version-button"
+ >
+ New version
+ </LemonButton>
+ </AccessControlAction>
- <More
- size="small"
- overlay={
- <>
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmAnalytics}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonButton
- onClick={() => {
- if (isPrompt(prompt)) {
- const sourceName = prompt.name
- openDuplicatePromptDialog(sourceName, (newName) =>
- duplicatePrompt(sourceName, newName)
- )
- }
- }}
- data-attr="llma-prompt-detail-duplicate"
- fullWidth
+ <More
+ size="small"
+ overlay={
+ <>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmAnalytics}
+ minAccessLevel={AccessControlLevel.Editor}
>
- Duplicate
- </LemonButton>
- </AccessControlAction>
+ <LemonButton
+ onClick={() => {
+ if (isPrompt(prompt)) {
+ const sourceName = prompt.name
+ openDuplicatePromptDialog(sourceName, (newName) =>
+ duplicatePrompt(sourceName, newName)
+ )
+ }
+ }}
+ data-attr="llma-prompt-detail-duplicate"
+ fullWidth
+ >
+ Duplicate
+ </LemonButton>
+ </AccessControlAction>
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmAnalytics}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonButton
- status="danger"
- onClick={() => openArchivePromptDialog(deletePrompt)}
- data-attr="llma-prompt-delete-button"
- fullWidth
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmAnalytics}
+ minAccessLevel={AccessControlLevel.Editor}
>
- Archive
- </LemonButton>
- </AccessControlAction>
- </>
- }
- />
- </>
+ <LemonButton
+ status="danger"
+ onClick={() => openArchivePromptDialog(deletePrompt)}
+ data-attr="llma-prompt-delete-button"
+ fullWidth
+ >
+ Archive
+ </LemonButton>
+ </AccessControlAction>
+ </>
+ }
+ />
+ </>
+ )
}
/>
@@ -267,59 +276,63 @@ export function LLMPromptScene(): JSX.Element {
resourceType={{ type: 'llm_analytics' }}
isLoading={promptLoading}
actions={
- <>
- {openInPlaygroundUrl ? (
+ todayRailNav ? (
+ <QuillLLMPromptActions openInPlaygroundUrl={openInPlaygroundUrl} />
+ ) : (
+ <>
+ {openInPlaygroundUrl ? (
+ <LemonButton
+ type="secondary"
+ icon={<IconPlay />}
+ to={openInPlaygroundUrl}
+ disabledReason={
+ isPromptFormSubmitting
+ ? 'Saving…'
+ : isPromptFormDirty
+ ? 'You have unsaved edits — publish or cancel first'
+ : undefined
+ }
+ size="small"
+ data-attr="llma-playground-open-from-prompt"
+ >
+ Open in Playground
+ </LemonButton>
+ ) : null}
<LemonButton
type="secondary"
- icon={<IconPlay />}
- to={openInPlaygroundUrl}
- disabledReason={
- isPromptFormSubmitting
- ? 'Saving…'
- : isPromptFormDirty
- ? 'You have unsaved edits — publish or cancel first'
- : undefined
- }
+ onClick={() => cancelEditing()}
+ disabledReason={isPromptFormSubmitting ? 'Saving…' : undefined}
size="small"
- data-attr="llma-playground-open-from-prompt"
+ data-attr="llma-prompt-cancel-button"
>
- Open in Playground
+ Cancel
</LemonButton>
- ) : null}
- <LemonButton
- type="secondary"
- onClick={() => cancelEditing()}
- disabledReason={isPromptFormSubmitting ? 'Saving…' : undefined}
- size="small"
- data-attr="llma-prompt-cancel-button"
- >
- Cancel
- </LemonButton>
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmAnalytics}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonButton
- type="primary"
- onClick={isNewPrompt ? submitPromptForm : requestPublish}
- loading={isPromptFormSubmitting}
- disabledReason={
- !isNewPrompt && !isHistoricalVersion && !isPromptFormDirty
- ? 'No changes to publish'
- : undefined
- }
- size="small"
- data-attr={isNewPrompt ? 'prompt-create-button' : 'prompt-save-button'}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmAnalytics}
+ minAccessLevel={AccessControlLevel.Editor}
>
- {isNewPrompt
- ? 'Create prompt'
- : nextVersion
- ? `Publish v${nextVersion}`
- : 'Publish version'}
- </LemonButton>
- </AccessControlAction>
- </>
+ <LemonButton
+ type="primary"
+ onClick={isNewPrompt ? submitPromptForm : requestPublish}
+ loading={isPromptFormSubmitting}
+ disabledReason={
+ !isNewPrompt && !isHistoricalVersion && !isPromptFormDirty
+ ? 'No changes to publish'
+ : undefined
+ }
+ size="small"
+ data-attr={isNewPrompt ? 'prompt-create-button' : 'prompt-save-button'}
+ >
+ {isNewPrompt
+ ? 'Create prompt'
+ : nextVersion
+ ? `Publish v${nextVersion}`
+ : 'Publish version'}
+ </LemonButton>
+ </AccessControlAction>
+ </>
+ )
}
/>
diff --git a/products/ai_observability/frontend/prompts/LLMPromptsScene.tsx b/products/ai_observability/frontend/prompts/LLMPromptsScene.tsx
index b87a146af261..68f616992700 100644
--- a/products/ai_observability/frontend/prompts/LLMPromptsScene.tsx
+++ b/products/ai_observability/frontend/prompts/LLMPromptsScene.tsx
@@ -1,13 +1,16 @@
import { useActions, useAsyncActions, useValues } from 'kea'
import { combineUrl, router } from 'kea-router'
-import { IconPlusSmall } from '@posthog/icons'
+import { IconPlus, IconPlusSmall } from '@posthog/icons'
import { Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { MemberSelect } from 'lib/components/MemberSelect'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -40,6 +43,7 @@ export function LLMPromptsScene(): JSX.Element {
const { prompts, promptsLoading, sorting, pagination, filters, promptCountLabel, restoringPromptName } =
useValues(llmPromptsLogic)
const { searchParams } = useValues(router)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const promptUrl = (name: string): string =>
combineUrl(urls.aiObservabilityPrompt(name), stripPromptSceneSearchParams(searchParams)).url
const showingArchived = !!filters.archived
@@ -205,14 +209,25 @@ export function LLMPromptsScene(): JSX.Element {
resourceType={AccessControlResourceType.LlmAnalytics}
minAccessLevel={AccessControlLevel.Editor}
>
- <LemonButton
- type="primary"
- to={promptUrl('new')}
- icon={<IconPlusSmall />}
- data-attr="new-prompt-button"
- >
- New prompt
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={promptUrl('new')} />}
+ data-attr="new-prompt-button"
+ >
+ <IconPlus />
+ New prompt
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ to={promptUrl('new')}
+ icon={<IconPlusSmall />}
+ data-attr="new-prompt-button"
+ >
+ New prompt
+ </LemonButton>
+ )}
</AccessControlAction>
}
/>
diff --git a/products/ai_observability/frontend/prompts/QuillLLMPromptActions.tsx b/products/ai_observability/frontend/prompts/QuillLLMPromptActions.tsx
new file mode 100644
index 000000000000..cbf7db4ff8b6
--- /dev/null
+++ b/products/ai_observability/frontend/prompts/QuillLLMPromptActions.tsx
@@ -0,0 +1,160 @@
+import { useActions, useAsyncActions, useValues } from 'kea'
+
+import { IconEllipsis, IconPencil, IconPlay } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { PromptMode, isPrompt, llmPromptLogic } from './llmPromptLogic'
+import { openArchivePromptDialog, openDuplicatePromptDialog } from './utils'
+
+export interface QuillLLMPromptActionsProps {
+ openInPlaygroundUrl: string | undefined
+}
+
+export function QuillLLMPromptActions({ openInPlaygroundUrl }: QuillLLMPromptActionsProps): JSX.Element {
+ const {
+ isPromptFormSubmitting,
+ isNewPrompt,
+ isViewMode,
+ prompt,
+ isHistoricalVersion,
+ nextVersion,
+ isPromptFormDirty,
+ } = useValues(llmPromptLogic)
+ const { submitPromptForm, requestPublish, deletePrompt, setMode, setPromptFormValues, cancelEditing } =
+ useActions(llmPromptLogic)
+ const { duplicatePrompt } = useAsyncActions(llmPromptLogic)
+
+ if (isViewMode) {
+ return (
+ <>
+ {openInPlaygroundUrl ? (
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={openInPlaygroundUrl} />}
+ data-attr="llma-playground-open-from-prompt"
+ >
+ <IconPlay />
+ Open in Playground
+ </Button>
+ ) : null}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmAnalytics}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant="primary"
+ onClick={() => {
+ if (isPrompt(prompt)) {
+ setPromptFormValues({ name: prompt.name, prompt: prompt.prompt })
+ setMode(PromptMode.Edit)
+ }
+ }}
+ tooltip={isHistoricalVersion ? 'Start a new version from this historical version' : undefined}
+ data-attr="llma-prompt-new-version-button"
+ >
+ <IconPencil />
+ New version
+ </Button>
+ </AccessControlAction>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="default"
+ size="icon"
+ aria-label="More"
+ tooltip="More"
+ data-attr="more-button"
+ />
+ }
+ >
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmAnalytics}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <DropdownMenuItem
+ onClick={() => {
+ if (isPrompt(prompt)) {
+ const sourceName = prompt.name
+ openDuplicatePromptDialog(sourceName, (newName) =>
+ duplicatePrompt(sourceName, newName)
+ )
+ }
+ }}
+ data-attr="llma-prompt-detail-duplicate"
+ >
+ Duplicate
+ </DropdownMenuItem>
+ </AccessControlAction>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmAnalytics}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={() => openArchivePromptDialog(deletePrompt)}
+ data-attr="llma-prompt-delete-button"
+ >
+ Archive
+ </DropdownMenuItem>
+ </AccessControlAction>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </>
+ )
+ }
+
+ return (
+ <>
+ {openInPlaygroundUrl ? (
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={openInPlaygroundUrl} />}
+ disabledReason={
+ isPromptFormSubmitting
+ ? 'Saving…'
+ : isPromptFormDirty
+ ? 'You have unsaved edits — publish or cancel first'
+ : undefined
+ }
+ data-attr="llma-playground-open-from-prompt"
+ >
+ <IconPlay />
+ Open in Playground
+ </Button>
+ ) : null}
+ <Button
+ variant="outline"
+ onClick={() => cancelEditing()}
+ disabledReason={isPromptFormSubmitting ? 'Saving…' : undefined}
+ data-attr="llma-prompt-cancel-button"
+ >
+ Cancel
+ </Button>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmAnalytics}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant="primary"
+ onClick={isNewPrompt ? submitPromptForm : requestPublish}
+ loading={isPromptFormSubmitting}
+ disabledReason={
+ !isNewPrompt && !isHistoricalVersion && !isPromptFormDirty ? 'No changes to publish' : undefined
+ }
+ data-attr={isNewPrompt ? 'prompt-create-button' : 'prompt-save-button'}
+ >
+ {isNewPrompt ? 'Create prompt' : nextVersion ? `Publish v${nextVersion}` : 'Publish version'}
+ </Button>
+ </AccessControlAction>
+ </>
+ )
+}
diff --git a/products/ai_observability/frontend/scoreDefinitions/AIObservabilityScorerScene.tsx b/products/ai_observability/frontend/scoreDefinitions/AIObservabilityScorerScene.tsx
index 4769b26a1d8d..c27352781eb7 100644
--- a/products/ai_observability/frontend/scoreDefinitions/AIObservabilityScorerScene.tsx
+++ b/products/ai_observability/frontend/scoreDefinitions/AIObservabilityScorerScene.tsx
@@ -5,6 +5,7 @@ import { LemonBanner, LemonButton, LemonMenu, LemonTag } from '@posthog/lemon-ui
import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -17,6 +18,8 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { ProductKey } from '~/queries/schema/schema-general'
import { AccessControlLevel, AccessControlResourceType } from '~/types'
+import { openCreateScorerVersionDialog } from './openCreateScorerVersionDialog'
+import { QuillAIObservabilityScorerActions } from './QuillAIObservabilityScorerActions'
import { ScoreDefinitionForm } from './ScoreDefinitionForm'
import { formatKindLabel } from './scoreDefinitionModalUtils'
import { ScorerLogicProps, scorerLogic } from './scorerLogic'
@@ -49,6 +52,7 @@ export function AIObservabilityScorerScene(props: ScorerLogicProps): JSX.Element
removeOption,
} = useActions(logic)
const { featureFlags } = useValues(featureFlagLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const editDisabledReason = getAccessControlDisabledReason(
AccessControlResourceType.LlmAnalytics,
AccessControlLevel.Editor
@@ -83,71 +87,74 @@ export function AIObservabilityScorerScene(props: ScorerLogicProps): JSX.Element
description="Define the scores used in manual reviews and offline evaluations."
resourceType={{ type: 'llm_evaluations' }}
actions={
- <div className="flex flex-wrap items-center gap-2">
- {!isNew && definition && (
- <LemonMenu
- items={[
- {
- label: 'Duplicate',
- to: urls.aiObservabilityScorer('new', { duplicate: definition.id }),
- disabledReason: editDisabledReason || (saving ? 'Saving scorer' : undefined),
- 'data-attr': 'llma-scorer-duplicate',
- },
- {
- label: 'Create new version',
- disabledReason:
- editDisabledReason ||
- (saving
- ? 'Saving scorer'
- : hasChanges
- ? 'Save your changes first'
- : undefined),
- onClick: () =>
- LemonDialog.open({
- title: 'Create a new scorer version?',
- content: `Version ${definition.current_version + 1} will keep the current configuration. Use this when your external evaluator changes.`,
- primaryButton: { children: 'Create version', onClick: createVersion },
- secondaryButton: { children: 'Cancel' },
- }),
- 'data-attr': 'llma-scorer-new-version',
- },
- {
- label: definition.archived ? 'Unarchive' : 'Archive',
- status: definition.archived ? 'default' : 'danger',
- disabledReason:
- editDisabledReason ||
- (saving
- ? 'Saving scorer'
- : hasChanges
- ? 'Save your changes first'
- : undefined),
- onClick: toggleArchive,
- 'data-attr': 'llma-scorer-archive-toggle',
- },
- ]}
+ todayRailNav ? (
+ <QuillAIObservabilityScorerActions {...props} />
+ ) : (
+ <div className="flex flex-wrap items-center gap-2">
+ {!isNew && definition && (
+ <LemonMenu
+ items={[
+ {
+ label: 'Duplicate',
+ to: urls.aiObservabilityScorer('new', { duplicate: definition.id }),
+ disabledReason:
+ editDisabledReason || (saving ? 'Saving scorer' : undefined),
+ 'data-attr': 'llma-scorer-duplicate',
+ },
+ {
+ label: 'Create new version',
+ disabledReason:
+ editDisabledReason ||
+ (saving
+ ? 'Saving scorer'
+ : hasChanges
+ ? 'Save your changes first'
+ : undefined),
+ onClick: () =>
+ openCreateScorerVersionDialog({
+ currentVersion: definition.current_version,
+ createVersion,
+ }),
+ 'data-attr': 'llma-scorer-new-version',
+ },
+ {
+ label: definition.archived ? 'Unarchive' : 'Archive',
+ status: definition.archived ? 'default' : 'danger',
+ disabledReason:
+ editDisabledReason ||
+ (saving
+ ? 'Saving scorer'
+ : hasChanges
+ ? 'Save your changes first'
+ : undefined),
+ onClick: toggleArchive,
+ 'data-attr': 'llma-scorer-archive-toggle',
+ },
+ ]}
+ >
+ <LemonButton icon={<IconEllipsis />} aria-label="Scorer actions" type="secondary" />
+ </LemonMenu>
+ )}
+ <LemonButton
+ to={urls.aiObservabilityScorers()}
+ type="secondary"
+ disabledReason={saving ? 'Saving scorer' : undefined}
+ data-attr="llma-scorer-cancel"
>
- <LemonButton icon={<IconEllipsis />} aria-label="Scorer actions" type="secondary" />
- </LemonMenu>
- )}
- <LemonButton
- to={urls.aiObservabilityScorers()}
- type="secondary"
- disabledReason={saving ? 'Saving scorer' : undefined}
- data-attr="llma-scorer-cancel"
- >
- {hasChanges || isNew ? 'Cancel' : 'Back to scorers'}
- </LemonButton>
- <LemonButton
- type="primary"
- htmlType="submit"
- form="scorer-form"
- loading={saving}
- disabledReason={editDisabledReason || (!hasChanges ? 'No unsaved changes' : undefined)}
- data-attr="llma-scorer-save"
- >
- {isNew ? 'Create scorer' : 'Save changes'}
- </LemonButton>
- </div>
+ {hasChanges || isNew ? 'Cancel' : 'Back to scorers'}
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ htmlType="submit"
+ form="scorer-form"
+ loading={saving}
+ disabledReason={editDisabledReason || (!hasChanges ? 'No unsaved changes' : undefined)}
+ data-attr="llma-scorer-save"
+ >
+ {isNew ? 'Create scorer' : 'Save changes'}
+ </LemonButton>
+ </div>
+ )
}
/>
<form
diff --git a/products/ai_observability/frontend/scoreDefinitions/QuillAIObservabilityScorerActions.tsx b/products/ai_observability/frontend/scoreDefinitions/QuillAIObservabilityScorerActions.tsx
new file mode 100644
index 000000000000..59aaac1a96b6
--- /dev/null
+++ b/products/ai_observability/frontend/scoreDefinitions/QuillAIObservabilityScorerActions.tsx
@@ -0,0 +1,96 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+
+import { IconEllipsis } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { urls } from 'scenes/urls'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { openCreateScorerVersionDialog } from './openCreateScorerVersionDialog'
+import { ScorerLogicProps, scorerLogic } from './scorerLogic'
+
+export function QuillAIObservabilityScorerActions(props: ScorerLogicProps): JSX.Element {
+ const logic = scorerLogic(props)
+ const { definition, isNew, hasChanges, saving } = useValues(logic)
+ const { createVersion, toggleArchive } = useActions(logic)
+ const editDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.LlmAnalytics,
+ AccessControlLevel.Editor
+ )
+ const changeDisabledReason =
+ editDisabledReason || (saving ? 'Saving scorer' : hasChanges ? 'Save your changes first' : undefined)
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ {!isNew && definition && (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="outline"
+ size="icon"
+ aria-label="Scorer actions"
+ tooltip="Scorer actions"
+ />
+ }
+ >
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem
+ disabledReason={editDisabledReason || (saving ? 'Saving scorer' : undefined)}
+ onClick={() =>
+ router.actions.push(urls.aiObservabilityScorer('new', { duplicate: definition.id }))
+ }
+ data-attr="llma-scorer-duplicate"
+ >
+ Duplicate
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ disabledReason={changeDisabledReason}
+ onClick={() =>
+ openCreateScorerVersionDialog({
+ currentVersion: definition.current_version,
+ createVersion,
+ })
+ }
+ data-attr="llma-scorer-new-version"
+ >
+ Create new version
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ variant={definition.archived ? 'default' : 'destructive'}
+ disabledReason={changeDisabledReason}
+ onClick={toggleArchive}
+ data-attr="llma-scorer-archive-toggle"
+ >
+ {definition.archived ? 'Unarchive' : 'Archive'}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={urls.aiObservabilityScorers()} />}
+ disabledReason={saving ? 'Saving scorer' : undefined}
+ data-attr="llma-scorer-cancel"
+ >
+ {hasChanges || isNew ? 'Cancel' : 'Back to scorers'}
+ </Button>
+ <Button
+ variant="primary"
+ type="submit"
+ form="scorer-form"
+ loading={saving}
+ disabledReason={editDisabledReason || (!hasChanges ? 'No unsaved changes' : undefined)}
+ data-attr="llma-scorer-save"
+ >
+ {isNew ? 'Create scorer' : 'Save changes'}
+ </Button>
+ </div>
+ )
+}
diff --git a/products/ai_observability/frontend/scoreDefinitions/openCreateScorerVersionDialog.ts b/products/ai_observability/frontend/scoreDefinitions/openCreateScorerVersionDialog.ts
new file mode 100644
index 000000000000..bdeb5d2bc1ac
--- /dev/null
+++ b/products/ai_observability/frontend/scoreDefinitions/openCreateScorerVersionDialog.ts
@@ -0,0 +1,16 @@
+import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
+
+export function openCreateScorerVersionDialog({
+ currentVersion,
+ createVersion,
+}: {
+ currentVersion: number
+ createVersion: () => void
+}): void {
+ LemonDialog.open({
+ title: 'Create a new scorer version?',
+ content: `Version ${currentVersion + 1} will keep the current configuration. Use this when your external evaluator changes.`,
+ primaryButton: { children: 'Create version', onClick: createVersion },
+ secondaryButton: { children: 'Cancel' },
+ })
+}
diff --git a/products/ai_observability/frontend/tags/AIObservabilityTagsScene.tsx b/products/ai_observability/frontend/tags/AIObservabilityTagsScene.tsx
index 02d59c890081..6c851886dd83 100644
--- a/products/ai_observability/frontend/tags/AIObservabilityTagsScene.tsx
+++ b/products/ai_observability/frontend/tags/AIObservabilityTagsScene.tsx
@@ -13,11 +13,14 @@ import {
Link,
Tooltip,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { DateFilter } from 'lib/components/DateFilter/DateFilter'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { deleteWithUndo } from 'lib/utils/deleteWithUndo'
import { SceneExport } from 'scenes/sceneTypes'
@@ -318,6 +321,7 @@ function AIObservabilityTagsContent(): JSX.Element {
export function AIObservabilityTagsScene(): JSX.Element {
const { searchParams } = useValues(router)
const { featureFlags, receivedFeatureFlags } = useValues(featureFlagLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!receivedFeatureFlags) {
return (
@@ -346,14 +350,27 @@ export function AIObservabilityTagsScene(): JSX.Element {
resourceType={AccessControlResourceType.Tagger}
minAccessLevel={AccessControlLevel.Editor}
>
- <LemonButton
- type="primary"
- icon={<IconPlus />}
- to={combineUrl(urls.aiObservabilityTag('new'), searchParams).url}
- data-attr="create-tagger-button"
- >
- Create tagger
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ render={
+ <LinkPrimitive to={combineUrl(urls.aiObservabilityTag('new'), searchParams).url} />
+ }
+ data-attr="create-tagger-button"
+ >
+ <IconPlus />
+ Create tagger
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ icon={<IconPlus />}
+ to={combineUrl(urls.aiObservabilityTag('new'), searchParams).url}
+ data-attr="create-tagger-button"
+ >
+ Create tagger
+ </LemonButton>
+ )}
</AccessControlAction>
}
/>
diff --git a/products/ai_observability/package.json b/products/ai_observability/package.json
index f3e6088cc37e..d2300cff47f8 100644
--- a/products/ai_observability/package.json
+++ b/products/ai_observability/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
diff --git a/products/alerts_platform/frontend/PlatformAlertScene.tsx b/products/alerts_platform/frontend/PlatformAlertScene.tsx
index 4016ed4ce49f..8a5fe372e43f 100644
--- a/products/alerts_platform/frontend/PlatformAlertScene.tsx
+++ b/products/alerts_platform/frontend/PlatformAlertScene.tsx
@@ -1,10 +1,13 @@
import { useActions, useValues } from 'kea'
import { LemonBanner, LemonButton, Spinner } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { CodeSnippet, Language } from 'lib/components/CodeSnippet'
import { NotFound } from 'lib/components/NotFound'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { SceneExport } from 'scenes/sceneTypes'
@@ -27,6 +30,7 @@ export function PlatformAlertScene(): JSX.Element {
const { featureFlags } = useValues(featureFlagLogic)
const { configuration, configurationLoading, configurationError } = useValues(platformAlertLogic)
const { loadConfiguration } = useActions(platformAlertLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!featureFlags[FEATURE_FLAGS.PLATFORM_ALERTS]) {
return <NotFound object="page" />
@@ -66,14 +70,24 @@ export function PlatformAlertScene(): JSX.Element {
resourceType={{ type: 'inbox' }}
actions={
sourceUrl ? (
- <LemonButton
- type="secondary"
- size="small"
- to={sourceUrl}
- data-attr="platform-alert-open-source"
- >
- Open in {sourceLabel}
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={sourceUrl} />}
+ data-attr="platform-alert-open-source"
+ >
+ Open in {sourceLabel}
+ </Button>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={sourceUrl}
+ data-attr="platform-alert-open-source"
+ >
+ Open in {sourceLabel}
+ </LemonButton>
+ )
) : undefined
}
/>
diff --git a/products/alerts_platform/package.json b/products/alerts_platform/package.json
index cd659ebe65b4..c1d9482da0f4 100644
--- a/products/alerts_platform/package.json
+++ b/products/alerts_platform/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:"
},
diff --git a/products/annotations/frontend/pages/Annotations.tsx b/products/annotations/frontend/pages/Annotations.tsx
index d57da80289c4..dbe296ac421f 100644
--- a/products/annotations/frontend/pages/Annotations.tsx
+++ b/products/annotations/frontend/pages/Annotations.tsx
@@ -2,11 +2,13 @@ import { useActions, useValues } from 'kea'
import { IconPencil } from '@posthog/icons'
import { LemonSelect, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { TextContent } from 'lib/components/Cards/TextCard/TextCard'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonTable, LemonTableColumn, LemonTableColumns } from 'lib/lemon-ui/LemonTable'
import { createdAtColumn } from 'lib/lemon-ui/LemonTable/columnUtils'
@@ -50,6 +52,7 @@ export function Annotations(): JSX.Element {
const { loadingNext, next } = useValues(annotationsModel)
const { loadAnnotationsNext } = useActions(annotationsModel)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const columns: LemonTableColumns<AnnotationType> = [
{
@@ -169,15 +172,26 @@ export function Annotations(): JSX.Element {
interaction="click"
scope={Scene.Annotations}
>
- <LemonButton
- type="primary"
- data-attr="create-annotation"
- onClick={() => openModalToCreateAnnotation()}
- size="small"
- tooltip="New annotation"
- >
- New annotation
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ data-attr="create-annotation"
+ onClick={() => openModalToCreateAnnotation()}
+ tooltip="New annotation"
+ >
+ New annotation
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ data-attr="create-annotation"
+ onClick={() => openModalToCreateAnnotation()}
+ size="small"
+ tooltip="New annotation"
+ >
+ New annotation
+ </LemonButton>
+ )}
</Shortcut>
}
/>
diff --git a/products/annotations/package.json b/products/annotations/package.json
index 541027c2fbe7..16eeeff7810a 100644
--- a/products/annotations/package.json
+++ b/products/annotations/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-router": "catalog:"
diff --git a/products/autoresearch/frontend/AutoresearchPipelineScene.tsx b/products/autoresearch/frontend/AutoresearchPipelineScene.tsx
index c13d883f3a48..d3787736e0e5 100644
--- a/products/autoresearch/frontend/AutoresearchPipelineScene.tsx
+++ b/products/autoresearch/frontend/AutoresearchPipelineScene.tsx
@@ -20,6 +20,8 @@ import { OnlinePerformanceTab } from './pipeline/OnlinePerformanceTab'
import { PipelineActions } from './pipeline/PipelineActions'
import { PipelineSummary } from './pipeline/PipelineSummary'
import { PredictionsTab } from './pipeline/PredictionsTab'
+import { QuillPipelineActions } from './pipeline/QuillPipelineActions'
+import { QuillScoreNowButton } from './pipeline/QuillScoreNowButton'
import { ScoreNowButton } from './pipeline/ScoreNowButton'
import { SetupTab } from './pipeline/SetupTab'
import { pipelineQuestion, pipelineSubtitle } from './pipelineQuestion'
@@ -34,6 +36,7 @@ export function AutoresearchPipelineScene(): JSX.Element {
const { pipeline, pipelineLoading, pipelineError, activeTab, lifecycleSteps } = useValues(autoresearchPipelineLogic)
const { setActiveTab, loadDetail } = useActions(autoresearchPipelineLogic)
const isEnabled = useFeatureFlag('AUTORESEARCH')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const tabs: LemonTab<AutoresearchPipelineTab>[] = [
{ key: 'predictions', label: 'Predictions', content: <PredictionsTab /> },
@@ -55,10 +58,17 @@ export function AutoresearchPipelineScene(): JSX.Element {
description={pipeline ? pipelineSubtitle(pipeline) : null}
resourceType={{ type: 'experiment' }}
actions={
- <>
- <ScoreNowButton />
- <PipelineActions />
- </>
+ todayRailNav ? (
+ <>
+ <QuillScoreNowButton />
+ <QuillPipelineActions />
+ </>
+ ) : (
+ <>
+ <ScoreNowButton />
+ <PipelineActions />
+ </>
+ )
}
/>
diff --git a/products/autoresearch/frontend/AutoresearchScene.tsx b/products/autoresearch/frontend/AutoresearchScene.tsx
index 707ee9a6ae64..7dafa5e3fa4b 100644
--- a/products/autoresearch/frontend/AutoresearchScene.tsx
+++ b/products/autoresearch/frontend/AutoresearchScene.tsx
@@ -2,9 +2,11 @@ import { useActions, useValues } from 'kea'
import { IconPlus } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonSkeleton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -26,6 +28,7 @@ export const scene: SceneExport = {
export function AutoresearchScene(): JSX.Element {
const isEnabled = useFeatureFlag('AUTORESEARCH')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const { pipelines, pipelinesLoading, pipelinesLoadFailed } = useValues(autoresearchLogic)
const { loadPipelines } = useActions(autoresearchLogic)
@@ -42,15 +45,26 @@ export function AutoresearchScene(): JSX.Element {
type: sceneConfigurations[Scene.Autoresearch].iconType ?? 'experiment',
}}
actions={
- <LemonButton
- type="primary"
- icon={<IconPlus />}
- size="small"
- to={urls.autoresearchNew()}
- data-attr="autoresearch-new-model"
- >
- New model
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.autoresearchNew()} />}
+ data-attr="autoresearch-new-model"
+ >
+ <IconPlus />
+ New model
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ icon={<IconPlus />}
+ size="small"
+ to={urls.autoresearchNew()}
+ data-attr="autoresearch-new-model"
+ >
+ New model
+ </LemonButton>
+ )
}
/>
diff --git a/products/autoresearch/frontend/pipeline/QuillPipelineActions.tsx b/products/autoresearch/frontend/pipeline/QuillPipelineActions.tsx
new file mode 100644
index 000000000000..15a9212522f8
--- /dev/null
+++ b/products/autoresearch/frontend/pipeline/QuillPipelineActions.tsx
@@ -0,0 +1,39 @@
+import { useActions, useValues } from 'kea'
+
+import { IconPause, IconPlay } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'
+
+export function QuillPipelineActions(): JSX.Element | null {
+ const { pipeline, pipelineLoading } = useValues(autoresearchPipelineLogic)
+ const { pausePipeline, resumePipeline } = useActions(autoresearchPipelineLogic)
+ if (!pipeline) {
+ return null
+ }
+ return (
+ <>
+ {pipeline.status === 'paused' ? (
+ <Button
+ variant="outline"
+ onClick={() => resumePipeline()}
+ data-attr="autoresearch-model-resume"
+ loading={pipelineLoading}
+ >
+ <IconPlay />
+ Resume
+ </Button>
+ ) : pipeline.status === 'running' ? (
+ <Button
+ variant="outline"
+ onClick={() => pausePipeline()}
+ data-attr="autoresearch-model-pause"
+ loading={pipelineLoading}
+ >
+ <IconPause />
+ Pause
+ </Button>
+ ) : null}
+ </>
+ )
+}
diff --git a/products/autoresearch/frontend/pipeline/QuillScoreNowButton.tsx b/products/autoresearch/frontend/pipeline/QuillScoreNowButton.tsx
new file mode 100644
index 000000000000..1b624daa3eed
--- /dev/null
+++ b/products/autoresearch/frontend/pipeline/QuillScoreNowButton.tsx
@@ -0,0 +1,38 @@
+import { useActions, useValues } from 'kea'
+
+import { IconRefresh } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { dayjs } from 'lib/dayjs'
+
+import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'
+import { AutoresearchModelRoleEnumApi } from '../generated/api.schemas'
+
+export function QuillScoreNowButton(): JSX.Element | null {
+ const { pipeline, models, scoreResultLoading, activeScoreRun } = useValues(autoresearchPipelineLogic)
+ const { scoreNow } = useActions(autoresearchPipelineLogic)
+ const hasChampion = models.some((m) => m.role === AutoresearchModelRoleEnumApi.Champion)
+ if (!pipeline || pipeline.status === 'archived') {
+ return null
+ }
+ return (
+ <Button
+ variant="outline"
+ onClick={() => scoreNow()}
+ data-attr="autoresearch-model-score"
+ loading={scoreResultLoading || !!activeScoreRun}
+ disabledReason={
+ pipeline.status === 'paused'
+ ? 'Resume the model to score it'
+ : hasChampion
+ ? undefined
+ : 'Train a champion model first'
+ }
+ >
+ <IconRefresh />
+ {activeScoreRun
+ ? `Scoring… started ${dayjs(activeScoreRun.started_at ?? activeScoreRun.created_at).format('HH:mm')}`
+ : 'Score now'}
+ </Button>
+ )
+}
diff --git a/products/autoresearch/package.json b/products/autoresearch/package.json
index 2acae448ef9a..9c463861b2d0 100644
--- a/products/autoresearch/package.json
+++ b/products/autoresearch/package.json
@@ -5,6 +5,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short || test $? -eq 5"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
diff --git a/products/business_intelligence/frontend/BIWorksheetsScene.tsx b/products/business_intelligence/frontend/BIWorksheetsScene.tsx
index fed81a141c5e..b1c83a1c8d4f 100644
--- a/products/business_intelligence/frontend/BIWorksheetsScene.tsx
+++ b/products/business_intelligence/frontend/BIWorksheetsScene.tsx
@@ -2,10 +2,13 @@ import { useActions, useMountedLogic, useValues } from 'kea'
import { IconPlus } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonInput, LemonSegmentedButton, LemonTable, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { useSceneAgentPanel } from 'scenes/max/useSceneAgentPanel'
import { SceneExport } from 'scenes/sceneTypes'
@@ -28,6 +31,7 @@ export function BIWorksheetsScene(): JSX.Element {
const { worksheets, worksheetsLoading, search, page, recent, error } = useValues(biWorksheetsLogic)
const { setSearch, setPage, setRecent, loadWorksheets } = useActions(biWorksheetsLogic)
useMountedLogic(biAgentSyncLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
useSceneAgentPanel({
sceneKey: 'business-intelligence',
contextItems: LIBRARY_CONTEXT,
@@ -45,9 +49,19 @@ export function BIWorksheetsScene(): JSX.Element {
description="Explore your data with visual worksheets."
resourceType={{ type: 'business_intelligence' }}
actions={
- <LemonButton type="primary" icon={<IconPlus />} to={`${urls.businessIntelligenceNew()}#q=`}>
- New worksheet
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={`${urls.businessIntelligenceNew()}#q=`} />}
+ >
+ <IconPlus />
+ New worksheet
+ </Button>
+ ) : (
+ <LemonButton type="primary" icon={<IconPlus />} to={`${urls.businessIntelligenceNew()}#q=`}>
+ New worksheet
+ </LemonButton>
+ )
}
/>
<BIStarters />
diff --git a/products/business_intelligence/package.json b/products/business_intelligence/package.json
index 945d389f04cf..5a442ff75242 100644
--- a/products/business_intelligence/package.json
+++ b/products/business_intelligence/package.json
@@ -2,6 +2,7 @@
"name": "@posthog/products-business-intelligence",
"private": true,
"dependencies": {
+ "@posthog/quill": "workspace:*",
"fast-equals": "catalog:",
"kea": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/business_knowledge/frontend/scenes/sources/BusinessKnowledgeScene.tsx b/products/business_knowledge/frontend/scenes/sources/BusinessKnowledgeScene.tsx
index f35bf4dd9490..ecff7ae5e683 100644
--- a/products/business_knowledge/frontend/scenes/sources/BusinessKnowledgeScene.tsx
+++ b/products/business_knowledge/frontend/scenes/sources/BusinessKnowledgeScene.tsx
@@ -1,8 +1,9 @@
import { useActions, useValues } from 'kea'
import { router } from 'kea-router'
-import { IconPlusSmall, IconRefresh, IconTrash } from '@posthog/icons'
+import { IconPlus, IconPlusSmall, IconRefresh, IconTrash } from '@posthog/icons'
import { LemonButton, LemonDialog, LemonInput, LemonSelect, LemonTable, LemonTag } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { TZLabel } from 'lib/components/TZLabel'
@@ -45,6 +46,7 @@ export const scene: SceneExport = {
export function BusinessKnowledgeScene(): JSX.Element {
const isEnabled = useFeatureFlag('PRODUCT_BUSINESS_KNOWLEDGE')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const {
sources,
sourcesLoading,
@@ -72,9 +74,16 @@ export function BusinessKnowledgeScene(): JSX.Element {
description="Upload text, public URLs, or files so PostHog AI can understand your business context, vision, and policies."
resourceType={{ type: 'business_knowledge' }}
actions={
- <LemonButton type="primary" icon={<IconPlusSmall />} onClick={() => openCreateModal()}>
- Add source
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="primary" onClick={() => openCreateModal()}>
+ <IconPlus />
+ Add source
+ </Button>
+ ) : (
+ <LemonButton type="primary" icon={<IconPlusSmall />} onClick={() => openCreateModal()}>
+ Add source
+ </LemonButton>
+ )
}
/>
<BusinessKnowledgeTabs activeTab="sources" />
diff --git a/products/business_knowledge/package.json b/products/business_knowledge/package.json
index f327bfe96472..f76e85ad28e8 100644
--- a/products/business_knowledge/package.json
+++ b/products/business_knowledge/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/tests -v --tb=short --override-ini='addopts=' || test $? -eq 5"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/canvas/frontend/list/CanvasesScene.tsx b/products/canvas/frontend/list/CanvasesScene.tsx
index 17f90fac4fac..1d6ac0a8c2ee 100644
--- a/products/canvas/frontend/list/CanvasesScene.tsx
+++ b/products/canvas/frontend/list/CanvasesScene.tsx
@@ -2,6 +2,7 @@ import { useActions, useValues } from 'kea'
import { IconEllipsis, IconPalette, IconTrash } from '@posthog/icons'
import { LemonButton, LemonInput } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
@@ -9,7 +10,7 @@ import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { LemonMenu } from 'lib/lemon-ui/LemonMenu'
import { LemonTable, LemonTableColumns } from 'lib/lemon-ui/LemonTable'
import { atColumn, createdByColumn } from 'lib/lemon-ui/LemonTable/columnUtils'
-import { Link } from 'lib/lemon-ui/Link'
+import { Link, LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -79,9 +80,9 @@ function CanvasesList(): JSX.Element {
name="Canvases"
resourceType={{ type: 'canvas', forceIcon: <IconPalette /> }}
actions={
- <LemonButton size="small" type="primary" to={urls.canvasNew()} data-attr="canvases-new">
+ <Button variant="primary" render={<LinkPrimitive to={urls.canvasNew()} />} data-attr="canvases-new">
New canvas
- </LemonButton>
+ </Button>
}
/>
<LemonInput
diff --git a/products/cohorts/frontend/staff/CohortsStaffToolsScene.tsx b/products/cohorts/frontend/staff/CohortsStaffToolsScene.tsx
index db902d9f83a5..a771c6445087 100644
--- a/products/cohorts/frontend/staff/CohortsStaffToolsScene.tsx
+++ b/products/cohorts/frontend/staff/CohortsStaffToolsScene.tsx
@@ -1,8 +1,11 @@
import { useActions, useValues } from 'kea'
import { LemonBanner, LemonButton, LemonInput } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessDenied } from 'lib/components/AccessDenied'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
@@ -102,6 +105,7 @@ function StuckCohortsPanel(): JSX.Element {
export function CohortsStaffToolsScene(): JSX.Element {
const { user } = useValues(userLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!user?.is_staff) {
return <AccessDenied object="page" reason="This page is only accessible to staff users." />
@@ -114,9 +118,15 @@ export function CohortsStaffToolsScene(): JSX.Element {
description="Look up cohorts across all teams, inspect their calculation state, and force recalculation of stuck cohorts."
resourceType={{ type: 'cohort' }}
actions={
- <LemonButton type="secondary" size="small" to={urls.featureFlagsStaffTools()}>
- Flags staff tools
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="outline" render={<LinkPrimitive to={urls.featureFlagsStaffTools()} />}>
+ Flags staff tools
+ </Button>
+ ) : (
+ <LemonButton type="secondary" size="small" to={urls.featureFlagsStaffTools()}>
+ Flags staff tools
+ </LemonButton>
+ )
}
/>
<div className="space-y-6">
diff --git a/products/cohorts/package.json b/products/cohorts/package.json
index 3cd687774822..1ff59fda4330 100644
--- a/products/cohorts/package.json
+++ b/products/cohorts/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
"kea-router": "catalog:",
diff --git a/products/conversations/frontend/components/ComposeTicket/ComposeTicketButton.tsx b/products/conversations/frontend/components/ComposeTicket/ComposeTicketButton.tsx
index d3df27678f03..f10c294d2dc9 100644
--- a/products/conversations/frontend/components/ComposeTicket/ComposeTicketButton.tsx
+++ b/products/conversations/frontend/components/ComposeTicket/ComposeTicketButton.tsx
@@ -6,6 +6,7 @@ import { IconLetter } from '@posthog/icons'
import { LemonButton, LemonButtonProps } from '@posthog/lemon-ui'
import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { Popover } from 'lib/lemon-ui/Popover'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
@@ -13,6 +14,7 @@ import { urls } from 'scenes/urls'
import { AccessControlLevel, AccessControlResourceType } from '~/types'
import { composeTicketLogic } from './composeTicketLogic'
+import { QuillComposeTicketButton } from './QuillComposeTicketButton'
interface ComposeTicketButtonProps {
size?: LemonButtonProps['size']
@@ -35,6 +37,20 @@ export function ComposeTicketButton({
const { openComposeModal } = useActions(composeTicketLogic)
const [showDisabledPopover, setShowDisabledPopover] = useState(false)
const conversationsEnabled = !!currentTeam?.conversations_enabled
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ if (todayRailNav) {
+ return (
+ <QuillComposeTicketButton
+ size={size}
+ type={type}
+ distinctId={distinctId}
+ email={email}
+ iconOnly={iconOnly}
+ onCompose={onCompose}
+ />
+ )
+ }
return (
<>
diff --git a/products/conversations/frontend/components/ComposeTicket/QuillComposeTicketButton.tsx b/products/conversations/frontend/components/ComposeTicket/QuillComposeTicketButton.tsx
new file mode 100644
index 000000000000..a2be23e870fd
--- /dev/null
+++ b/products/conversations/frontend/components/ComposeTicket/QuillComposeTicketButton.tsx
@@ -0,0 +1,88 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+import { useState } from 'react'
+
+import { IconLetter } from '@posthog/icons'
+import { LemonButtonProps } from '@posthog/lemon-ui'
+import { Button, Popover, PopoverContent, PopoverTrigger } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { quillButtonVariant } from 'lib/lemon-ui/LemonButton/quillButtonVariant'
+import { teamLogic } from 'scenes/teamLogic'
+import { urls } from 'scenes/urls'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { composeTicketLogic } from './composeTicketLogic'
+
+interface QuillComposeTicketButtonProps {
+ size?: LemonButtonProps['size']
+ type?: LemonButtonProps['type']
+ distinctId?: string
+ email?: string
+ iconOnly?: boolean
+ onCompose?: () => void
+}
+
+export function QuillComposeTicketButton({
+ size = 'small',
+ type = 'primary',
+ distinctId,
+ email,
+ iconOnly,
+ onCompose,
+}: QuillComposeTicketButtonProps): JSX.Element {
+ const { currentTeam } = useValues(teamLogic)
+ const { openComposeModal } = useActions(composeTicketLogic)
+ const [showDisabledPopover, setShowDisabledPopover] = useState(false)
+ const conversationsEnabled = !!currentTeam?.conversations_enabled
+
+ return (
+ <Popover
+ open={showDisabledPopover}
+ // The trigger only opens the popover when support is off; otherwise its click opens the compose modal.
+ onOpenChange={(open) => setShowDisabledPopover(open && !conversationsEnabled)}
+ >
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Ticket}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <PopoverTrigger
+ render={
+ <Button
+ variant={quillButtonVariant(type)}
+ // Icon-only instances sit in dense rows (person popovers), so they keep the smaller size.
+ size={iconOnly ? (size === 'xsmall' || size === 'xxsmall' ? 'icon-xs' : 'icon') : undefined}
+ aria-label={iconOnly ? 'New ticket' : undefined}
+ tooltip={iconOnly ? 'New ticket' : undefined}
+ onClick={() => {
+ if (conversationsEnabled) {
+ openComposeModal({ distinctId, email })
+ onCompose?.()
+ }
+ }}
+ data-attr="compose-ticket-button"
+ />
+ }
+ >
+ <IconLetter />
+ {iconOnly ? null : 'New ticket'}
+ </PopoverTrigger>
+ </AccessControlAction>
+ <PopoverContent className="max-w-xs flex flex-col gap-2">
+ <p className="m-0 text-xs">
+ Support is not enabled for this project. Enable it in settings to start writing to customers.
+ </p>
+ <Button
+ variant="primary"
+ onClick={() => {
+ setShowDisabledPopover(false)
+ router.actions.push(urls.supportSettings())
+ }}
+ >
+ Go to settings
+ </Button>
+ </PopoverContent>
+ </Popover>
+ )
+}
diff --git a/products/cross_project_dashboards/frontend/CrossProjectDashboardLayoutActions.tsx b/products/cross_project_dashboards/frontend/CrossProjectDashboardLayoutActions.tsx
index 24076c316780..489aba3c4bf9 100644
--- a/products/cross_project_dashboards/frontend/CrossProjectDashboardLayoutActions.tsx
+++ b/products/cross_project_dashboards/frontend/CrossProjectDashboardLayoutActions.tsx
@@ -5,13 +5,20 @@ import { LemonButton } from '@posthog/lemon-ui'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { crossProjectDashboardLogic } from './crossProjectDashboardLogic'
+import { QuillCrossProjectDashboardLayoutActions } from './QuillCrossProjectDashboardLayoutActions'
/** Mirrors the single-project buttons, which read dashboardLogic, with own data-attrs to stay out of their analytics. */
export function CrossProjectDashboardLayoutActions(): JSX.Element | null {
const { layoutEditMode, layoutSaving, tiles, dashboardLoading } = useValues(crossProjectDashboardLogic)
const { enterLayoutEdit, cancelLayoutEdit, saveLayout } = useActions(crossProjectDashboardLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ if (todayRailNav) {
+ return <QuillCrossProjectDashboardLayoutActions />
+ }
if (!layoutEditMode) {
return tiles.length > 0 ? (
diff --git a/products/cross_project_dashboards/frontend/CrossProjectDashboardScene.tsx b/products/cross_project_dashboards/frontend/CrossProjectDashboardScene.tsx
index 9f7b3f6b4236..2f53ac272d63 100644
--- a/products/cross_project_dashboards/frontend/CrossProjectDashboardScene.tsx
+++ b/products/cross_project_dashboards/frontend/CrossProjectDashboardScene.tsx
@@ -11,6 +11,7 @@ import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductI
import { PropertyFilters } from 'lib/components/PropertyFilters/PropertyFilters'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { SceneExport } from 'scenes/sceneTypes'
@@ -25,6 +26,7 @@ import { CrossProjectDashboardGrid } from './CrossProjectDashboardGrid'
import { CrossProjectDashboardLayoutActions } from './CrossProjectDashboardLayoutActions'
import { crossProjectDashboardLogic } from './crossProjectDashboardLogic'
import { openCrossProjectTileOverrideDialog } from './openCrossProjectTileOverrideDialog'
+import { QuillCrossProjectDashboardActions } from './QuillCrossProjectDashboardActions'
const HedgehogChart = pngHoggie(chartPng)
@@ -60,6 +62,7 @@ export function CrossProjectDashboardScene(): JSX.Element {
deleteDashboard,
} = useActions(crossProjectDashboardLogic)
const { requestOpenModal } = useActions(addCrossProjectTileLogic({ dashboardId: dashboard?.id ?? '' }))
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!featureFlags[FEATURE_FLAGS.CROSS_PROJECT_DASHBOARDS]) {
return <NotFound object="page" />
@@ -79,7 +82,9 @@ export function CrossProjectDashboardScene(): JSX.Element {
renameDebounceMs={0}
descriptionMaxLength={4000}
actions={
- dashboard ? (
+ dashboard && todayRailNav ? (
+ <QuillCrossProjectDashboardActions />
+ ) : dashboard ? (
<div className="flex flex-wrap items-center gap-2">
<DateFilter
dateFrom={dashboardFilters.date_from ?? null}
diff --git a/products/cross_project_dashboards/frontend/NewCrossProjectDashboardButton.tsx b/products/cross_project_dashboards/frontend/NewCrossProjectDashboardButton.tsx
index 1818b9845481..000f8e80f989 100644
--- a/products/cross_project_dashboards/frontend/NewCrossProjectDashboardButton.tsx
+++ b/products/cross_project_dashboards/frontend/NewCrossProjectDashboardButton.tsx
@@ -2,11 +2,19 @@ import { useActions } from 'kea'
import { LemonButton } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+
import { crossProjectDashboardsListLogic } from './crossProjectDashboardsListLogic'
+import { QuillNewCrossProjectDashboardButton } from './QuillNewCrossProjectDashboardButton'
/** The page header action wherever the cross-project list shows. The list renders the modal it opens. */
export function NewCrossProjectDashboardButton(): JSX.Element {
const { openNewModal } = useActions(crossProjectDashboardsListLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ if (todayRailNav) {
+ return <QuillNewCrossProjectDashboardButton />
+ }
return (
<LemonButton type="primary" size="small" onClick={openNewModal} data-attr="cross-project-dashboard-new">
diff --git a/products/cross_project_dashboards/frontend/QuillCrossProjectDashboardActions.tsx b/products/cross_project_dashboards/frontend/QuillCrossProjectDashboardActions.tsx
new file mode 100644
index 000000000000..3fe9b47c6553
--- /dev/null
+++ b/products/cross_project_dashboards/frontend/QuillCrossProjectDashboardActions.tsx
@@ -0,0 +1,101 @@
+import { useActions, useValues } from 'kea'
+
+import { IconEllipsis, IconPlus } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@posthog/quill'
+
+import { DateFilter } from 'lib/components/DateFilter/DateFilter'
+
+import type { IntervalType } from '~/types'
+
+import { addCrossProjectTileLogic } from './addCrossProjectTileLogic'
+import { crossProjectDashboardLogic } from './crossProjectDashboardLogic'
+import { QuillCrossProjectDashboardLayoutActions } from './QuillCrossProjectDashboardLayoutActions'
+
+const INTERVAL_OPTIONS: { value: IntervalType | null; label: string }[] = [
+ { value: null, label: 'Default interval' },
+ { value: 'hour', label: 'Hour' },
+ { value: 'day', label: 'Day' },
+ { value: 'week', label: 'Week' },
+ { value: 'month', label: 'Month' },
+]
+
+export function QuillCrossProjectDashboardActions(): JSX.Element | null {
+ const { dashboard, dashboardFilters } = useValues(crossProjectDashboardLogic)
+ const { setDates, setInterval, deleteDashboard } = useActions(crossProjectDashboardLogic)
+ const { requestOpenModal } = useActions(addCrossProjectTileLogic({ dashboardId: dashboard?.id ?? '' }))
+
+ if (!dashboard) {
+ return null
+ }
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ <DateFilter
+ dateFrom={dashboardFilters.date_from ?? null}
+ dateTo={dashboardFilters.date_to ?? null}
+ onChange={setDates}
+ />
+ <Select<IntervalType | null>
+ items={INTERVAL_OPTIONS}
+ value={dashboardFilters.interval ?? null}
+ onValueChange={(value) => setInterval(value)}
+ >
+ <SelectTrigger data-attr="cross-project-interval-filter">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {INTERVAL_OPTIONS.map((option) => (
+ <SelectItem key={option.value ?? 'default'} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <QuillCrossProjectDashboardLayoutActions />
+ <Button variant="primary" onClick={requestOpenModal} data-attr="cross-project-add-tile">
+ <IconPlus />
+ Add insight
+ </Button>
+ <DropdownMenu>
+ <Tooltip>
+ <TooltipTrigger
+ delay={0}
+ render={
+ <DropdownMenuTrigger
+ render={
+ <Button size="icon" aria-label="More" data-attr="cross-project-dashboard-more" />
+ }
+ />
+ }
+ >
+ <IconEllipsis />
+ </TooltipTrigger>
+ <TooltipContent>More</TooltipContent>
+ </Tooltip>
+ <DropdownMenuContent align="end" className="min-w-40">
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={deleteDashboard}
+ data-attr="cross-project-dashboard-delete"
+ >
+ Delete dashboard
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ )
+}
diff --git a/products/cross_project_dashboards/frontend/QuillCrossProjectDashboardLayoutActions.tsx b/products/cross_project_dashboards/frontend/QuillCrossProjectDashboardLayoutActions.tsx
new file mode 100644
index 000000000000..312886ac058e
--- /dev/null
+++ b/products/cross_project_dashboards/frontend/QuillCrossProjectDashboardLayoutActions.tsx
@@ -0,0 +1,72 @@
+import { useActions, useValues } from 'kea'
+
+import { IconGridMasonry } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+
+import { crossProjectDashboardLogic } from './crossProjectDashboardLogic'
+
+export function QuillCrossProjectDashboardLayoutActions(): JSX.Element | null {
+ const { layoutEditMode, layoutSaving, tiles, dashboardLoading } = useValues(crossProjectDashboardLogic)
+ const { enterLayoutEdit, cancelLayoutEdit, saveLayout } = useActions(crossProjectDashboardLogic)
+
+ if (!layoutEditMode) {
+ return tiles.length > 0 ? (
+ <Shortcut
+ name="EnterCrossProjectDashboardEditMode"
+ keybind={[keyBinds.edit]}
+ intent="Enter edit mode"
+ interaction="click"
+ >
+ <Button
+ variant="outline"
+ data-attr="cross-project-dashboard-edit-mode-button"
+ onClick={enterLayoutEdit}
+ tooltip="Customize dashboard"
+ >
+ <IconGridMasonry />
+ Customize
+ </Button>
+ </Shortcut>
+ ) : null
+ }
+
+ return (
+ <>
+ <Shortcut
+ name="CancelCrossProjectDashboardEdit"
+ keybind={[keyBinds.escape]}
+ intent="Cancel edit mode"
+ interaction="click"
+ >
+ <Button
+ data-attr="cross-project-dashboard-edit-mode-discard"
+ variant="outline"
+ onClick={cancelLayoutEdit}
+ tooltip="Discard layout changes and exit layout editing"
+ >
+ Cancel
+ </Button>
+ </Shortcut>
+ <Shortcut
+ name="SaveCrossProjectDashboard"
+ keybind={[keyBinds.edit, keyBinds.save]}
+ intent="Save dashboard layout"
+ interaction="click"
+ >
+ <Button
+ data-attr="cross-project-dashboard-edit-mode-save"
+ variant="primary"
+ onClick={saveLayout}
+ loading={layoutSaving}
+ tooltip="Save dashboard layout"
+ disabledReason={dashboardLoading ? 'Wait for dashboard to finish loading' : undefined}
+ >
+ Save layout
+ </Button>
+ </Shortcut>
+ </>
+ )
+}
diff --git a/products/cross_project_dashboards/frontend/QuillNewCrossProjectDashboardButton.tsx b/products/cross_project_dashboards/frontend/QuillNewCrossProjectDashboardButton.tsx
new file mode 100644
index 000000000000..d96d20a5897e
--- /dev/null
+++ b/products/cross_project_dashboards/frontend/QuillNewCrossProjectDashboardButton.tsx
@@ -0,0 +1,15 @@
+import { useActions } from 'kea'
+
+import { Button } from '@posthog/quill'
+
+import { crossProjectDashboardsListLogic } from './crossProjectDashboardsListLogic'
+
+export function QuillNewCrossProjectDashboardButton(): JSX.Element {
+ const { openNewModal } = useActions(crossProjectDashboardsListLogic)
+
+ return (
+ <Button variant="primary" onClick={openNewModal} data-attr="cross-project-dashboard-new">
+ New cross-project dashboard
+ </Button>
+ )
+}
diff --git a/products/cross_project_dashboards/package.json b/products/cross_project_dashboards/package.json
index da7d1bd54c5a..75b8fc61daa9 100644
--- a/products/cross_project_dashboards/package.json
+++ b/products/cross_project_dashboards/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"clsx": "^2.1.1",
"kea": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/customer_analytics/frontend/CustomerAnalyticsScene.tsx b/products/customer_analytics/frontend/CustomerAnalyticsScene.tsx
index d49b97fd8a84..ae005adb824a 100644
--- a/products/customer_analytics/frontend/CustomerAnalyticsScene.tsx
+++ b/products/customer_analytics/frontend/CustomerAnalyticsScene.tsx
@@ -8,6 +8,7 @@ import { NotFound } from 'lib/components/NotFound'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { groupsAccessLogic } from 'lib/introductions/groupsAccessLogic'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -48,6 +49,7 @@ import { CustomerAnalyticsFilters } from './CustomerAnalyticsFilters'
import { customerAnalyticsSceneLogic } from './customerAnalyticsSceneLogic'
import { customerAnalyticsEmptyState } from './emptyState/customerAnalyticsEmptyState'
import { customerAnalyticsFeaturePreviewGate } from './featurePreviewGate'
+import { QuillCustomerAnalyticsSceneActions } from './QuillCustomerAnalyticsSceneActions'
export const scene: SceneExport = {
component: CustomerAnalyticsScene,
@@ -75,11 +77,19 @@ function CustomerAnalyticsSceneContent(): JSX.Element {
const { isEditMode, stagedNodes, isSaving } = useValues(journeyEditorLogic)
const { saveChanges, cancelChanges } = useActions(journeyEditorLogic)
const { activeJourney } = useValues(customerJourneysLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const accessControlDisabledReason = getAccessControlDisabledReason(
AccessControlResourceType.CustomerAnalytics,
AccessControlLevel.Editor
)
+ const onConfigureClick = (): void => {
+ addProductIntent({
+ product_type: ProductKey.CUSTOMER_ANALYTICS,
+ intent_context: ProductIntentContext.CUSTOMER_ANALYTICS_DASHBOARD_CONFIGURATION_BUTTON_CLICKED,
+ })
+ reportCustomerAnalyticsDashboardConfigurationButtonClicked()
+ }
const canViewAllCustomerTasks = userHasAccess(
AccessControlResourceType.CustomerAnalytics,
AccessControlLevel.Viewer
@@ -237,86 +247,84 @@ function CustomerAnalyticsSceneContent(): JSX.Element {
type: sceneConfigurations[Scene.CustomerAnalytics].iconType || 'default_icon_type',
}}
actions={
- <>
- <FeedbackButton id="customer-analytics-dashboard-feedback-button" />
- {activeTab === 'tasks' && <TaskDigestButton />}
- {isEditMode ? (
- <div className="flex items-center gap-2">
- <span className="text-sm text-muted font-medium whitespace-nowrap">
- {stagedNodes.length} step{stagedNodes.length !== 1 ? 's' : ''} to add
- </span>
- <LemonButton type="secondary" size="small" onClick={cancelChanges}>
- Cancel
- </LemonButton>
- <LemonButton
- type="primary"
- size="small"
- onClick={saveChanges}
- disabledReason={
- accessControlDisabledReason ??
- (stagedNodes.length === 0 ? 'No steps staged' : undefined)
- }
- loading={isSaving}
- >
- Save
- </LemonButton>
- </div>
- ) : activeTab === 'journeys' ? (
- <>
- <CustomerJourneySelect />
- <LemonButton
- type="primary"
- size="small"
- to={urls.customerJourneyTemplates()}
- data-attr="new-journey"
- disabledReason={accessControlDisabledReason}
- >
- New journey
- </LemonButton>
- {activeJourney && (
+ todayRailNav ? (
+ <QuillCustomerAnalyticsSceneActions onConfigureClick={onConfigureClick} />
+ ) : (
+ <>
+ <FeedbackButton id="customer-analytics-dashboard-feedback-button" />
+ {activeTab === 'tasks' && <TaskDigestButton />}
+ {isEditMode ? (
+ <div className="flex items-center gap-2">
+ <span className="text-sm text-muted font-medium whitespace-nowrap">
+ {stagedNodes.length} step{stagedNodes.length !== 1 ? 's' : ''} to
+ add
+ </span>
+ <LemonButton type="secondary" size="small" onClick={cancelChanges}>
+ Cancel
+ </LemonButton>
<LemonButton
- type="secondary"
+ type="primary"
+ size="small"
+ onClick={saveChanges}
+ disabledReason={
+ accessControlDisabledReason ??
+ (stagedNodes.length === 0 ? 'No steps staged' : undefined)
+ }
+ loading={isSaving}
+ >
+ Save
+ </LemonButton>
+ </div>
+ ) : activeTab === 'journeys' ? (
+ <>
+ <CustomerJourneySelect />
+ <LemonButton
+ type="primary"
size="small"
- to={`${urls.customerJourneyEdit(activeJourney.id)}?insightId=${activeJourney.insight}`}
- data-attr="edit-journey"
+ to={urls.customerJourneyTemplates()}
+ data-attr="new-journey"
+ disabledReason={accessControlDisabledReason}
>
- Edit
+ New journey
</LemonButton>
- )}
- <DeleteJourneyButton />
- </>
- ) : (
- <Shortcut
- name="CustomerAnalyticsSettings"
- keybind={[keyBinds.settings]}
- intent="Configure customer analytics"
- interaction="click"
- scope={Scene.CustomerAnalytics}
- >
- <LemonButton
- icon={<IconGear />}
- size="small"
- type="secondary"
- to={
- activeTab === 'accounts'
- ? `${urls.customerAnalyticsConfiguration()}?tab=customer-analytics-accounts`
- : urls.customerAnalyticsConfiguration()
- }
- onClick={() => {
- addProductIntent({
- product_type: ProductKey.CUSTOMER_ANALYTICS,
- intent_context:
- ProductIntentContext.CUSTOMER_ANALYTICS_DASHBOARD_CONFIGURATION_BUTTON_CLICKED,
- })
- reportCustomerAnalyticsDashboardConfigurationButtonClicked()
- }}
- tooltip="Configure customer analytics"
- children="Configure"
- data-attr="customer-analytics-config"
- />
- </Shortcut>
- )}
- </>
+ {activeJourney && (
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={`${urls.customerJourneyEdit(activeJourney.id)}?insightId=${activeJourney.insight}`}
+ data-attr="edit-journey"
+ >
+ Edit
+ </LemonButton>
+ )}
+ <DeleteJourneyButton />
+ </>
+ ) : (
+ <Shortcut
+ name="CustomerAnalyticsSettings"
+ keybind={[keyBinds.settings]}
+ intent="Configure customer analytics"
+ interaction="click"
+ scope={Scene.CustomerAnalytics}
+ >
+ <LemonButton
+ icon={<IconGear />}
+ size="small"
+ type="secondary"
+ to={
+ activeTab === 'accounts'
+ ? `${urls.customerAnalyticsConfiguration()}?tab=customer-analytics-accounts`
+ : urls.customerAnalyticsConfiguration()
+ }
+ onClick={onConfigureClick}
+ tooltip="Configure customer analytics"
+ children="Configure"
+ data-attr="customer-analytics-config"
+ />
+ </Shortcut>
+ )}
+ </>
+ )
}
/>
{tabsContent}
diff --git a/products/customer_analytics/frontend/QuillCustomerAnalyticsSceneActions.tsx b/products/customer_analytics/frontend/QuillCustomerAnalyticsSceneActions.tsx
new file mode 100644
index 000000000000..576308680df2
--- /dev/null
+++ b/products/customer_analytics/frontend/QuillCustomerAnalyticsSceneActions.tsx
@@ -0,0 +1,117 @@
+import { useActions, useValues } from 'kea'
+
+import { IconGear } from '@posthog/icons'
+import { Button, Text } from '@posthog/quill'
+
+import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { Scene } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { customerJourneysLogic } from './components/CustomerJourneys/customerJourneysLogic'
+import { DeleteJourneyButton } from './components/CustomerJourneys/DeleteJourneyButton'
+import { journeyEditorLogic } from './components/CustomerJourneys/journeyEditorLogic'
+import { QuillCustomerJourneySelect } from './components/CustomerJourneys/QuillCustomerJourneySelect'
+import { FeedbackButton } from './components/FeedbackButton'
+import { TaskDigestButton } from './components/TaskDigest/TaskDigestButton'
+import { customerAnalyticsSceneLogic } from './customerAnalyticsSceneLogic'
+
+export function QuillCustomerAnalyticsSceneActions({
+ onConfigureClick,
+}: {
+ onConfigureClick: () => void
+}): JSX.Element {
+ const { activeTab } = useValues(customerAnalyticsSceneLogic)
+ const { isEditMode, stagedNodes, isSaving } = useValues(journeyEditorLogic)
+ const { saveChanges, cancelChanges } = useActions(journeyEditorLogic)
+ const { activeJourney } = useValues(customerJourneysLogic)
+
+ const accessControlDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.CustomerAnalytics,
+ AccessControlLevel.Editor
+ )
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ <FeedbackButton id="customer-analytics-dashboard-feedback-button" />
+ {activeTab === 'tasks' && <TaskDigestButton />}
+ {isEditMode ? (
+ <div className="flex flex-wrap items-center gap-2">
+ <Text size="xs" variant="muted" weight="medium" render={<span className="whitespace-nowrap" />}>
+ {stagedNodes.length} step{stagedNodes.length !== 1 ? 's' : ''} to add
+ </Text>
+ <Button variant="outline" onClick={cancelChanges}>
+ Cancel
+ </Button>
+ <Button
+ variant="primary"
+ onClick={saveChanges}
+ disabledReason={
+ accessControlDisabledReason ?? (stagedNodes.length === 0 ? 'No steps staged' : undefined)
+ }
+ loading={isSaving}
+ >
+ Save
+ </Button>
+ </div>
+ ) : activeTab === 'journeys' ? (
+ <>
+ <QuillCustomerJourneySelect />
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.customerJourneyTemplates()} />}
+ data-attr="new-journey"
+ disabledReason={accessControlDisabledReason}
+ >
+ New journey
+ </Button>
+ {activeJourney && (
+ <Button
+ variant="outline"
+ render={
+ <LinkPrimitive
+ to={`${urls.customerJourneyEdit(activeJourney.id)}?insightId=${activeJourney.insight}`}
+ />
+ }
+ data-attr="edit-journey"
+ >
+ Edit
+ </Button>
+ )}
+ <DeleteJourneyButton />
+ </>
+ ) : (
+ <Shortcut
+ name="CustomerAnalyticsSettings"
+ keybind={[keyBinds.settings]}
+ intent="Configure customer analytics"
+ interaction="click"
+ scope={Scene.CustomerAnalytics}
+ >
+ <Button
+ variant="outline"
+ render={
+ <LinkPrimitive
+ to={
+ activeTab === 'accounts'
+ ? `${urls.customerAnalyticsConfiguration()}?tab=customer-analytics-accounts`
+ : urls.customerAnalyticsConfiguration()
+ }
+ />
+ }
+ onClick={onConfigureClick}
+ tooltip="Configure customer analytics"
+ data-attr="customer-analytics-config"
+ >
+ <IconGear />
+ Configure
+ </Button>
+ </Shortcut>
+ )}
+ </div>
+ )
+}
diff --git a/products/customer_analytics/frontend/components/CustomerJourneys/DeleteJourneyButton.tsx b/products/customer_analytics/frontend/components/CustomerJourneys/DeleteJourneyButton.tsx
index caa90cc2ab86..30460ee09926 100644
--- a/products/customer_analytics/frontend/components/CustomerJourneys/DeleteJourneyButton.tsx
+++ b/products/customer_analytics/frontend/components/CustomerJourneys/DeleteJourneyButton.tsx
@@ -1,18 +1,26 @@
import { useActions, useValues } from 'kea'
-import { LemonButton, LemonDialog } from '@posthog/lemon-ui'
+import { LemonButton } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { AccessControlLevel, AccessControlResourceType } from '~/types'
import { customerJourneysLogic } from './customerJourneysLogic'
+import { openDeleteJourneyDialog } from './openDeleteJourneyDialog'
+import { QuillDeleteJourneyButton } from './QuillDeleteJourneyButton'
export function DeleteJourneyButton(): JSX.Element | null {
const { activeJourney } = useValues(customerJourneysLogic)
const { deleteJourney } = useActions(customerJourneysLogic)
const { reportCustomerJourneyDeleted } = useActions(eventUsageLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ if (todayRailNav) {
+ return <QuillDeleteJourneyButton />
+ }
if (!activeJourney) {
return null
@@ -30,20 +38,10 @@ export function DeleteJourneyButton(): JSX.Element | null {
status="danger"
disabledReason={accessControlDisabledReason}
onClick={() =>
- LemonDialog.open({
- title: 'Delete customer journey',
- content: 'Are you sure you want to delete this journey? This action cannot be undone.',
- primaryButton: {
- children: 'Delete',
- onClick: () => {
- reportCustomerJourneyDeleted(activeJourney.id)
- deleteJourney(activeJourney.id)
- },
- status: 'danger',
- },
- secondaryButton: {
- children: 'Cancel',
- },
+ openDeleteJourneyDialog({
+ journeyId: activeJourney.id,
+ deleteJourney,
+ reportCustomerJourneyDeleted,
})
}
tooltip="Delete this journey"
diff --git a/products/customer_analytics/frontend/components/CustomerJourneys/QuillCustomerJourneySelect.tsx b/products/customer_analytics/frontend/components/CustomerJourneys/QuillCustomerJourneySelect.tsx
new file mode 100644
index 000000000000..6ec2099d2a65
--- /dev/null
+++ b/products/customer_analytics/frontend/components/CustomerJourneys/QuillCustomerJourneySelect.tsx
@@ -0,0 +1,39 @@
+import { useActions, useValues } from 'kea'
+
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@posthog/quill'
+
+import { customerJourneysLogic } from './customerJourneysLogic'
+
+export function QuillCustomerJourneySelect(): JSX.Element | null {
+ const { activeJourneyId, journeys } = useValues(customerJourneysLogic)
+ const { setActiveJourneyId } = useActions(customerJourneysLogic)
+
+ if (journeys.length === 0) {
+ return null
+ }
+
+ const items = journeys.map((journey) => ({ value: journey.id, label: journey.name }))
+
+ return (
+ <Select<string>
+ items={items}
+ value={activeJourneyId}
+ onValueChange={(value) => {
+ if (value) {
+ setActiveJourneyId(value)
+ }
+ }}
+ >
+ <SelectTrigger className="max-w-60">
+ <SelectValue className="truncate" />
+ </SelectTrigger>
+ <SelectContent>
+ {items.map((item) => (
+ <SelectItem key={item.value} value={item.value}>
+ {item.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )
+}
diff --git a/products/customer_analytics/frontend/components/CustomerJourneys/QuillDeleteJourneyButton.tsx b/products/customer_analytics/frontend/components/CustomerJourneys/QuillDeleteJourneyButton.tsx
new file mode 100644
index 000000000000..a05a0842fa27
--- /dev/null
+++ b/products/customer_analytics/frontend/components/CustomerJourneys/QuillDeleteJourneyButton.tsx
@@ -0,0 +1,43 @@
+import { useActions, useValues } from 'kea'
+
+import { Button } from '@posthog/quill'
+
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { customerJourneysLogic } from './customerJourneysLogic'
+import { openDeleteJourneyDialog } from './openDeleteJourneyDialog'
+
+export function QuillDeleteJourneyButton(): JSX.Element | null {
+ const { activeJourney } = useValues(customerJourneysLogic)
+ const { deleteJourney } = useActions(customerJourneysLogic)
+ const { reportCustomerJourneyDeleted } = useActions(eventUsageLogic)
+
+ if (!activeJourney) {
+ return null
+ }
+
+ const accessControlDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.CustomerAnalytics,
+ AccessControlLevel.Editor
+ )
+
+ return (
+ <Button
+ variant="destructive-outline"
+ disabledReason={accessControlDisabledReason}
+ onClick={() =>
+ openDeleteJourneyDialog({
+ journeyId: activeJourney.id,
+ deleteJourney,
+ reportCustomerJourneyDeleted,
+ })
+ }
+ tooltip="Delete this journey"
+ >
+ Delete journey
+ </Button>
+ )
+}
diff --git a/products/customer_analytics/frontend/components/CustomerJourneys/openDeleteJourneyDialog.ts b/products/customer_analytics/frontend/components/CustomerJourneys/openDeleteJourneyDialog.ts
new file mode 100644
index 000000000000..4a4c20fd24b6
--- /dev/null
+++ b/products/customer_analytics/frontend/components/CustomerJourneys/openDeleteJourneyDialog.ts
@@ -0,0 +1,27 @@
+import { LemonDialog } from '@posthog/lemon-ui'
+
+export function openDeleteJourneyDialog({
+ journeyId,
+ deleteJourney,
+ reportCustomerJourneyDeleted,
+}: {
+ journeyId: string
+ deleteJourney: (journeyId: string) => void
+ reportCustomerJourneyDeleted: (journeyId: string) => void
+}): void {
+ LemonDialog.open({
+ title: 'Delete customer journey',
+ content: 'Are you sure you want to delete this journey? This action cannot be undone.',
+ primaryButton: {
+ children: 'Delete',
+ onClick: () => {
+ reportCustomerJourneyDeleted(journeyId)
+ deleteJourney(journeyId)
+ },
+ status: 'danger',
+ },
+ secondaryButton: {
+ children: 'Cancel',
+ },
+ })
+}
diff --git a/products/customer_analytics/frontend/components/FeedbackButton.tsx b/products/customer_analytics/frontend/components/FeedbackButton.tsx
index 3077e103dc0a..9ed7d80d28c5 100644
--- a/products/customer_analytics/frontend/components/FeedbackButton.tsx
+++ b/products/customer_analytics/frontend/components/FeedbackButton.tsx
@@ -1,6 +1,14 @@
import { LemonButton } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+
+import { QuillFeedbackButton } from './QuillFeedbackButton'
+
export function FeedbackButton({ id }: { id: string }): JSX.Element {
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillFeedbackButton id={id} />
+ }
return (
<LemonButton size="small" id={id} tooltip="Have any questions or feedback?">
Feedback
diff --git a/products/customer_analytics/frontend/components/QuillFeedbackButton.tsx b/products/customer_analytics/frontend/components/QuillFeedbackButton.tsx
new file mode 100644
index 000000000000..fe175e30d42f
--- /dev/null
+++ b/products/customer_analytics/frontend/components/QuillFeedbackButton.tsx
@@ -0,0 +1,9 @@
+import { Button } from '@posthog/quill'
+
+export function QuillFeedbackButton({ id }: { id: string }): JSX.Element {
+ return (
+ <Button id={id} tooltip="Have any questions or feedback?">
+ Feedback
+ </Button>
+ )
+}
diff --git a/products/customer_analytics/frontend/components/TaskDigest/QuillTaskDigestButton.tsx b/products/customer_analytics/frontend/components/TaskDigest/QuillTaskDigestButton.tsx
new file mode 100644
index 000000000000..872040f80eac
--- /dev/null
+++ b/products/customer_analytics/frontend/components/TaskDigest/QuillTaskDigestButton.tsx
@@ -0,0 +1,28 @@
+import posthog from 'posthog-js'
+import { useState } from 'react'
+
+import { IconBell } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { AccountsEvents } from '../Accounts/constants'
+import { TaskDigestModal } from './TaskDigestModal'
+
+export function QuillTaskDigestButton(): JSX.Element {
+ const [isOpen, setIsOpen] = useState(false)
+
+ return (
+ <>
+ <Button
+ data-attr="customer-analytics-email-digest"
+ onClick={() => {
+ posthog.capture(AccountsEvents.TaskDigestOpened, { source: 'tasks' })
+ setIsOpen(true)
+ }}
+ >
+ <IconBell />
+ Email digest
+ </Button>
+ {isOpen && <TaskDigestModal onClose={() => setIsOpen(false)} />}
+ </>
+ )
+}
diff --git a/products/customer_analytics/frontend/components/TaskDigest/TaskDigestButton.tsx b/products/customer_analytics/frontend/components/TaskDigest/TaskDigestButton.tsx
index ecdc1c8c9c09..20d9f56eaa66 100644
--- a/products/customer_analytics/frontend/components/TaskDigest/TaskDigestButton.tsx
+++ b/products/customer_analytics/frontend/components/TaskDigest/TaskDigestButton.tsx
@@ -4,11 +4,19 @@ import { useState } from 'react'
import { IconBell } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+
import { AccountsEvents } from '../Accounts/constants'
+import { QuillTaskDigestButton } from './QuillTaskDigestButton'
import { TaskDigestModal } from './TaskDigestModal'
export function TaskDigestButton(): JSX.Element {
const [isOpen, setIsOpen] = useState(false)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ if (todayRailNav) {
+ return <QuillTaskDigestButton />
+ }
return (
<>
diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/AccountDetailActions.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/AccountDetailActions.tsx
index ae4edc73eb45..58c8c2c78e04 100644
--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/AccountDetailActions.tsx
+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/AccountDetailActions.tsx
@@ -4,9 +4,11 @@ import { IconGear, IconPlus } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { accountViewsLogic } from './accountViewsLogic'
+import { QuillAccountDetailActions } from './QuillAccountDetailActions'
interface AccountDetailActionsProps {
projectId: number
@@ -17,6 +19,11 @@ export function AccountDetailActions({ projectId }: AccountDetailActionsProps):
const logic = accountViewsLogic({ projectId })
const { accountDetailTabs, config, configError, configLoading } = useValues(logic)
const { openConfigure, openCreateEditor } = useActions(logic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ if (todayRailNav) {
+ return <QuillAccountDetailActions projectId={projectId} />
+ }
if (!featureFlags[FEATURE_FLAGS.CUSTOMER_ANALYTICS_ACCOUNT_VIEWS]) {
return null
diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/QuillAccountDetailActions.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/QuillAccountDetailActions.tsx
new file mode 100644
index 000000000000..3b5de3f7ddc8
--- /dev/null
+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/QuillAccountDetailActions.tsx
@@ -0,0 +1,42 @@
+import { useActions, useValues } from 'kea'
+
+import { IconGear, IconPlus } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+
+import { accountViewsLogic } from './accountViewsLogic'
+
+interface QuillAccountDetailActionsProps {
+ projectId: number
+}
+
+export function QuillAccountDetailActions({ projectId }: QuillAccountDetailActionsProps): JSX.Element | null {
+ const { featureFlags } = useValues(featureFlagLogic)
+ const logic = accountViewsLogic({ projectId })
+ const { accountDetailTabs, config, configError, configLoading } = useValues(logic)
+ const { openConfigure, openCreateEditor } = useActions(logic)
+
+ if (!featureFlags[FEATURE_FLAGS.CUSTOMER_ANALYTICS_ACCOUNT_VIEWS]) {
+ return null
+ }
+
+ return (
+ <>
+ <Button
+ variant="outline"
+ data-attr="account-detail-configure-tabs"
+ disabledReason={configLoading || (!config && !configError) ? 'Loading tab settings' : undefined}
+ onClick={() => openConfigure(config && !configError ? accountDetailTabs : null)}
+ >
+ <IconGear />
+ Configure tabs
+ </Button>
+ <Button variant="primary" data-attr="account-detail-add-view" onClick={openCreateEditor}>
+ <IconPlus />
+ New view
+ </Button>
+ </>
+ )
+}
diff --git a/products/customer_analytics/frontend/scenes/CustomerJourneyBuilderScene/CustomerJourneyBuilderScene.tsx b/products/customer_analytics/frontend/scenes/CustomerJourneyBuilderScene/CustomerJourneyBuilderScene.tsx
index 1dbf212dbd33..a5fe0219427f 100644
--- a/products/customer_analytics/frontend/scenes/CustomerJourneyBuilderScene/CustomerJourneyBuilderScene.tsx
+++ b/products/customer_analytics/frontend/scenes/CustomerJourneyBuilderScene/CustomerJourneyBuilderScene.tsx
@@ -1,7 +1,9 @@
import { useActions, useValues } from 'kea'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
import { FeaturePreviewSceneGate } from '~/layout/scenes/components/FeaturePreviewSceneGate'
@@ -32,6 +34,7 @@ export function CustomerJourneyBuilderScene(): JSX.Element {
function CustomerJourneyBuilderSceneContent(): JSX.Element {
const { journeyName, journeyDescription, isSaving, isEditMode } = useValues(journeyBuilderLogic)
const { setJourneyName, setJourneyDescription, saveJourney } = useActions(journeyBuilderLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const accessControlDisabledReason = getAccessControlDisabledReason(
AccessControlResourceType.CustomerAnalytics,
@@ -52,16 +55,28 @@ function CustomerJourneyBuilderSceneContent(): JSX.Element {
renameDebounceMs={0}
saveOnBlur
actions={
- <LemonButton
- type="primary"
- size="small"
- loading={isSaving}
- onClick={() => saveJourney()}
- data-attr="journey-builder-save"
- disabledReason={accessControlDisabledReason}
- >
- {isEditMode ? 'Update' : 'Save'}
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="primary"
+ loading={isSaving}
+ onClick={() => saveJourney()}
+ data-attr="journey-builder-save"
+ disabledReason={accessControlDisabledReason}
+ >
+ {isEditMode ? 'Update' : 'Save'}
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ size="small"
+ loading={isSaving}
+ onClick={() => saveJourney()}
+ data-attr="journey-builder-save"
+ disabledReason={accessControlDisabledReason}
+ >
+ {isEditMode ? 'Update' : 'Save'}
+ </LemonButton>
+ )
}
/>
<JourneyBuilder />
diff --git a/products/customer_analytics/package.json b/products/customer_analytics/package.json
index 5d5034b98567..30a95a2a93aa 100644
--- a/products/customer_analytics/package.json
+++ b/products/customer_analytics/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
diff --git a/products/data_catalog/frontend/DataCatalogScene.tsx b/products/data_catalog/frontend/DataCatalogScene.tsx
index 84e43f37f45c..a48e22bd9388 100644
--- a/products/data_catalog/frontend/DataCatalogScene.tsx
+++ b/products/data_catalog/frontend/DataCatalogScene.tsx
@@ -1,9 +1,11 @@
import { BindLogic, useActions, useValues } from 'kea'
import { useMemo } from 'react'
-import { IconPlusSmall } from '@posthog/icons'
+import { IconPlus, IconPlusSmall } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonBadge } from 'lib/lemon-ui/LemonBadge'
import { LemonTab, LemonTabs } from 'lib/lemon-ui/LemonTabs'
import { SceneExport } from 'scenes/sceneTypes'
@@ -49,6 +51,7 @@ export function DataCatalogScene(): JSX.Element {
const { proposedCount: certificationsPending } = useValues(certificationsLogic)
const { openNewMetricModal: openMetricModal } = useActions(metricsLogic)
const contextItems = useMemo(() => buildDataCatalogAgentContext(activeTab), [activeTab])
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
useSceneAgentPanel({
sceneKey: 'data-catalog',
@@ -85,15 +88,26 @@ export function DataCatalogScene(): JSX.Element {
description="Review and manage governed metrics, certifications, and relationships for your data."
resourceType={{ type: 'data_warehouse' }}
actions={
- <LemonButton
- type="primary"
- size="small"
- icon={<IconPlusSmall />}
- onClick={openMetricModal}
- data-attr="data-catalog-new-metric-button"
- >
- New metric
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="primary"
+ onClick={openMetricModal}
+ data-attr="data-catalog-new-metric-button"
+ >
+ <IconPlus />
+ New metric
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ size="small"
+ icon={<IconPlusSmall />}
+ onClick={openMetricModal}
+ data-attr="data-catalog-new-metric-button"
+ >
+ New metric
+ </LemonButton>
+ )
}
/>
<LemonTabs
diff --git a/products/data_catalog/package.json b/products/data_catalog/package.json
index 8af6e51b81e3..92f2046b8aa5 100644
--- a/products/data_catalog/package.json
+++ b/products/data_catalog/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/tests scripts/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
"kea-router": "catalog:",
diff --git a/products/data_modeling/frontend/ModelsScene.tsx b/products/data_modeling/frontend/ModelsScene.tsx
index c766f8e1940d..cd20523d9bdf 100644
--- a/products/data_modeling/frontend/ModelsScene.tsx
+++ b/products/data_modeling/frontend/ModelsScene.tsx
@@ -2,11 +2,14 @@ import { useValues } from 'kea'
import { useCallback } from 'react'
import { LemonButton, LemonTab, LemonTabs } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { AccessDenied } from 'lib/components/AccessDenied'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { userHasAccess } from 'lib/utils/accessControlUtils'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
@@ -41,6 +44,7 @@ export function ModelsScene(): JSX.Element {
},
[savedQueryIdToNodeId]
)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!userHasAccess(AccessControlResourceType.WarehouseObjects, AccessControlLevel.Viewer)) {
return (
@@ -105,15 +109,26 @@ export function ModelsScene(): JSX.Element {
resourceType={AccessControlResourceType.WarehouseObjects}
minAccessLevel={AccessControlLevel.Editor}
>
- <LemonButton
- type="primary"
- to={urls.sqlEditor({ source: 'view' })}
- size="small"
- tooltip="Create view"
- data-attr="new-view-button"
- >
- Create view
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.sqlEditor({ source: 'view' })} />}
+ tooltip="Create view"
+ data-attr="new-view-button"
+ >
+ Create view
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ to={urls.sqlEditor({ source: 'view' })}
+ size="small"
+ tooltip="Create view"
+ data-attr="new-view-button"
+ >
+ Create view
+ </LemonButton>
+ )}
</AccessControlAction>
</Shortcut>
</div>
diff --git a/products/data_modeling/frontend/nodeDetail/NodeDetailActions.tsx b/products/data_modeling/frontend/nodeDetail/NodeDetailActions.tsx
index 524663caefc0..dc6a680fdece 100644
--- a/products/data_modeling/frontend/nodeDetail/NodeDetailActions.tsx
+++ b/products/data_modeling/frontend/nodeDetail/NodeDetailActions.tsx
@@ -3,6 +3,7 @@ import { useValues } from 'kea'
import { LemonButton } from '@posthog/lemon-ui'
import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { materializationJobsLogic } from 'scenes/data-warehouse/saved_queries/materializationJobsLogic'
import { urls } from 'scenes/urls'
@@ -11,6 +12,8 @@ import { AccessControlLevel, AccessControlResourceType, DataModelingNode, DataWa
import { nodeEndpointUrl } from 'products/data_modeling/frontend/endpointModelName'
import { MaterializationRunActions } from 'products/data_warehouse/frontend/shared/components/MaterializationRunActions'
+import { QuillNodeDetailActions } from './QuillNodeDetailActions'
+
export function NodeDetailActions({
node,
savedQuery,
@@ -21,6 +24,10 @@ export function NodeDetailActions({
const { hasMaterializationChanges, savingMaterialization } = useValues(
materializationJobsLogic({ viewId: savedQuery.id, kind: node.type === 'endpoint' ? 'endpoint' : 'view' })
)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillNodeDetailActions node={node} savedQuery={savedQuery} />
+ }
return (
<>
{node.type === 'endpoint' ? (
diff --git a/products/data_modeling/frontend/nodeDetail/NodeDetailHeader.tsx b/products/data_modeling/frontend/nodeDetail/NodeDetailHeader.tsx
index 61bf5737b723..c39adce11e4a 100644
--- a/products/data_modeling/frontend/nodeDetail/NodeDetailHeader.tsx
+++ b/products/data_modeling/frontend/nodeDetail/NodeDetailHeader.tsx
@@ -1,8 +1,10 @@
import { useActions, useValues } from 'kea'
import { LemonSkeleton, LemonTag } from '@posthog/lemon-ui'
+import { Skeleton } from '@posthog/quill'
import { SceneActivityIndicator } from 'lib/components/Scenes/SceneUpdateActivityInfo'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { userHasAccess } from 'lib/utils/accessControlUtils'
import { materializationJobsLogic } from 'scenes/data-warehouse/saved_queries/materializationJobsLogic'
@@ -22,6 +24,7 @@ export function NodeDetailHeader({ id }: { id: string }): JSX.Element {
savedQueryError,
} = useValues(nodeDetailSceneLogic({ id }))
const { updateNodeDescription } = useActions(nodeDetailSceneLogic({ id }))
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const { savedQuery: currentSavedQuery } = useValues(
materializationJobsLogic({
@@ -58,7 +61,11 @@ export function NodeDetailHeader({ id }: { id: string }): JSX.Element {
node && savedQuery ? (
<NodeDetailActions node={node} savedQuery={savedQuery} />
) : node?.saved_query_id && !savedQueryError ? (
- <LemonSkeleton className="h-8 w-56" />
+ todayRailNav ? (
+ <Skeleton className="h-8 w-56" />
+ ) : (
+ <LemonSkeleton className="h-8 w-56" />
+ )
) : undefined
}
description={node?.description}
diff --git a/products/data_modeling/frontend/nodeDetail/QuillNodeDetailActions.tsx b/products/data_modeling/frontend/nodeDetail/QuillNodeDetailActions.tsx
new file mode 100644
index 000000000000..537b8651ddc0
--- /dev/null
+++ b/products/data_modeling/frontend/nodeDetail/QuillNodeDetailActions.tsx
@@ -0,0 +1,63 @@
+import { useValues } from 'kea'
+
+import { Button } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { materializationJobsLogic } from 'scenes/data-warehouse/saved_queries/materializationJobsLogic'
+import { urls } from 'scenes/urls'
+
+import { AccessControlLevel, AccessControlResourceType, DataModelingNode, DataWarehouseSavedQuery } from '~/types'
+
+import { nodeEndpointUrl } from 'products/data_modeling/frontend/endpointModelName'
+import { MaterializationRunActions } from 'products/data_warehouse/frontend/shared/components/MaterializationRunActions'
+
+export function QuillNodeDetailActions({
+ node,
+ savedQuery,
+}: {
+ node: DataModelingNode
+ savedQuery: DataWarehouseSavedQuery
+}): JSX.Element {
+ const { hasMaterializationChanges, savingMaterialization } = useValues(
+ materializationJobsLogic({ viewId: savedQuery.id, kind: node.type === 'endpoint' ? 'endpoint' : 'view' })
+ )
+ const editDisabledReason =
+ hasMaterializationChanges || savingMaterialization
+ ? 'Save or discard your changes first'
+ : getAccessControlDisabledReason(
+ AccessControlResourceType.WarehouseObjects,
+ AccessControlLevel.Editor,
+ savedQuery.user_access_level
+ )
+ return (
+ <>
+ {node.type === 'endpoint' ? (
+ <Button variant="outline" render={<LinkPrimitive to={nodeEndpointUrl(node)} />}>
+ Open endpoint
+ </Button>
+ ) : (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.WarehouseObjects}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={savedQuery.user_access_level}
+ >
+ <Button
+ variant="outline"
+ render={
+ <LinkPrimitive
+ to={editDisabledReason ? undefined : urls.sqlEditor({ view_id: savedQuery.id })}
+ />
+ }
+ disabledReason={editDisabledReason ?? undefined}
+ data-attr="node-detail-edit-in-sql-editor"
+ >
+ Edit in SQL editor
+ </Button>
+ </AccessControlAction>
+ )}
+ <MaterializationRunActions viewId={savedQuery.id} kind={node.type === 'endpoint' ? 'endpoint' : 'view'} />
+ </>
+ )
+}
diff --git a/products/data_modeling/package.json b/products/data_modeling/package.json
index 300851762dbc..266f9f2a672e 100644
--- a/products/data_modeling/package.json
+++ b/products/data_modeling/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
index 511b2dc21aed..e7b2400eb1c9 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
@@ -13,9 +13,11 @@ import {
Link,
Tooltip,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { CodeSnippet } from 'lib/components/CodeSnippet'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useFloatingContainer } from 'lib/hooks/useFloatingContainerContext'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
@@ -172,6 +174,7 @@ function InternalNewSourceScene({
sourceWizardLogicProps: SourceWizardLogicProps
}): JSX.Element {
const { closeWizard } = useActions(sourceWizardLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<SceneContent>
@@ -179,15 +182,21 @@ function InternalNewSourceScene({
name="New data warehouse source"
resourceType={{ type: 'data_pipeline' }}
actions={
- <LemonButton
- type="secondary"
- center
- data-attr="source-form-cancel-button"
- onClick={closeWizard}
- size="small"
- >
- Cancel
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="outline" data-attr="source-form-cancel-button" onClick={closeWizard}>
+ Cancel
+ </Button>
+ ) : (
+ <LemonButton
+ type="secondary"
+ center
+ data-attr="source-form-cancel-button"
+ onClick={closeWizard}
+ size="small"
+ >
+ Cancel
+ </LemonButton>
+ )
}
/>
<InternalSourcesWizard sourceWizardLogicProps={sourceWizardLogicProps} />
diff --git a/products/data_warehouse/frontend/scenes/SourcesScene/SourcesScene.tsx b/products/data_warehouse/frontend/scenes/SourcesScene/SourcesScene.tsx
index 54a6bb62c31e..201d5d933da0 100644
--- a/products/data_warehouse/frontend/scenes/SourcesScene/SourcesScene.tsx
+++ b/products/data_warehouse/frontend/scenes/SourcesScene/SourcesScene.tsx
@@ -1,8 +1,11 @@
-import { IconPlusSmall } from '@posthog/icons'
+import { IconPlus, IconPlusSmall } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -23,6 +26,7 @@ export const scene: SceneExport = {
}
export function SourcesScene(): JSX.Element {
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const action = (
<Shortcut
name="NewPipelineSource"
@@ -31,16 +35,28 @@ export function SourcesScene(): JSX.Element {
interaction="click"
scope={Scene.Sources}
>
- <LemonButton
- type="primary"
- to={urls.dataPipelinesNew('source')}
- icon={<IconPlusSmall />}
- size="small"
- tooltip="New source"
- data-attr="new-source"
- >
- New source
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.dataPipelinesNew('source')} />}
+ tooltip="New source"
+ data-attr="new-source"
+ >
+ <IconPlus />
+ New source
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ to={urls.dataPipelinesNew('source')}
+ icon={<IconPlusSmall />}
+ size="small"
+ tooltip="New source"
+ data-attr="new-source"
+ >
+ New source
+ </LemonButton>
+ )}
</Shortcut>
)
diff --git a/products/data_warehouse/frontend/scenes/WarehouseDestinationsScene/WarehouseDestinationsScene.tsx b/products/data_warehouse/frontend/scenes/WarehouseDestinationsScene/WarehouseDestinationsScene.tsx
index eed688340bb8..5761b036e345 100644
--- a/products/data_warehouse/frontend/scenes/WarehouseDestinationsScene/WarehouseDestinationsScene.tsx
+++ b/products/data_warehouse/frontend/scenes/WarehouseDestinationsScene/WarehouseDestinationsScene.tsx
@@ -1,10 +1,12 @@
import { useActions, useValues } from 'kea'
-import { IconPlusSmall } from '@posthog/icons'
+import { IconPlus, IconPlusSmall } from '@posthog/icons'
import { LemonBanner, LemonButton, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -31,6 +33,7 @@ export function WarehouseDestinationsScene(): JSX.Element {
const modalProps = { modalKey: MODAL_KEY, onSaved: () => loadDestinations() }
const { openForCreate, openForEdit } = useActions(destinationModalLogic(modalProps))
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!featureFlags[FEATURE_FLAGS.WAREHOUSE_MULTI_DESTINATION]) {
return <NotFound object="page" caption="Warehouse destinations isn't available for this project yet." />
@@ -54,7 +57,16 @@ export function WarehouseDestinationsScene(): JSX.Element {
name="Warehouse destinations"
description="Destinations are where your warehouse sources write the rows they sync. Pick which ones a source or a single table uses from that source's Destinations tab."
resourceType={{ type: 'data_warehouse' }}
- actions={newDestinationButton}
+ actions={
+ todayRailNav ? (
+ <Button variant="primary" onClick={openForCreate} data-attr="warehouse-destinations-scene-new">
+ <IconPlus />
+ New destination
+ </Button>
+ ) : (
+ newDestinationButton
+ )
+ }
/>
{loadError ? (
diff --git a/products/early_access_features/frontend/EarlyAccessFeature.tsx b/products/early_access_features/frontend/EarlyAccessFeature.tsx
index 9573f3a14628..391fa79baf8c 100644
--- a/products/early_access_features/frontend/EarlyAccessFeature.tsx
+++ b/products/early_access_features/frontend/EarlyAccessFeature.tsx
@@ -24,6 +24,7 @@ import { SceneMenuBarFileItems } from 'lib/components/Scenes/SceneMenuBarFileIte
import { SceneMetalyticsSummaryButton } from 'lib/components/Scenes/SceneMetalyticsSummaryButton'
import { SceneSelect } from 'lib/components/Scenes/SceneSelect'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useFileSystemLogView } from 'lib/hooks/useFileSystemLogView'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
import { LemonField } from 'lib/lemon-ui/LemonField'
@@ -87,6 +88,7 @@ import { draftMessage } from 'products/workflows/frontend/MessageAudience/messag
import { EarlyAccessFeatureLogicProps, earlyAccessFeatureLogic } from './earlyAccessFeatureLogic'
import { InstructionsModal } from './InstructionsModal'
+import { QuillEarlyAccessFeatureActions } from './QuillEarlyAccessFeatureActions'
const RESOURCE_TYPE = 'early-access-feature'
@@ -231,9 +233,19 @@ export function EarlyAccessFeature({ id }: EarlyAccessFeatureLogicProps): JSX.El
const { canCopyToProject } = useValues(interProjectCopyLogic)
const { featureFlags } = useValues(featureFlagLogic)
const sceneMenuBarEnabled = !!featureFlags[FEATURE_FLAGS.SCENE_MENU_BAR]
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const isNewEarlyAccessFeature = id === 'new' || id === undefined
+ const cancelEditing = (): void => {
+ if (isEditingFeature) {
+ editFeature(false)
+ loadEarlyAccessFeature()
+ } else {
+ router.actions.push(urls.earlyAccessFeatures())
+ }
+ }
+
// Determine if Save/Cancel buttons should be visible
const wasOriginallyGA = originalEarlyAccessFeatureStage === EarlyAccessFeatureStage.GeneralAvailability
const canShowSaveButtons = !wasOriginallyGA && (isNewEarlyAccessFeature || isEditingFeature)
@@ -355,118 +367,122 @@ export function EarlyAccessFeature({ id }: EarlyAccessFeatureLogicProps): JSX.El
}}
forceEdit={isEditingFeature || isNewEarlyAccessFeature}
actions={
- <>
- {!earlyAccessFeatureLoading ? (
- canShowSaveButtons ? (
- <>
- <LemonButton
- type="secondary"
- data-attr="cancel-feature"
- onClick={() => {
- if (isEditingFeature) {
- editFeature(false)
- loadEarlyAccessFeature()
- } else {
- router.actions.push(urls.earlyAccessFeatures())
- }
- }}
- size="small"
- disabledReason={isEarlyAccessFeatureSubmitting ? 'Saving…' : undefined}
- >
- Cancel
- </LemonButton>
- <AccessControlAction
- resourceType={AccessControlResourceType.EarlyAccessFeature}
- minAccessLevel={AccessControlLevel.Editor}
- userAccessLevel={userAccessLevel}
- >
+ todayRailNav ? (
+ <QuillEarlyAccessFeatureActions
+ isNewEarlyAccessFeature={isNewEarlyAccessFeature}
+ canShowSaveButtons={canShowSaveButtons}
+ userAccessLevel={userAccessLevel}
+ accessControlDisabledReason={accessControlDisabledReason}
+ onCancel={cancelEditing}
+ />
+ ) : (
+ <>
+ {!earlyAccessFeatureLoading ? (
+ canShowSaveButtons ? (
+ <>
<LemonButton
- type="primary"
- onClick={submitEarlyAccessFeature}
- data-attr="save-feature"
- loading={isEarlyAccessFeatureSubmitting}
+ type="secondary"
+ data-attr="cancel-feature"
+ onClick={cancelEditing}
size="small"
+ disabledReason={isEarlyAccessFeatureSubmitting ? 'Saving…' : undefined}
>
- {isNewEarlyAccessFeature ? 'Save as draft' : 'Save'}
+ Cancel
</LemonButton>
- </AccessControlAction>
- </>
- ) : (
- <>
- {earlyAccessFeature.stage == EarlyAccessFeatureStage.Draft && (
- <LemonMenu
- items={[
- {
- title: 'Choose stage',
- items: [
- {
- label: 'Concept',
- tooltip:
- 'Users can opt in to register interest, but the feature flag will not be enabled for them.',
- onClick: () =>
- updateStage(EarlyAccessFeatureStage.Concept),
- },
- {
- label: 'Alpha',
- tooltip:
- 'Early testing. Opted-in users will have the feature flag enabled.',
- onClick: () =>
- updateStage(EarlyAccessFeatureStage.Alpha),
- },
- {
- label: 'Beta (default)',
- tooltip:
- 'Wider testing. Opted-in users will have the feature flag enabled.',
- onClick: () =>
- updateStage(EarlyAccessFeatureStage.Beta),
- },
- {
- label: 'General availability',
- tooltip:
- 'Feature becomes read-only. All opted-in users retain access.',
- onClick: () =>
- updateStage(
- EarlyAccessFeatureStage.GeneralAvailability
- ),
- },
- ],
- },
- ]}
- >
- {/* The trigger must stay the direct child of LemonMenu — it
- clones the trigger to inject the menu-toggle onClick, which an
- AccessControlAction wrapper would swallow. Gate via disabledReason. */}
- <LemonButton
- tooltip="Publish this feature to make it available"
- type="primary"
- size="small"
- disabledReason={accessControlDisabledReason ?? undefined}
- >
- Release
- </LemonButton>
- </LemonMenu>
- )}
- {earlyAccessFeature.stage != EarlyAccessFeatureStage.GeneralAvailability && (
<AccessControlAction
resourceType={AccessControlResourceType.EarlyAccessFeature}
minAccessLevel={AccessControlLevel.Editor}
userAccessLevel={userAccessLevel}
>
<LemonButton
- type="secondary"
- onClick={() => editFeature(true)}
- loading={false}
- data-attr="edit-feature"
+ type="primary"
+ onClick={submitEarlyAccessFeature}
+ data-attr="save-feature"
+ loading={isEarlyAccessFeatureSubmitting}
size="small"
>
- Edit
+ {isNewEarlyAccessFeature ? 'Save as draft' : 'Save'}
</LemonButton>
</AccessControlAction>
- )}
- </>
- )
- ) : undefined}
- </>
+ </>
+ ) : (
+ <>
+ {earlyAccessFeature.stage == EarlyAccessFeatureStage.Draft && (
+ <LemonMenu
+ items={[
+ {
+ title: 'Choose stage',
+ items: [
+ {
+ label: 'Concept',
+ tooltip:
+ 'Users can opt in to register interest, but the feature flag will not be enabled for them.',
+ onClick: () =>
+ updateStage(EarlyAccessFeatureStage.Concept),
+ },
+ {
+ label: 'Alpha',
+ tooltip:
+ 'Early testing. Opted-in users will have the feature flag enabled.',
+ onClick: () =>
+ updateStage(EarlyAccessFeatureStage.Alpha),
+ },
+ {
+ label: 'Beta (default)',
+ tooltip:
+ 'Wider testing. Opted-in users will have the feature flag enabled.',
+ onClick: () =>
+ updateStage(EarlyAccessFeatureStage.Beta),
+ },
+ {
+ label: 'General availability',
+ tooltip:
+ 'Feature becomes read-only. All opted-in users retain access.',
+ onClick: () =>
+ updateStage(
+ EarlyAccessFeatureStage.GeneralAvailability
+ ),
+ },
+ ],
+ },
+ ]}
+ >
+ {/* The trigger must stay the direct child of LemonMenu — it
+ clones the trigger to inject the menu-toggle onClick, which an
+ AccessControlAction wrapper would swallow. Gate via disabledReason. */}
+ <LemonButton
+ tooltip="Publish this feature to make it available"
+ type="primary"
+ size="small"
+ disabledReason={accessControlDisabledReason ?? undefined}
+ >
+ Release
+ </LemonButton>
+ </LemonMenu>
+ )}
+ {earlyAccessFeature.stage !=
+ EarlyAccessFeatureStage.GeneralAvailability && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.EarlyAccessFeature}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={userAccessLevel}
+ >
+ <LemonButton
+ type="secondary"
+ onClick={() => editFeature(true)}
+ loading={false}
+ data-attr="edit-feature"
+ size="small"
+ >
+ Edit
+ </LemonButton>
+ </AccessControlAction>
+ )}
+ </>
+ )
+ ) : undefined}
+ </>
+ )
}
/>
diff --git a/products/early_access_features/frontend/EarlyAccessFeatures.tsx b/products/early_access_features/frontend/EarlyAccessFeatures.tsx
index 597ca51821d5..0e65b07e173d 100644
--- a/products/early_access_features/frontend/EarlyAccessFeatures.tsx
+++ b/products/early_access_features/frontend/EarlyAccessFeatures.tsx
@@ -1,12 +1,15 @@
import { useActions, useValues } from 'kea'
import { LemonButton, LemonInput, LemonTable, LemonTag, Link, Spinner, Tooltip } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { createdAtColumn } from 'lib/lemon-ui/LemonTable/columnUtils'
import { LemonTableLink } from 'lib/lemon-ui/LemonTable/LemonTableLink'
import { LemonTableColumn } from 'lib/lemon-ui/LemonTable/types'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
@@ -56,6 +59,7 @@ export function EarlyAccessFeatures(): JSX.Element {
waitlistResponsesCountFailed,
} = useValues(earlyAccessFeaturesLogic)
const { setSearchTerm, updateFeatureAssignee } = useActions(earlyAccessFeaturesLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
// Creating an early access feature requires editor access to the resource.
const accessControlDisabledReason = getAccessControlDisabledReason(
@@ -79,16 +83,32 @@ export function EarlyAccessFeatures(): JSX.Element {
interaction="click"
scope={Scene.EarlyAccessFeatures}
>
- <LemonButton
- size="small"
- type="primary"
- to={urls.earlyAccessFeature('new')}
- tooltip="New feature"
- data-attr="create-feature"
- disabledReason={accessControlDisabledReason ?? undefined}
- >
- New feature
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ render={
+ <LinkPrimitive
+ to={accessControlDisabledReason ? undefined : urls.earlyAccessFeature('new')}
+ />
+ }
+ tooltip="New feature"
+ data-attr="create-feature"
+ disabledReason={accessControlDisabledReason}
+ >
+ New feature
+ </Button>
+ ) : (
+ <LemonButton
+ size="small"
+ type="primary"
+ to={urls.earlyAccessFeature('new')}
+ tooltip="New feature"
+ data-attr="create-feature"
+ disabledReason={accessControlDisabledReason ?? undefined}
+ >
+ New feature
+ </LemonButton>
+ )}
</Shortcut>
}
/>
diff --git a/products/early_access_features/frontend/QuillEarlyAccessFeatureActions.tsx b/products/early_access_features/frontend/QuillEarlyAccessFeatureActions.tsx
new file mode 100644
index 000000000000..472d393e997f
--- /dev/null
+++ b/products/early_access_features/frontend/QuillEarlyAccessFeatureActions.tsx
@@ -0,0 +1,140 @@
+import { useActions, useValues } from 'kea'
+
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuTrigger,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+
+import { AccessControlLevel, AccessControlResourceType, EarlyAccessFeatureStage } from '~/types'
+
+import { earlyAccessFeatureLogic } from './earlyAccessFeatureLogic'
+
+const RELEASE_STAGES: { label: string; tooltip: string; stage: EarlyAccessFeatureStage }[] = [
+ {
+ label: 'Concept',
+ tooltip: 'Users can opt in to register interest, but the feature flag will not be enabled for them.',
+ stage: EarlyAccessFeatureStage.Concept,
+ },
+ {
+ label: 'Alpha',
+ tooltip: 'Early testing. Opted-in users will have the feature flag enabled.',
+ stage: EarlyAccessFeatureStage.Alpha,
+ },
+ {
+ label: 'Beta (default)',
+ tooltip: 'Wider testing. Opted-in users will have the feature flag enabled.',
+ stage: EarlyAccessFeatureStage.Beta,
+ },
+ {
+ label: 'General availability',
+ tooltip: 'Feature becomes read-only. All opted-in users retain access.',
+ stage: EarlyAccessFeatureStage.GeneralAvailability,
+ },
+]
+
+export interface QuillEarlyAccessFeatureActionsProps {
+ isNewEarlyAccessFeature: boolean
+ canShowSaveButtons: boolean
+ userAccessLevel?: AccessControlLevel
+ accessControlDisabledReason: string | null
+ onCancel: () => void
+}
+
+export function QuillEarlyAccessFeatureActions({
+ isNewEarlyAccessFeature,
+ canShowSaveButtons,
+ userAccessLevel,
+ accessControlDisabledReason,
+ onCancel,
+}: QuillEarlyAccessFeatureActionsProps): JSX.Element | null {
+ const { earlyAccessFeature, earlyAccessFeatureLoading, isEarlyAccessFeatureSubmitting } =
+ useValues(earlyAccessFeatureLogic)
+ const { editFeature, updateStage, submitEarlyAccessFeature } = useActions(earlyAccessFeatureLogic)
+
+ if (earlyAccessFeatureLoading) {
+ return null
+ }
+
+ if (canShowSaveButtons) {
+ return (
+ <>
+ <Button
+ variant="outline"
+ data-attr="cancel-feature"
+ onClick={onCancel}
+ disabledReason={isEarlyAccessFeatureSubmitting ? 'Saving…' : undefined}
+ >
+ Cancel
+ </Button>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.EarlyAccessFeature}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={userAccessLevel}
+ >
+ <Button
+ variant="primary"
+ onClick={submitEarlyAccessFeature}
+ data-attr="save-feature"
+ loading={isEarlyAccessFeatureSubmitting}
+ >
+ {isNewEarlyAccessFeature ? 'Save as draft' : 'Save'}
+ </Button>
+ </AccessControlAction>
+ </>
+ )
+ }
+
+ return (
+ <>
+ {earlyAccessFeature.stage == EarlyAccessFeatureStage.Draft && (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="primary"
+ tooltip="Publish this feature to make it available"
+ disabledReason={accessControlDisabledReason}
+ />
+ }
+ >
+ Release
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-48">
+ <DropdownMenuGroup>
+ <DropdownMenuLabel>Choose stage</DropdownMenuLabel>
+ {RELEASE_STAGES.map(({ label, tooltip, stage }) => (
+ <Tooltip key={stage}>
+ <TooltipTrigger render={<DropdownMenuItem onClick={() => updateStage(stage)} />}>
+ {label}
+ </TooltipTrigger>
+ <TooltipContent side="left">{tooltip}</TooltipContent>
+ </Tooltip>
+ ))}
+ </DropdownMenuGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ {earlyAccessFeature.stage != EarlyAccessFeatureStage.GeneralAvailability && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.EarlyAccessFeature}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={userAccessLevel}
+ >
+ <Button variant="outline" onClick={() => editFeature(true)} data-attr="edit-feature">
+ Edit
+ </Button>
+ </AccessControlAction>
+ )}
+ </>
+ )
+}
diff --git a/products/early_access_features/package.json b/products/early_access_features/package.json
index 48380b2ef060..ebd1d980b3ae 100644
--- a/products/early_access_features/package.json
+++ b/products/early_access_features/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/endpoints/frontend/EndpointHeader.tsx b/products/endpoints/frontend/EndpointHeader.tsx
index 197ad40ba9a7..b6d48d2ba1de 100644
--- a/products/endpoints/frontend/EndpointHeader.tsx
+++ b/products/endpoints/frontend/EndpointHeader.tsx
@@ -5,6 +5,7 @@ import { LemonButton, LemonLabel, LemonSwitch } from '@posthog/lemon-ui'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { superpowersLogic } from 'lib/components/Superpowers/superpowersLogic'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
import { objectsEqual } from 'lib/utils/objects'
@@ -16,6 +17,7 @@ import { AccessControlLevel, AccessControlResourceType, EndpointType, EndpointVe
import { endpointLogic } from './endpointLogic'
import { endpointSceneLogic, extractBreakdownPropertyNames } from './endpointSceneLogic'
+import { QuillEndpointHeaderActions } from './QuillEndpointHeaderActions'
export const EndpointSceneHeader = (): JSX.Element => {
const {
@@ -40,6 +42,7 @@ export const EndpointSceneHeader = (): JSX.Element => {
setDebugInfoExpanded,
} = useActions(endpointSceneLogic)
const { superpowersEnabled } = useValues(superpowersLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
// SceneTitleSection takes a boolean `canEdit` rather than disabled/disabledReason, so we can't
// wrap it with AccessControlAction — use the same helper AccessControlAction relies on internally.
@@ -138,54 +141,69 @@ export const EndpointSceneHeader = (): JSX.Element => {
isLoading={endpointLoading && !endpoint}
renameDebounceMs={200}
actions={
- <>
- {superpowersEnabled && endpoint && (
- <LemonSwitch
- bordered
- checked={debugInfoExpanded}
- onChange={setDebugInfoExpanded}
- label={
- <span className="inline-flex items-center gap-1">
- <IconBug />
- Debug info
- </span>
- }
- tooltip="Visible to staff (and during impersonation) only"
- />
- )}
- {endpoint && (
- <LemonButton
- type="secondary"
- onClick={handleDiscardChanges}
- disabledReason={!hasChanges && 'No changes to discard'}
+ todayRailNav ? (
+ <QuillEndpointHeaderActions
+ showDebugToggle={!!(superpowersEnabled && endpoint)}
+ debugInfoExpanded={debugInfoExpanded}
+ setDebugInfoExpanded={setDebugInfoExpanded}
+ endpointLoaded={!!endpoint}
+ updatingEndpoint={updatingEndpoint}
+ hasChanges={!!hasChanges}
+ hasQueryChange={hasQueryChange}
+ targetVersion={targetVersion}
+ onDiscardChanges={handleDiscardChanges}
+ onSave={handleSave}
+ />
+ ) : (
+ <>
+ {superpowersEnabled && endpoint && (
+ <LemonSwitch
+ bordered
+ checked={debugInfoExpanded}
+ onChange={setDebugInfoExpanded}
+ label={
+ <span className="inline-flex items-center gap-1">
+ <IconBug />
+ Debug info
+ </span>
+ }
+ tooltip="Visible to staff (and during impersonation) only"
+ />
+ )}
+ {endpoint && (
+ <LemonButton
+ type="secondary"
+ onClick={handleDiscardChanges}
+ disabledReason={!hasChanges && 'No changes to discard'}
+ >
+ Discard changes
+ </LemonButton>
+ )}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Endpoint}
+ minAccessLevel={AccessControlLevel.Editor}
>
- Discard changes
- </LemonButton>
- )}
- <AccessControlAction
- resourceType={AccessControlResourceType.Endpoint}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonButton
- type="primary"
- onClick={handleSave}
- loading={updatingEndpoint}
- disabledReason={
- !endpoint
- ? 'Endpoint not loaded'
- : updatingEndpoint
- ? 'Update in progress'
- : !hasChanges
- ? 'No changes to save'
- : hasQueryChange && targetVersion
- ? 'Query can only be changed when on the latest version'
- : undefined
- }
- >
- Save changes
- </LemonButton>
- </AccessControlAction>
- </>
+ <LemonButton
+ type="primary"
+ onClick={handleSave}
+ loading={updatingEndpoint}
+ disabledReason={
+ !endpoint
+ ? 'Endpoint not loaded'
+ : updatingEndpoint
+ ? 'Update in progress'
+ : !hasChanges
+ ? 'No changes to save'
+ : hasQueryChange && targetVersion
+ ? 'Query can only be changed when on the latest version'
+ : undefined
+ }
+ >
+ Save changes
+ </LemonButton>
+ </AccessControlAction>
+ </>
+ )
}
/>
{superpowersEnabled && endpoint && debugInfoExpanded && (
diff --git a/products/endpoints/frontend/EndpointsScene.tsx b/products/endpoints/frontend/EndpointsScene.tsx
index 7e1894d63885..d7c47bc85e2b 100644
--- a/products/endpoints/frontend/EndpointsScene.tsx
+++ b/products/endpoints/frontend/EndpointsScene.tsx
@@ -6,6 +6,7 @@ import { LemonButton } from '@posthog/lemon-ui'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonTab, LemonTabs } from 'lib/lemon-ui/LemonTabs'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
@@ -23,6 +24,7 @@ import { EndpointsUsage } from './EndpointsUsage'
import { endpointsUsageLogic } from './endpointsUsageLogic'
import { InsightPickerEndpointModal } from './InsightPickerEndpointModal'
import { OverlayForNewEndpointMenu } from './newEndpointMenu'
+import { QuillEndpointsSceneActions } from './QuillEndpointsSceneActions'
export const scene: SceneExport = {
component: EndpointsScene,
@@ -33,6 +35,7 @@ export const scene: SceneExport = {
export function EndpointsScene(): JSX.Element {
const { activeTab } = useValues(endpointsLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const tabs: LemonTab<string>[] = [
{
@@ -59,37 +62,41 @@ export function EndpointsScene(): JSX.Element {
type: sceneConfigurations[Scene.EndpointsScene].iconType || 'default_icon_type',
}}
actions={
- <Shortcut
- name="EndpointsNew"
- keybind={[keyBinds.new]}
- intent="New endpoint"
- interaction="click"
- scope={Scene.EndpointsScene}
- >
- <AccessControlAction
- resourceType={AccessControlResourceType.Endpoint}
- minAccessLevel={AccessControlLevel.Editor}
+ todayRailNav ? (
+ <QuillEndpointsSceneActions />
+ ) : (
+ <Shortcut
+ name="EndpointsNew"
+ keybind={[keyBinds.new]}
+ intent="New endpoint"
+ interaction="click"
+ scope={Scene.EndpointsScene}
>
- <LemonButton
- type="primary"
- to={urls.sqlEditor({ source: 'endpoint' })}
- sideAction={{
- dropdown: {
- placement: 'bottom-end',
- className: 'new-endpoint-overlay',
- actionable: true,
- overlay: <OverlayForNewEndpointMenu />,
- },
- 'data-attr': 'new-endpoint-dropdown',
- }}
- data-attr="new-endpoint-button"
- size="small"
- icon={<IconPlusSmall />}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Endpoint}
+ minAccessLevel={AccessControlLevel.Editor}
>
- New
- </LemonButton>
- </AccessControlAction>
- </Shortcut>
+ <LemonButton
+ type="primary"
+ to={urls.sqlEditor({ source: 'endpoint' })}
+ sideAction={{
+ dropdown: {
+ placement: 'bottom-end',
+ className: 'new-endpoint-overlay',
+ actionable: true,
+ overlay: <OverlayForNewEndpointMenu />,
+ },
+ 'data-attr': 'new-endpoint-dropdown',
+ }}
+ data-attr="new-endpoint-button"
+ size="small"
+ icon={<IconPlusSmall />}
+ >
+ New
+ </LemonButton>
+ </AccessControlAction>
+ </Shortcut>
+ )
}
/>
<LemonTabs activeKey={activeTab} data-attr="endpoints-tabs" tabs={tabs} sceneInset />
diff --git a/products/endpoints/frontend/QuillEndpointHeaderActions.tsx b/products/endpoints/frontend/QuillEndpointHeaderActions.tsx
new file mode 100644
index 000000000000..224d9de9c312
--- /dev/null
+++ b/products/endpoints/frontend/QuillEndpointHeaderActions.tsx
@@ -0,0 +1,85 @@
+import { IconBug } from '@posthog/icons'
+import { Button, Label, Switch, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+export interface QuillEndpointHeaderActionsProps {
+ showDebugToggle: boolean
+ debugInfoExpanded: boolean
+ setDebugInfoExpanded: (expanded: boolean) => void
+ endpointLoaded: boolean
+ updatingEndpoint: boolean
+ hasChanges: boolean
+ hasQueryChange: boolean
+ targetVersion: number | undefined
+ onDiscardChanges: () => void
+ onSave: () => void
+}
+
+export function QuillEndpointHeaderActions({
+ showDebugToggle,
+ debugInfoExpanded,
+ setDebugInfoExpanded,
+ endpointLoaded,
+ updatingEndpoint,
+ hasChanges,
+ hasQueryChange,
+ targetVersion,
+ onDiscardChanges,
+ onSave,
+}: QuillEndpointHeaderActionsProps): JSX.Element {
+ return (
+ <>
+ {showDebugToggle && (
+ <Tooltip>
+ <TooltipTrigger render={<div className="flex items-center gap-2" />}>
+ <Switch
+ id="endpoint-debug-info"
+ checked={debugInfoExpanded}
+ onCheckedChange={setDebugInfoExpanded}
+ />
+ <Label htmlFor="endpoint-debug-info" className="inline-flex items-center gap-1">
+ <IconBug />
+ Debug info
+ </Label>
+ </TooltipTrigger>
+ <TooltipContent>Visible to staff (and during impersonation) only</TooltipContent>
+ </Tooltip>
+ )}
+ {endpointLoaded && (
+ <Button
+ variant="outline"
+ onClick={onDiscardChanges}
+ disabledReason={!hasChanges ? 'No changes to discard' : undefined}
+ >
+ Discard changes
+ </Button>
+ )}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Endpoint}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant="primary"
+ onClick={onSave}
+ loading={updatingEndpoint}
+ disabledReason={
+ !endpointLoaded
+ ? 'Endpoint not loaded'
+ : updatingEndpoint
+ ? 'Update in progress'
+ : !hasChanges
+ ? 'No changes to save'
+ : hasQueryChange && targetVersion
+ ? 'Query can only be changed when on the latest version'
+ : undefined
+ }
+ >
+ Save changes
+ </Button>
+ </AccessControlAction>
+ </>
+ )
+}
diff --git a/products/endpoints/frontend/QuillEndpointsSceneActions.tsx b/products/endpoints/frontend/QuillEndpointsSceneActions.tsx
new file mode 100644
index 000000000000..b5691889669b
--- /dev/null
+++ b/products/endpoints/frontend/QuillEndpointsSceneActions.tsx
@@ -0,0 +1,110 @@
+import { useActions } from 'kea'
+import { router } from 'kea-router'
+
+import { IconChevronDown, IconGraph, IconPlus, IconServer } from '@posthog/icons'
+import {
+ Button,
+ ButtonGroup,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { Scene } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { insightPickerEndpointModalLogic } from './insightPickerEndpointModalLogic'
+
+export function QuillEndpointsSceneActions(): JSX.Element {
+ const { openModal } = useActions(insightPickerEndpointModalLogic)
+ const accessDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.Endpoint,
+ AccessControlLevel.Editor
+ )
+
+ const options = [
+ {
+ icon: IconServer,
+ name: 'SQL-based endpoint',
+ description: 'Create an endpoint from a query in the SQL editor.',
+ onClick: () => router.actions.push(urls.sqlEditor({ source: 'endpoint' })),
+ dataAttr: 'new-endpoint-overlay-hogql',
+ },
+ {
+ icon: IconGraph,
+ name: 'Insight-based endpoint',
+ description: 'Create an endpoint from a new or existing insight.',
+ onClick: openModal,
+ dataAttr: 'new-endpoint-overlay-insight',
+ },
+ ]
+
+ return (
+ <DropdownMenu>
+ <ButtonGroup>
+ <Shortcut
+ name="EndpointsNew"
+ keybind={[keyBinds.new]}
+ intent="New endpoint"
+ interaction="click"
+ scope={Scene.EndpointsScene}
+ >
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Endpoint}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.sqlEditor({ source: 'endpoint' })} />}
+ data-attr="new-endpoint-button"
+ >
+ <IconPlus />
+ New
+ </Button>
+ </AccessControlAction>
+ </Shortcut>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="primary"
+ size="icon"
+ aria-label="New endpoint options"
+ tooltip="New endpoint options"
+ disabledReason={accessDisabledReason}
+ data-attr="new-endpoint-dropdown"
+ />
+ }
+ >
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ </ButtonGroup>
+ <DropdownMenuContent align="end" className="new-endpoint-overlay">
+ {options.map((option) => (
+ <AccessControlAction
+ key={option.name}
+ resourceType={AccessControlResourceType.Endpoint}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <DropdownMenuItem
+ onClick={option.onClick}
+ data-attr={option.dataAttr}
+ data-attr-endpoint-type={option.name}
+ description={option.description}
+ >
+ <option.icon />
+ {option.name}
+ </DropdownMenuItem>
+ </AccessControlAction>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/products/endpoints/package.json b/products/endpoints/package.json
index c7a1e39c8ca2..58c52b3a2916 100644
--- a/products/endpoints/package.json
+++ b/products/endpoints/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
diff --git a/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx b/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx
index 3cdd43c0786c..9c408fdfcc92 100644
--- a/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx
@@ -2,8 +2,11 @@ import { useActions, useMountedLogic, useValues } from 'kea'
import { IconPullRequest, IconRefresh } from '@posthog/icons'
import { LemonButton, LemonSkeleton, LemonTabs, Link, Tooltip } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -52,6 +55,7 @@ export function CIExplorerScene(): JSX.Element {
} = useValues(ciExplorerLogic)
const { repoOwner, repoName, number, sourceId } = useMountedLogic(ciExplorerLogic).props
const { loadPrRuns, refresh } = useActions(ciExplorerLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const pullRequest = lifecycle?.pull_request
const viewUrl = (target: CIExplorerView): string => locationUrl({ view: target, headSha: null, nodeId: null })
@@ -62,14 +66,24 @@ export function CIExplorerScene(): JSX.Element {
<RepoSceneTitle
repo={`${repoOwner}/${repoName}`}
actions={
- <LemonButton
- type="secondary"
- size="small"
- to={pullRequestUrl}
- data-attr="ci-explorer-open-pull-request"
- >
- Open pull request
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={pullRequestUrl} />}
+ data-attr="ci-explorer-open-pull-request"
+ >
+ Open pull request
+ </Button>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={pullRequestUrl}
+ data-attr="ci-explorer-open-pull-request"
+ >
+ Open pull request
+ </LemonButton>
+ )
}
/>
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx
index 3edf61a3c3b8..a3c24dc5e682 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx
@@ -1,7 +1,10 @@
import { BindLogic, useActions, useValues } from 'kea'
import { LemonBanner, LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
@@ -36,7 +39,20 @@ function RefreshButton({ extraLoading = false }: { extraLoading?: boolean }): JS
const logic = engineeringAnalyticsLogic()
const { anyLoading } = useValues(logic)
const { refresh } = useActions(logic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const loading = anyLoading || extraLoading
+ if (todayRailNav) {
+ return (
+ <Button
+ variant="outline"
+ onClick={refresh}
+ loading={loading}
+ disabledReason={loading ? 'Loading…' : undefined}
+ >
+ Refresh
+ </Button>
+ )
+ }
return (
<LemonButton
type="secondary"
@@ -83,6 +99,7 @@ function EngineeringAnalyticsTabs(): JSX.Element {
export function EngineeringAnalyticsScene(): JSX.Element {
const { activeView } = useValues(engineeringAnalyticsSceneLogic)
const { scopeRepo } = useValues(engineeringAnalyticsLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<BindLogic logic={engineeringAnalyticsLogic} props={{}}>
@@ -91,20 +108,37 @@ export function EngineeringAnalyticsScene(): JSX.Element {
repo={scopeRepo}
description={viewDescription(activeView, scopeRepo)}
actions={
- <>
- {scopeRepo && (
- <LemonButton
- type="secondary"
- size="small"
- to={`https://github.com/${scopeRepo}`}
- targetBlank
- data-attr="engineering-analytics-view-on-github"
- >
- View on GitHub
- </LemonButton>
- )}
- {activeView === 'deploys' ? <DeploysRefreshButton /> : <RefreshButton />}
- </>
+ todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ {scopeRepo && (
+ <Button
+ variant="outline"
+ render={
+ <LinkPrimitive to={`https://github.com/${scopeRepo}`} target="_blank" />
+ }
+ data-attr="engineering-analytics-view-on-github"
+ >
+ View on GitHub
+ </Button>
+ )}
+ {activeView === 'deploys' ? <DeploysRefreshButton /> : <RefreshButton />}
+ </div>
+ ) : (
+ <>
+ {scopeRepo && (
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={`https://github.com/${scopeRepo}`}
+ targetBlank
+ data-attr="engineering-analytics-view-on-github"
+ >
+ View on GitHub
+ </LemonButton>
+ )}
+ {activeView === 'deploys' ? <DeploysRefreshButton /> : <RefreshButton />}
+ </>
+ )
}
/>
<LemonBanner type="info" dismissKey="engineering-analytics-alpha">
diff --git a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
index 3a6a4705bb0d..7f1f5a069bc0 100644
--- a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
@@ -11,8 +11,11 @@ import {
LemonTag,
Link,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { cn } from 'lib/utils/css-classes'
import { humanFriendlyDuration } from 'lib/utils/durations'
import { pluralize } from 'lib/utils/strings'
@@ -447,6 +450,7 @@ export function PullRequestDetailScene(): JSX.Element {
frictionFailed,
} = useValues(pullRequestDetailLogic)
const { number } = useMountedLogic(pullRequestDetailLogic).props
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const {
loadLifecycle,
loadPrCost,
@@ -494,28 +498,55 @@ export function PullRequestDetailScene(): JSX.Element {
repo={`${repoOwner}/${repoName}`}
actions={
githubUrl && pullRequest ? (
- <>
- <LemonButton
- type="secondary"
- size="small"
- to={withCurrentScope(
- urls.engineeringAnalyticsCIExplorer(repoOwner, repoName, pullRequest.number),
- sourceId
- )}
- data-attr="pull-request-open-ci-explorer"
- >
- View in CI explorer
- </LemonButton>
- <LemonButton
- type="secondary"
- size="small"
- to={githubUrl}
- targetBlank
- sideIcon={<IconExternal />}
- >
- View on GitHub
- </LemonButton>
- </>
+ todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ <Button
+ variant="outline"
+ render={
+ <LinkPrimitive
+ to={withCurrentScope(
+ urls.engineeringAnalyticsCIExplorer(
+ repoOwner,
+ repoName,
+ pullRequest.number
+ ),
+ sourceId
+ )}
+ />
+ }
+ data-attr="pull-request-open-ci-explorer"
+ >
+ View in CI explorer
+ </Button>
+ <Button variant="outline" render={<LinkPrimitive to={githubUrl} target="_blank" />}>
+ View on GitHub
+ <IconExternal />
+ </Button>
+ </div>
+ ) : (
+ <>
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={withCurrentScope(
+ urls.engineeringAnalyticsCIExplorer(repoOwner, repoName, pullRequest.number),
+ sourceId
+ )}
+ data-attr="pull-request-open-ci-explorer"
+ >
+ View in CI explorer
+ </LemonButton>
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={githubUrl}
+ targetBlank
+ sideIcon={<IconExternal />}
+ >
+ View on GitHub
+ </LemonButton>
+ </>
+ )
) : undefined
}
/>
diff --git a/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx b/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx
index 5c301281eaef..c0188148656b 100644
--- a/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx
@@ -3,9 +3,12 @@ import { router } from 'kea-router'
import { IconCheckCircle, IconExternal, IconHourglass, IconPause, IconXCircle } from '@posthog/icons'
import { LemonButton, LemonSkeleton, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { TZLabel } from 'lib/components/TZLabel'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { humanFriendlyDuration } from 'lib/utils/durations'
import { pluralize } from 'lib/utils/strings'
import { SceneExport } from 'scenes/sceneTypes'
@@ -61,6 +64,7 @@ export function WorkflowRunDetailScene(): JSX.Element {
const { repoOwner, repoName } = useMountedLogic(workflowRunDetailLogic).props
const { loadRun, loadJobs, loadFailureLogs } = useActions(workflowRunDetailLogic)
const { searchParams } = useValues(router)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!isValidRunId) {
return (
@@ -130,15 +134,22 @@ export function WorkflowRunDetailScene(): JSX.Element {
repo={`${repoOwner}/${repoName}`}
actions={
githubUrl ? (
- <LemonButton
- type="secondary"
- size="small"
- to={githubUrl}
- targetBlank
- sideIcon={<IconExternal />}
- >
- View on GitHub
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="outline" render={<LinkPrimitive to={githubUrl} target="_blank" />}>
+ View on GitHub
+ <IconExternal />
+ </Button>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={githubUrl}
+ targetBlank
+ sideIcon={<IconExternal />}
+ >
+ View on GitHub
+ </LemonButton>
+ )
) : undefined
}
/>
diff --git a/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx b/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx
index e53d8b0ca4e9..28792abc2150 100644
--- a/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx
@@ -12,9 +12,12 @@ import {
Link,
Tooltip,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonCard } from 'lib/lemon-ui/LemonCard'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { cn } from 'lib/utils/css-classes'
import { humanFriendlyDuration } from 'lib/utils/durations'
import { humanFriendlyNumber } from 'lib/utils/numbers'
@@ -132,6 +135,7 @@ export function WorkflowRunsScene(): JSX.Element {
const { loadRuns, loadRunActivity, loadRunnerCosts, loadJobAggregates, setRunExpanded } =
useActions(workflowRunsLogic)
const { searchParams } = useValues(router)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const githubUrl = githubWorkflowUrl(repoOwner, repoName, workflowName)
// The rim spinner means "these numbers are updating", so each read only counts once it has data on
@@ -311,9 +315,22 @@ export function WorkflowRunsScene(): JSX.Element {
<RepoSceneTitle
repo={`${repoOwner}/${repoName}`}
actions={
- <LemonButton type="secondary" size="small" to={githubUrl} targetBlank sideIcon={<IconExternal />}>
- View on GitHub
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="outline" render={<LinkPrimitive to={githubUrl} target="_blank" />}>
+ View on GitHub
+ <IconExternal />
+ </Button>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={githubUrl}
+ targetBlank
+ sideIcon={<IconExternal />}
+ >
+ View on GitHub
+ </LemonButton>
+ )
}
/>
<ProductNav activeTab="workflows" repo={`${repoOwner}/${repoName}`} sourceId={sourceId}>
diff --git a/products/engineering_analytics/package.json b/products/engineering_analytics/package.json
index b0cb7cc8caf6..3747d233369f 100644
--- a/products/engineering_analytics/package.json
+++ b/products/engineering_analytics/package.json
@@ -6,6 +6,7 @@
},
"dependencies": {
"@posthog/icons": "catalog:",
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/error_tracking/frontend/components/IssueFilters/Search.tsx b/products/error_tracking/frontend/components/IssueFilters/Search.tsx
index b0b5c5291470..505a5c6a2c6d 100644
--- a/products/error_tracking/frontend/components/IssueFilters/Search.tsx
+++ b/products/error_tracking/frontend/components/IssueFilters/Search.tsx
@@ -22,7 +22,7 @@ export function IssueSearchInput({
return (
<div className={cn('w-64 max-w-full shrink-0', className)}>
- <InputGroup className="h-7 border-muted-foreground/20 focus-within:border-ring/50">
+ <InputGroup size="sm" className="border-muted-foreground/20 focus-within:border-ring/50">
<InputGroupAddon>
<IconSearch />
</InputGroupAddon>
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene.tsx
index 28bb76597ec5..3404be842356 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene.tsx
@@ -2,12 +2,14 @@ import { BindLogic, useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { LemonBadge, LemonButton, LemonTab, LemonTabs, Spinner } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import api from 'lib/api'
import { AccessDenied } from 'lib/components/AccessDenied'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { IconFeedback } from 'lib/lemon-ui/icons'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { sceneConfigurations } from 'scenes/scenes'
@@ -157,6 +159,7 @@ const RecommendationsTabLabel = (): JSX.Element => {
const Header = (): JSX.Element => {
const { isDev } = useValues(preflightLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const buildExceptionSteps = (): {
$type: string
@@ -202,41 +205,73 @@ const Header = (): JSX.Element => {
type: sceneConfigurations[Scene.ErrorTracking].iconType || 'default_icon_type',
}}
actions={
- <>
- {isDev ? (
- <>
- <LemonButton
- size="small"
- onClick={() => {
- posthog.captureException(new Error('Kaboom !'), {
- $exception_steps: buildExceptionSteps(),
- })
- }}
- >
- Send an exception
- </LemonButton>
- <LemonButton size="small" onClick={onClick}>
- Start exception loop
- </LemonButton>
- </>
- ) : null}
- <LemonButton
- size="small"
- type="secondary"
- icon={<IconFeedback />}
- onClick={() => posthog.displaySurvey('019cbd35-c91c-0000-9997-9259dc4cc2ef')}
- >
- Feedback
- </LemonButton>
- <LemonButton
- size="small"
- to="https://posthog.com/docs/error-tracking"
- type="secondary"
- targetBlank
- >
- Documentation
- </LemonButton>
- </>
+ todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ {isDev ? (
+ <>
+ <Button
+ onClick={() => {
+ posthog.captureException(new Error('Kaboom !'), {
+ $exception_steps: buildExceptionSteps(),
+ })
+ }}
+ >
+ Send an exception
+ </Button>
+ <Button onClick={onClick}>Start exception loop</Button>
+ </>
+ ) : null}
+ <Button
+ variant="outline"
+ onClick={() => posthog.displaySurvey('019cbd35-c91c-0000-9997-9259dc4cc2ef')}
+ >
+ <IconFeedback />
+ Feedback
+ </Button>
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to="https://posthog.com/docs/error-tracking" target="_blank" />}
+ >
+ Documentation
+ </Button>
+ </div>
+ ) : (
+ <>
+ {isDev ? (
+ <>
+ <LemonButton
+ size="small"
+ onClick={() => {
+ posthog.captureException(new Error('Kaboom !'), {
+ $exception_steps: buildExceptionSteps(),
+ })
+ }}
+ >
+ Send an exception
+ </LemonButton>
+ <LemonButton size="small" onClick={onClick}>
+ Start exception loop
+ </LemonButton>
+ </>
+ ) : null}
+ <LemonButton
+ size="small"
+ type="secondary"
+ icon={<IconFeedback />}
+ onClick={() => posthog.displaySurvey('019cbd35-c91c-0000-9997-9259dc4cc2ef')}
+ >
+ Feedback
+ </LemonButton>
+ <LemonButton
+ size="small"
+ to="https://posthog.com/docs/error-tracking"
+ type="secondary"
+ targetBlank
+ >
+ Documentation
+ </LemonButton>
+ </>
+ )
}
/>
</>
diff --git a/products/error_tracking/package.json b/products/error_tracking/package.json
index 05ccfbc86236..b847e7a54241 100644
--- a/products/error_tracking/package.json
+++ b/products/error_tracking/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"@posthog/quill-components": "workspace:*",
"kea": "catalog:",
diff --git a/products/experiments/frontend/components/QuillExperimentActionsMenu.tsx b/products/experiments/frontend/components/QuillExperimentActionsMenu.tsx
new file mode 100644
index 000000000000..86b238a48d63
--- /dev/null
+++ b/products/experiments/frontend/components/QuillExperimentActionsMenu.tsx
@@ -0,0 +1,53 @@
+import { Fragment } from 'react'
+
+import { IconChevronDown } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { useExperimentActions } from 'scenes/experiments/ExperimentView/useExperimentActions'
+
+export function QuillExperimentActionsMenu(): JSX.Element | null {
+ const sections = useExperimentActions('actions-dropdown-')
+
+ if (sections.length === 0) {
+ return null
+ }
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger render={<Button variant="outline" data-attr="experiment-actions-menu" />}>
+ Actions
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-56">
+ {sections.map((section, index) => (
+ <Fragment key={section.key}>
+ {index > 0 && <DropdownMenuSeparator />}
+ <DropdownMenuGroup>
+ {section.items.map((item) => (
+ <DropdownMenuItem
+ key={item['data-attr'] ?? String(item.label)}
+ variant={item.status === 'danger' ? 'destructive' : 'default'}
+ onClick={item.onClick}
+ disabledReason={item.disabledReason}
+ data-attr={item['data-attr']}
+ >
+ {item.icon}
+ {item.label}
+ {item.sideIcon && <span className="ml-auto">{item.sideIcon}</span>}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuGroup>
+ </Fragment>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/products/experiments/frontend/components/QuillSharedMetricActions.tsx b/products/experiments/frontend/components/QuillSharedMetricActions.tsx
new file mode 100644
index 000000000000..dc748918f906
--- /dev/null
+++ b/products/experiments/frontend/components/QuillSharedMetricActions.tsx
@@ -0,0 +1,66 @@
+import { IconEllipsis, IconTrash } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+export interface QuillSharedMetricActionsProps {
+ showDelete: boolean
+ userAccessLevel?: AccessControlLevel
+ deleteLoading: boolean
+ onDelete: () => void
+ saveDisabledReason: string | undefined
+ saving: boolean
+ onSave: () => void
+}
+
+export function QuillSharedMetricActions({
+ showDelete,
+ userAccessLevel,
+ deleteLoading,
+ onDelete,
+ saveDisabledReason,
+ saving,
+ onSave,
+}: QuillSharedMetricActionsProps): JSX.Element {
+ return (
+ <>
+ {showDelete && (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={<Button size="icon" aria-label="more" tooltip="More" data-attr="more-button" />}
+ >
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-40">
+ <AccessControlAction
+ resourceType={AccessControlResourceType.ExperimentSavedMetric}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={userAccessLevel}
+ >
+ <DropdownMenuItem
+ variant="destructive"
+ data-attr="shared-metric-delete"
+ disabled={deleteLoading}
+ onClick={onDelete}
+ >
+ <IconTrash />
+ Delete
+ </DropdownMenuItem>
+ </AccessControlAction>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.ExperimentSavedMetric}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={userAccessLevel}
+ >
+ <Button disabledReason={saveDisabledReason} loading={saving} variant="primary" onClick={onSave}>
+ Save
+ </Button>
+ </AccessControlAction>
+ </>
+ )
+}
diff --git a/products/experiments/frontend/scenes/ExperimentsScene.tsx b/products/experiments/frontend/scenes/ExperimentsScene.tsx
index ee3a2374c1a3..8c4274bb4292 100644
--- a/products/experiments/frontend/scenes/ExperimentsScene.tsx
+++ b/products/experiments/frontend/scenes/ExperimentsScene.tsx
@@ -4,6 +4,7 @@ import { router } from 'kea-router'
import { useEffect, useRef, useState } from 'react'
import { LemonInput, LemonSelect, LemonTag, Tooltip, lemonToast } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
@@ -15,6 +16,7 @@ import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
import { TagSelect } from 'lib/components/TagSelect'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
@@ -24,6 +26,7 @@ import { LemonTable, LemonTableColumn, LemonTableColumns } from 'lib/lemon-ui/Le
import { atColumn, createdAtColumn, createdByColumn } from 'lib/lemon-ui/LemonTable/columnUtils'
import { LemonTableLink } from 'lib/lemon-ui/LemonTable/LemonTableLink'
import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { accessLevelSatisfied } from 'lib/utils/accessControlUtils'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { addProductIntentForCrossSell } from 'lib/utils/product-intents'
@@ -714,6 +717,7 @@ export function ExperimentsScene(): JSX.Element {
const [duplicateModalExperiment, setDuplicateModalExperiment] = useState<Experiment | null>(null)
const [copyToProjectModalExperiment, setCopyToProjectModalExperiment] = useState<Experiment | null>(null)
const [surveyModalExperiment, setSurveyModalExperiment] = useState<Experiment | null>(null)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
// Register feature flag creation tool so that it's always available on experiments page
useMaxTool({
@@ -781,15 +785,26 @@ export function ExperimentsScene(): JSX.Element {
interaction="click"
scope={Scene.Experiments}
>
- <LemonButton
- size="small"
- type="primary"
- data-attr="create-experiment"
- to={urls.experiment('new')}
- tooltip="New experiment"
- >
- <span className="pr-3">New experiment</span>
- </LemonButton>
+ {todayRailNav ? (
+ <Button
+ variant="primary"
+ data-attr="create-experiment"
+ render={<LinkPrimitive to={urls.experiment('new')} />}
+ tooltip="New experiment"
+ >
+ <span className="pr-3">New experiment</span>
+ </Button>
+ ) : (
+ <LemonButton
+ size="small"
+ type="primary"
+ data-attr="create-experiment"
+ to={urls.experiment('new')}
+ tooltip="New experiment"
+ >
+ <span className="pr-3">New experiment</span>
+ </LemonButton>
+ )}
</Shortcut>
</MaxTool>
</div>
diff --git a/products/experiments/frontend/setupInspector/QuillSetupInspectorButton.tsx b/products/experiments/frontend/setupInspector/QuillSetupInspectorButton.tsx
new file mode 100644
index 000000000000..078f5b48742f
--- /dev/null
+++ b/products/experiments/frontend/setupInspector/QuillSetupInspectorButton.tsx
@@ -0,0 +1,28 @@
+import { useActions, useValues } from 'kea'
+
+import { Button } from '@posthog/quill'
+
+import { SetupInspectorDrawer } from './SetupInspectorDrawer'
+import { setupInspectorLogic } from './setupInspectorLogic'
+
+export function QuillSetupInspectorButton(): JSX.Element | null {
+ const { canInspect } = useValues(setupInspectorLogic)
+ const { openSetupInspector } = useActions(setupInspectorLogic)
+
+ if (!canInspect) {
+ return null
+ }
+ return (
+ <>
+ <Button
+ variant="outline"
+ onClick={openSetupInspector}
+ tooltip="See what an agent reads about this project before it creates an experiment."
+ data-attr="experiment-setup-context-open"
+ >
+ Setup context
+ </Button>
+ <SetupInspectorDrawer />
+ </>
+ )
+}
diff --git a/products/experiments/frontend/setupInspector/SetupInspectorButton.tsx b/products/experiments/frontend/setupInspector/SetupInspectorButton.tsx
index 2a7ecb9aa968..eada30aefed5 100644
--- a/products/experiments/frontend/setupInspector/SetupInspectorButton.tsx
+++ b/products/experiments/frontend/setupInspector/SetupInspectorButton.tsx
@@ -1,13 +1,19 @@
import { useActions, useValues } from 'kea'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
+import { QuillSetupInspectorButton } from './QuillSetupInspectorButton'
import { SetupInspectorDrawer } from './SetupInspectorDrawer'
import { setupInspectorLogic } from './setupInspectorLogic'
export function SetupInspectorButton(): JSX.Element | null {
const { canInspect } = useValues(setupInspectorLogic)
const { openSetupInspector } = useActions(setupInspectorLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillSetupInspectorButton />
+ }
if (!canInspect) {
return null
diff --git a/products/experiments/package.json b/products/experiments/package.json
index 46a124066f9d..bc773e2083c6 100644
--- a/products/experiments/package.json
+++ b/products/experiments/package.json
@@ -6,6 +6,7 @@
"dependencies": {
"@base-ui/react": "catalog:",
"@posthog/brand": "catalog:",
+ "@posthog/quill": "workspace:*",
"fast-equals": "catalog:",
"kea": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/feature_flags/frontend/staff/FeatureFlagsStaffToolsScene.tsx b/products/feature_flags/frontend/staff/FeatureFlagsStaffToolsScene.tsx
index 979ed652867a..5d4a46dabfd4 100644
--- a/products/feature_flags/frontend/staff/FeatureFlagsStaffToolsScene.tsx
+++ b/products/feature_flags/frontend/staff/FeatureFlagsStaffToolsScene.tsx
@@ -1,8 +1,11 @@
import { useValues } from 'kea'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessDenied } from 'lib/components/AccessDenied'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
@@ -20,6 +23,7 @@ export const scene: SceneExport = {
export function FeatureFlagsStaffToolsScene(): JSX.Element {
const { user } = useValues(userLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!user?.is_staff) {
return <AccessDenied object="page" reason="This page is only accessible to staff users." />
@@ -32,14 +36,25 @@ export function FeatureFlagsStaffToolsScene(): JSX.Element {
description="Look up any team across all organizations to inspect and rebuild its flag caches, or adjust its feature-flags config."
resourceType={{ type: 'feature_flag' }}
actions={
- <>
- <LemonButton type="secondary" size="small" to={urls.cohortsStaffTools()}>
- Cohorts staff tools
- </LemonButton>
- <LemonButton type="secondary" size="small" to={urls.instanceSettings()}>
- Flags-related instance settings
- </LemonButton>
- </>
+ todayRailNav ? (
+ <>
+ <Button variant="outline" render={<LinkPrimitive to={urls.cohortsStaffTools()} />}>
+ Cohorts staff tools
+ </Button>
+ <Button variant="outline" render={<LinkPrimitive to={urls.instanceSettings()} />}>
+ Flags-related instance settings
+ </Button>
+ </>
+ ) : (
+ <>
+ <LemonButton type="secondary" size="small" to={urls.cohortsStaffTools()}>
+ Cohorts staff tools
+ </LemonButton>
+ <LemonButton type="secondary" size="small" to={urls.instanceSettings()}>
+ Flags-related instance settings
+ </LemonButton>
+ </>
+ )
}
/>
<StaffCacheToolsTab />
diff --git a/products/feature_flags/package.json b/products/feature_flags/package.json
index 80fef8eecd79..3c808e3646ed 100644
--- a/products/feature_flags/package.json
+++ b/products/feature_flags/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
"kea-router": "catalog:",
diff --git a/products/groups/frontend/pages/Groups.tsx b/products/groups/frontend/pages/Groups.tsx
index 4f79fe5fc110..d1e9c9818981 100644
--- a/products/groups/frontend/pages/Groups.tsx
+++ b/products/groups/frontend/pages/Groups.tsx
@@ -2,6 +2,7 @@ import { useActions, useValues } from 'kea'
import { router } from 'kea-router'
import { IconPeople } from '@posthog/icons'
+import { Button } from '@posthog/quill'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { groupsAccessLogic } from 'lib/introductions/groupsAccessLogic'
@@ -43,6 +44,7 @@ export function GroupsScene(): JSX.Element {
const { aggregationLabel } = useValues(groupsModel)
const { baseCurrency } = useValues(teamLogic)
const hasCustomerAnalyticsEnabled = useFeatureFlag('CUSTOMER_ANALYTICS')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (groupTypeIndex === undefined) {
throw new Error('groupTypeIndex is undefined')
@@ -84,16 +86,25 @@ export function GroupsScene(): JSX.Element {
actions={
<>
<FeedbackButton id="customer-analytics-groups-list-feedback-button" />
- {hasCustomerAnalyticsEnabled && (
- <LemonButton
- type="primary"
- size="small"
- data-attr={`new-group-${groupTypeIndex}`}
- onClick={() => router.actions.push(urls.group(groupTypeIndex, 'new', false))}
- >
- New {aggregationLabel(groupTypeIndex).singular}
- </LemonButton>
- )}
+ {hasCustomerAnalyticsEnabled &&
+ (todayRailNav ? (
+ <Button
+ variant="primary"
+ data-attr={`new-group-${groupTypeIndex}`}
+ onClick={() => router.actions.push(urls.group(groupTypeIndex, 'new', false))}
+ >
+ New {aggregationLabel(groupTypeIndex).singular}
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ size="small"
+ data-attr={`new-group-${groupTypeIndex}`}
+ onClick={() => router.actions.push(urls.group(groupTypeIndex, 'new', false))}
+ >
+ New {aggregationLabel(groupTypeIndex).singular}
+ </LemonButton>
+ ))}
</>
}
/>
diff --git a/products/groups/frontend/pages/GroupsNew.tsx b/products/groups/frontend/pages/GroupsNew.tsx
index 6ff4849c5b0e..c469ccea2e37 100644
--- a/products/groups/frontend/pages/GroupsNew.tsx
+++ b/products/groups/frontend/pages/GroupsNew.tsx
@@ -4,7 +4,9 @@ import { router } from 'kea-router'
import { IconPlus, IconTrash } from '@posthog/icons'
import { LemonButton, LemonDivider, LemonInput, LemonSegmentedButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -25,6 +27,7 @@ export const scene: SceneExport<GroupsNewLogicProps> = {
export function GroupsNew(): JSX.Element {
const { logicProps, group, groupTypeName, groupTypeNamePlural } = useValues(groupsNewLogic)
const { addFormProperty, removeFormProperty, setGroupValue } = useActions(groupsNewLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<Form id="group" logic={groupsNewLogic} props={logicProps} formKey="group" enableFormOnSubmit>
@@ -33,27 +36,44 @@ export function GroupsNew(): JSX.Element {
name={`New ${groupTypeName} group`}
resourceType={{ type: 'group' }}
actions={
- <>
- <LemonButton
- data-attr="cancel-group"
- type="secondary"
- size="small"
- onClick={() => {
- router.actions.push(urls.groups(logicProps.groupTypeIndex))
- }}
- >
- Cancel
- </LemonButton>
- <LemonButton
- size="small"
- type="primary"
- data-attr="save-group"
- htmlType="submit"
- form="group"
- >
- Save
- </LemonButton>
- </>
+ todayRailNav ? (
+ <>
+ <Button
+ data-attr="cancel-group"
+ variant="outline"
+ onClick={() => {
+ router.actions.push(urls.groups(logicProps.groupTypeIndex))
+ }}
+ >
+ Cancel
+ </Button>
+ <Button variant="primary" data-attr="save-group" type="submit" form="group">
+ Save
+ </Button>
+ </>
+ ) : (
+ <>
+ <LemonButton
+ data-attr="cancel-group"
+ type="secondary"
+ size="small"
+ onClick={() => {
+ router.actions.push(urls.groups(logicProps.groupTypeIndex))
+ }}
+ >
+ Cancel
+ </LemonButton>
+ <LemonButton
+ size="small"
+ type="primary"
+ data-attr="save-group"
+ htmlType="submit"
+ form="group"
+ >
+ Save
+ </LemonButton>
+ </>
+ )
}
forceBackTo={{
name: `People / Groups / ${capitalizeFirstLetter(groupTypeNamePlural)}`,
diff --git a/products/groups/package.json b/products/groups/package.json
index c95f9cf816db..45f1dc5b7a7a 100644
--- a/products/groups/package.json
+++ b/products/groups/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/legal_documents/frontend/scenes/LegalDocumentNewScene.tsx b/products/legal_documents/frontend/scenes/LegalDocumentNewScene.tsx
index 450c370fadd7..efe3e18cf799 100644
--- a/products/legal_documents/frontend/scenes/LegalDocumentNewScene.tsx
+++ b/products/legal_documents/frontend/scenes/LegalDocumentNewScene.tsx
@@ -3,9 +3,12 @@ import { Form } from 'kea-forms'
import { IconBalance, IconSend } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonInput, LemonSelect, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { LemonRadio } from 'lib/lemon-ui/LemonRadio'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { organizationLogic } from 'scenes/organizationLogic'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { Scene, SceneExport } from 'scenes/sceneTypes'
@@ -83,6 +86,7 @@ export function LegalDocumentNewScene(): JSX.Element {
const { isAdminOrOwner } = useValues(organizationLogic)
const { isCloudOrDev } = useValues(preflightLogic)
const { setDocumentType, setDpaMode } = useActions(legalDocumentsLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!isCloudOrDev) {
return (
@@ -152,16 +156,28 @@ export function LegalDocumentNewScene(): JSX.Element {
path: urls.legalDocuments(),
}}
actions={
- <LemonButton
- to={urls.legalDocuments()}
- type="tertiary"
- size="small"
- disabledReason={
- isLegalDocumentSubmitting ? 'Hang tight — your envelope is on its way' : undefined
- }
- >
- Cancel
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="default"
+ render={<LinkPrimitive to={urls.legalDocuments()} />}
+ disabledReason={
+ isLegalDocumentSubmitting ? 'Hang tight — your envelope is on its way' : undefined
+ }
+ >
+ Cancel
+ </Button>
+ ) : (
+ <LemonButton
+ to={urls.legalDocuments()}
+ type="tertiary"
+ size="small"
+ disabledReason={
+ isLegalDocumentSubmitting ? 'Hang tight — your envelope is on its way' : undefined
+ }
+ >
+ Cancel
+ </LemonButton>
+ )
}
/>
diff --git a/products/legal_documents/frontend/scenes/LegalDocumentsScene.tsx b/products/legal_documents/frontend/scenes/LegalDocumentsScene.tsx
index cb103f1be179..3debccfaa3ba 100644
--- a/products/legal_documents/frontend/scenes/LegalDocumentsScene.tsx
+++ b/products/legal_documents/frontend/scenes/LegalDocumentsScene.tsx
@@ -4,6 +4,7 @@ import { IconBalance, IconDownload, IconPlusSmall, IconTrash } from '@posthog/ic
import { LemonBanner, LemonButton, LemonDialog, LemonTable, LemonTag, Link } from '@posthog/lemon-ui'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonMenu, LemonMenuItems } from 'lib/lemon-ui/LemonMenu'
import { organizationLogic } from 'scenes/organizationLogic'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
@@ -18,6 +19,7 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { ContactBillingSupportLink } from '../components/ContactBillingSupportLink'
import { getLegalDocumentsDownloadRetrieveUrl } from '../generated/api'
import { BAA_BLOCK_REASON_MESSAGES, LegalDocument, LegalDocumentType, legalDocumentsLogic } from './legalDocumentsLogic'
+import { QuillNewLegalDocumentMenu } from './QuillNewLegalDocumentMenu'
function buildNewMenuItems(existingTypes: Set<LegalDocumentType>, baaBlockedReason?: string): LemonMenuItems {
const alreadyExistsReason = (type: LegalDocumentType): string | undefined =>
@@ -82,6 +84,7 @@ export function LegalDocumentsScene(): JSX.Element {
const { deleteLegalDocument } = useActions(legalDocumentsLogic)
const { isAdminOrOwner, currentOrganizationId } = useValues(organizationLogic)
const { isCloudOrDev } = useValues(preflightLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!isCloudOrDev) {
return (
@@ -130,20 +133,27 @@ export function LegalDocumentsScene(): JSX.Element {
resourceType={{ type: 'default_icon_type', forceIcon: <IconBalance /> }}
scope={settingsSectionSceneScope('organization-legal-documents')}
actions={
- <LemonMenu
- items={buildNewMenuItems(existingDocumentTypes, baaBlockedReason)}
- placement="bottom-end"
- >
- <LemonButton
- type="primary"
- icon={<IconPlusSmall />}
- size="small"
- data-attr="new-legal-document-button"
- tooltip="Generate a new legal document"
+ todayRailNav ? (
+ <QuillNewLegalDocumentMenu
+ existingDocumentTypes={existingDocumentTypes}
+ baaBlockedReason={baaBlockedReason}
+ />
+ ) : (
+ <LemonMenu
+ items={buildNewMenuItems(existingDocumentTypes, baaBlockedReason)}
+ placement="bottom-end"
>
- New
- </LemonButton>
- </LemonMenu>
+ <LemonButton
+ type="primary"
+ icon={<IconPlusSmall />}
+ size="small"
+ data-attr="new-legal-document-button"
+ tooltip="Generate a new legal document"
+ >
+ New
+ </LemonButton>
+ </LemonMenu>
+ )
}
/>
diff --git a/products/legal_documents/frontend/scenes/QuillNewLegalDocumentMenu.tsx b/products/legal_documents/frontend/scenes/QuillNewLegalDocumentMenu.tsx
new file mode 100644
index 000000000000..a777fcc6d994
--- /dev/null
+++ b/products/legal_documents/frontend/scenes/QuillNewLegalDocumentMenu.tsx
@@ -0,0 +1,92 @@
+import { router } from 'kea-router'
+
+import { IconPlus } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { urls } from 'scenes/urls'
+
+import { LegalDocumentType } from './legalDocumentsLogic'
+
+interface NewLegalDocumentOption {
+ title: string
+ description: string
+ url?: string
+ disabledReason?: string
+ dataAttr: string
+}
+
+export function QuillNewLegalDocumentMenu({
+ existingDocumentTypes,
+ baaBlockedReason,
+}: {
+ existingDocumentTypes: Set<LegalDocumentType>
+ baaBlockedReason?: string
+}): JSX.Element {
+ const alreadyExistsReason = (type: LegalDocumentType): string | undefined =>
+ existingDocumentTypes.has(type)
+ ? `Your organization already has a ${type}. Contact support if you need a new one.`
+ : undefined
+ const options: NewLegalDocumentOption[] = [
+ {
+ title: 'Data Processing Agreement (DPA)',
+ description: 'GDPR-compliant DPA for any paid or free customer.',
+ url: urls.legalDocumentNew('DPA'),
+ disabledReason: alreadyExistsReason('DPA'),
+ dataAttr: 'new-legal-document-menu-dpa',
+ },
+ {
+ title: 'Business Associate Agreement (BAA)',
+ description: 'HIPAA BAA — requires a Boost, Scale, or Enterprise add-on.',
+ url: urls.legalDocumentNew('BAA'),
+ disabledReason: alreadyExistsReason('BAA') ?? baaBlockedReason,
+ dataAttr: 'new-legal-document-menu-baa',
+ },
+ {
+ title: 'Master Service Agreement (MSA)',
+ description: 'Negotiated with sales — contact your TAM or PostHog support to sign one.',
+ disabledReason: 'MSAs are negotiated by sales. Contact your TAM or PostHog support to sign an MSA.',
+ dataAttr: 'new-legal-document-menu-msa',
+ },
+ ]
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="primary"
+ data-attr="new-legal-document-button"
+ tooltip="Generate a new legal document"
+ />
+ }
+ >
+ <IconPlus />
+ New
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuGroup>
+ <DropdownMenuLabel>Document types</DropdownMenuLabel>
+ {options.map((option) => (
+ <DropdownMenuItem
+ key={option.dataAttr}
+ disabledReason={option.disabledReason}
+ onClick={() => option.url && router.actions.push(option.url)}
+ data-attr={option.dataAttr}
+ description={option.description}
+ >
+ {option.title}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/products/legal_documents/package.json b/products/legal_documents/package.json
index 7c960c506f37..55886e5ea4e7 100644
--- a/products/legal_documents/package.json
+++ b/products/legal_documents/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/logs/frontend/LogsScene.tsx b/products/logs/frontend/LogsScene.tsx
index 8d0ffee46fc8..4ec65df02f97 100644
--- a/products/logs/frontend/LogsScene.tsx
+++ b/products/logs/frontend/LogsScene.tsx
@@ -2,6 +2,7 @@ import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { LemonButton, LemonTabs } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
@@ -113,6 +114,15 @@ const LogsSceneTabbedContent = (): JSX.Element => {
}
const LogsSceneFeedbackButton = (): JSX.Element => {
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return (
+ <Button variant="outline" onClick={() => posthog.displaySurvey('019a7d95-3810-0000-34dc-404a58075f17')}>
+ <IconFeedback />
+ Feedback
+ </Button>
+ )
+ }
return (
<LemonButton
size="small"
diff --git a/products/logs/frontend/scenes/LogsAlertDetailScene/LogsAlertDetailScene.tsx b/products/logs/frontend/scenes/LogsAlertDetailScene/LogsAlertDetailScene.tsx
index 0cb46c3cd951..269cb8ffeeef 100644
--- a/products/logs/frontend/scenes/LogsAlertDetailScene/LogsAlertDetailScene.tsx
+++ b/products/logs/frontend/scenes/LogsAlertDetailScene/LogsAlertDetailScene.tsx
@@ -2,9 +2,10 @@ import { BindLogic, useActions, useValues } from 'kea'
import { Form } from 'kea-forms'
import { IconChevronDown, IconTestTube } from '@posthog/icons'
-import { LemonBanner, LemonButton, LemonCard, LemonDialog, LemonModal, LemonTabs } from '@posthog/lemon-ui'
+import { LemonBanner, LemonButton, LemonCard, LemonModal, LemonTabs } from '@posthog/lemon-ui'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonMenu, LemonMenuOverlay } from 'lib/lemon-ui/LemonMenu/LemonMenu'
import { SceneExport } from 'scenes/sceneTypes'
@@ -35,6 +36,8 @@ import {
SNOOZE_DURATIONS,
logsAlertDetailSceneLogic,
} from './logsAlertDetailSceneLogic'
+import { openDeleteLogsAlertDialog } from './openDeleteLogsAlertDialog'
+import { QuillLogsAlertDetailActions } from './QuillLogsAlertDetailActions'
export const scene: SceneExport<LogsAlertDetailSceneLogicProps> = {
component: LogsAlertDetailScene,
@@ -143,6 +146,7 @@ function AlertHeader(): JSX.Element {
const { isAlertFormSubmitting, alertFormChanged, alertForm, alertFormErrors } = useValues(logsAlertFormLogic)
const { submitAlertForm, setAlertFormValue } = useActions(logsAlertFormLogic)
const { pendingNotifications } = useValues(logsAlertNotificationLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const isEnabled = alert?.enabled ?? true
const isBroken = alert?.state === LogsAlertConfigurationStateEnumApi.Broken
@@ -158,7 +162,18 @@ function AlertHeader(): JSX.Element {
onNameChange={(name) => setAlertFormValue('name', name)}
renameDebounceMs={0}
actions={
- alert ? (
+ alert && todayRailNav ? (
+ <QuillLogsAlertDetailActions
+ alert={alert}
+ primaryDisabledReason={primaryDisabledReason({
+ isDraft,
+ alertForm,
+ alertFormChanged,
+ nameError: typeof alertFormErrors?.name === 'string' ? alertFormErrors.name : undefined,
+ hasPendingNotifications: pendingNotifications.length > 0,
+ })}
+ />
+ ) : alert ? (
<div className="flex items-center gap-2">
{(!isEnabled || alert.state !== LogsAlertConfigurationStateEnumApi.NotFiring) && (
<LogsAlertStateIndicator
@@ -224,21 +239,8 @@ function AlertHeader(): JSX.Element {
'data-attr': 'logs-alert-detail-delete',
label: 'Delete',
status: 'danger' as const,
- onClick: () => {
- LemonDialog.open({
- title: `Delete "${alert.name}"?`,
- description:
- 'This alert will be permanently deleted. This action cannot be undone.',
- primaryButton: {
- children: 'Delete',
- type: 'primary',
- status: 'danger',
- onClick: deleteAlert,
- 'data-attr': 'logs-alert-delete-confirm',
- },
- secondaryButton: { children: 'Cancel' },
- })
- },
+ onClick: () =>
+ openDeleteLogsAlertDialog({ alertName: alert.name, deleteAlert }),
},
]}
/>
diff --git a/products/logs/frontend/scenes/LogsAlertDetailScene/QuillLogsAlertDetailActions.tsx b/products/logs/frontend/scenes/LogsAlertDetailScene/QuillLogsAlertDetailActions.tsx
new file mode 100644
index 000000000000..a935a59dabed
--- /dev/null
+++ b/products/logs/frontend/scenes/LogsAlertDetailScene/QuillLogsAlertDetailActions.tsx
@@ -0,0 +1,108 @@
+import { useActions, useValues } from 'kea'
+
+import { IconChevronDown, IconEllipsis } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+import { logsAlertFormLogic } from 'products/logs/frontend/components/LogsAlerting/logsAlertFormLogic'
+import { LogsAlertStateIndicator } from 'products/logs/frontend/components/LogsAlerting/LogsAlertStateIndicator'
+import {
+ LogsAlertConfigurationApi,
+ LogsAlertConfigurationStateEnumApi,
+} from 'products/logs/frontend/generated/api.schemas'
+
+import { SNOOZE_DURATIONS, logsAlertDetailSceneLogic } from './logsAlertDetailSceneLogic'
+import { openDeleteLogsAlertDialog } from './openDeleteLogsAlertDialog'
+
+export interface QuillLogsAlertDetailActionsProps {
+ alert: LogsAlertConfigurationApi
+ primaryDisabledReason: string | undefined
+}
+
+export function QuillLogsAlertDetailActions({
+ alert,
+ primaryDisabledReason,
+}: QuillLogsAlertDetailActionsProps): JSX.Element {
+ const { isDraft } = useValues(logsAlertDetailSceneLogic)
+ const { toggleEnabled, snoozeAlert, unsnoozeAlert, resetAlert, deleteAlert, enableAlert } =
+ useActions(logsAlertDetailSceneLogic)
+ const { isAlertFormSubmitting } = useValues(logsAlertFormLogic)
+ const { submitAlertForm } = useActions(logsAlertFormLogic)
+
+ const isEnabled = alert.enabled ?? true
+ const isBroken = alert.state === LogsAlertConfigurationStateEnumApi.Broken
+ const isSnoozed = alert.state === LogsAlertConfigurationStateEnumApi.Snoozed
+
+ const confirmDelete = (): void => openDeleteLogsAlertDialog({ alertName: alert.name, deleteAlert })
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ {(!isEnabled || alert.state !== LogsAlertConfigurationStateEnumApi.NotFiring) && (
+ <LogsAlertStateIndicator
+ state={alert.state}
+ enabled={isEnabled}
+ firstEnabledAt={alert.first_enabled_at}
+ lastErrorMessage={alert.last_error_message}
+ snoozeUntil={alert.snooze_until}
+ />
+ )}
+ {!isDraft && (
+ <Button
+ variant={isEnabled ? 'destructive-outline' : 'outline'}
+ onClick={toggleEnabled}
+ disabledReason={isBroken ? 'Reset this alert to re-enable checks' : undefined}
+ data-attr="logs-alert-toggle-enabled"
+ >
+ {isEnabled ? 'Disable' : 'Enable'}
+ </Button>
+ )}
+ {isEnabled &&
+ (isSnoozed ? (
+ <Button variant="outline" onClick={unsnoozeAlert}>
+ Unsnooze
+ </Button>
+ ) : (
+ <DropdownMenu>
+ <DropdownMenuTrigger render={<Button variant="outline" />}>
+ Snooze
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {SNOOZE_DURATIONS.map((d) => (
+ <DropdownMenuItem key={d.minutes} onClick={() => snoozeAlert(d.minutes)}>
+ {d.label}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ))}
+ <Button
+ variant="primary"
+ onClick={isDraft ? enableAlert : submitAlertForm}
+ loading={isAlertFormSubmitting}
+ disabledReason={primaryDisabledReason}
+ data-attr={isDraft ? 'logs-alert-enable-primary' : 'logs-alert-save-primary'}
+ >
+ {isDraft ? 'Enable alert' : 'Save'}
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button size="icon" aria-label="More actions" tooltip="More actions" data-attr="more-button" />
+ }
+ >
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {isBroken && <DropdownMenuItem onClick={resetAlert}>Reset alert</DropdownMenuItem>}
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={confirmDelete}
+ data-attr="logs-alert-detail-delete"
+ >
+ Delete
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ )
+}
diff --git a/products/logs/frontend/scenes/LogsAlertDetailScene/openDeleteLogsAlertDialog.ts b/products/logs/frontend/scenes/LogsAlertDetailScene/openDeleteLogsAlertDialog.ts
new file mode 100644
index 000000000000..235b96d0744a
--- /dev/null
+++ b/products/logs/frontend/scenes/LogsAlertDetailScene/openDeleteLogsAlertDialog.ts
@@ -0,0 +1,22 @@
+import { LemonDialog } from '@posthog/lemon-ui'
+
+export function openDeleteLogsAlertDialog({
+ alertName,
+ deleteAlert,
+}: {
+ alertName: string | undefined
+ deleteAlert: () => void
+}): void {
+ LemonDialog.open({
+ title: `Delete "${alertName}"?`,
+ description: 'This alert will be permanently deleted. This action cannot be undone.',
+ primaryButton: {
+ children: 'Delete',
+ type: 'primary',
+ status: 'danger',
+ onClick: deleteAlert,
+ 'data-attr': 'logs-alert-delete-confirm',
+ },
+ secondaryButton: { children: 'Cancel' },
+ })
+}
diff --git a/products/logs/frontend/scenes/LogsAlertNotificationDetailScene/LogsAlertNotificationDetailScene.tsx b/products/logs/frontend/scenes/LogsAlertNotificationDetailScene/LogsAlertNotificationDetailScene.tsx
index 48c9b79d9138..f683299bb9d7 100644
--- a/products/logs/frontend/scenes/LogsAlertNotificationDetailScene/LogsAlertNotificationDetailScene.tsx
+++ b/products/logs/frontend/scenes/LogsAlertNotificationDetailScene/LogsAlertNotificationDetailScene.tsx
@@ -3,9 +3,11 @@ import { useEffect } from 'react'
import { IconExternal, IconTrash } from '@posthog/icons'
import { LemonButton, LemonDialog, LemonSkeleton, LemonSwitch, LemonTag, Tooltip } from '@posthog/lemon-ui'
+import { Badge, Button } from '@posthog/quill'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { slackIntegrationLogic } from 'lib/integrations/slackIntegrationLogic'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -56,6 +58,7 @@ export function LogsAlertNotificationDetailScene(): JSX.Element {
const slackLogic = slackIntegrationLogic({ id: firstSlackIntegration?.id ?? 0 })
const { slackChannels } = useValues(slackLogic)
const { loadAllSlackChannels } = useActions(slackLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
useEffect(() => {
if (firstSlackIntegration) {
@@ -66,6 +69,21 @@ export function LogsAlertNotificationDetailScene(): JSX.Element {
const loading = alertLoading || hogFunctionsLoading
const displayLabel = destinationGroup ? resolveGroupLabel(destinationGroup, slackChannels) : 'Destination'
const editorReturnTo = encodeURIComponent(urls.logsAlertNotificationDetail(alertId, hogFunctionId))
+ const confirmRemoveDestination = (): void => {
+ LemonDialog.open({
+ title: `Remove ${displayLabel}?`,
+ description:
+ 'This will delete all notification functions for this destination. The underlying hog functions will be soft-deleted.',
+ primaryButton: {
+ children: 'Remove',
+ type: 'primary',
+ status: 'danger',
+ onClick: () => deleteDestination(displayLabel),
+ 'data-attr': 'logs-alert-destination-delete-confirm',
+ },
+ secondaryButton: { children: 'Cancel' },
+ })
+ }
if (hogFunctionsError) {
return (
@@ -74,14 +92,28 @@ export function LogsAlertNotificationDetailScene(): JSX.Element {
name="Couldn't load destination"
resourceType={{ type: 'logs' }}
actions={
- <div className="flex items-center gap-2">
- <LemonButton type="secondary" to={urls.logsAlertDetail(alertId, 'notifications')}>
- Back to alert
- </LemonButton>
- <LemonButton type="primary" onClick={() => loadHogFunctions()}>
- Retry
- </LemonButton>
- </div>
+ todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={urls.logsAlertDetail(alertId, 'notifications')} />}
+ >
+ Back to alert
+ </Button>
+ <Button variant="primary" onClick={() => loadHogFunctions()}>
+ Retry
+ </Button>
+ </div>
+ ) : (
+ <div className="flex items-center gap-2">
+ <LemonButton type="secondary" to={urls.logsAlertDetail(alertId, 'notifications')}>
+ Back to alert
+ </LemonButton>
+ <LemonButton type="primary" onClick={() => loadHogFunctions()}>
+ Retry
+ </LemonButton>
+ </div>
+ )
}
/>
<div className="p-8 text-muted text-center">
@@ -98,9 +130,18 @@ export function LogsAlertNotificationDetailScene(): JSX.Element {
name="Destination not found"
resourceType={{ type: 'logs' }}
actions={
- <LemonButton type="secondary" to={urls.logsAlertDetail(alertId, 'notifications')}>
- Back to alert
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={urls.logsAlertDetail(alertId, 'notifications')} />}
+ >
+ Back to alert
+ </Button>
+ ) : (
+ <LemonButton type="secondary" to={urls.logsAlertDetail(alertId, 'notifications')}>
+ Back to alert
+ </LemonButton>
+ )
}
/>
<div className="p-8 text-muted text-center">
@@ -126,7 +167,22 @@ export function LogsAlertNotificationDetailScene(): JSX.Element {
resourceType={{ type: 'logs' }}
isLoading={loading && !destinationGroup}
actions={
- destinationGroup ? (
+ destinationGroup && todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ <Badge variant={destinationGroup.enabled ? 'success' : 'default'}>
+ {destinationGroup.enabled ? 'Active' : 'Paused'}
+ </Badge>
+ <Button
+ variant="destructive-outline"
+ disabledReason={isDeleting ? 'Removing…' : undefined}
+ onClick={confirmRemoveDestination}
+ data-attr="logs-alert-destination-delete"
+ >
+ <IconTrash />
+ Remove destination
+ </Button>
+ </div>
+ ) : destinationGroup ? (
<div className="flex items-center gap-2">
<LemonTag type={destinationGroup.enabled ? 'success' : 'default'}>
{destinationGroup.enabled ? 'Active' : 'Paused'}
@@ -142,21 +198,7 @@ export function LogsAlertNotificationDetailScene(): JSX.Element {
status="danger"
icon={<IconTrash />}
disabledReason={isDeleting ? 'Removing…' : undefined}
- onClick={() => {
- LemonDialog.open({
- title: `Remove ${displayLabel}?`,
- description:
- 'This will delete all notification functions for this destination. The underlying hog functions will be soft-deleted.',
- primaryButton: {
- children: 'Remove',
- type: 'primary',
- status: 'danger',
- onClick: () => deleteDestination(displayLabel),
- 'data-attr': 'logs-alert-destination-delete-confirm',
- },
- secondaryButton: { children: 'Cancel' },
- })
- }}
+ onClick={confirmRemoveDestination}
data-attr="logs-alert-destination-delete"
>
Remove destination
diff --git a/products/logs/frontend/scenes/LogsRetentionDetailScene/LogsRetentionDetailScene.tsx b/products/logs/frontend/scenes/LogsRetentionDetailScene/LogsRetentionDetailScene.tsx
index b396b011e76b..0e91a5085f3e 100644
--- a/products/logs/frontend/scenes/LogsRetentionDetailScene/LogsRetentionDetailScene.tsx
+++ b/products/logs/frontend/scenes/LogsRetentionDetailScene/LogsRetentionDetailScene.tsx
@@ -2,7 +2,9 @@ import { BindLogic, useActions, useValues } from 'kea'
import { Form } from 'kea-forms'
import { LemonButton, LemonDialog } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { SceneExport } from 'scenes/sceneTypes'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
@@ -54,6 +56,7 @@ function LogsRetentionDetailFormBody({ rule }: { rule: LogsRetentionRuleApi }):
const { setRetentionFormValue } = useActions(logsRetentionFormLogic(formProps))
const { retentionForm, isRetentionFormSubmitting } = useValues(logsRetentionFormLogic(formProps))
const saveDisabledReason = retentionFormSaveDisabledReason(retentionForm)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const confirmDelete = (): void => {
LemonDialog.open({
@@ -79,9 +82,15 @@ function LogsRetentionDetailFormBody({ rule }: { rule: LogsRetentionRuleApi }):
onNameChange={(name) => setRetentionFormValue('name', name)}
renameDebounceMs={0}
actions={
- <LemonButton type="secondary" status="danger" onClick={confirmDelete}>
- Delete
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="destructive-outline" onClick={confirmDelete}>
+ Delete
+ </Button>
+ ) : (
+ <LemonButton type="secondary" status="danger" onClick={confirmDelete}>
+ Delete
+ </LemonButton>
+ )
}
/>
<SceneStickyBar>
diff --git a/products/logs/frontend/scenes/LogsSamplingDetailScene/LogsSamplingDetailScene.tsx b/products/logs/frontend/scenes/LogsSamplingDetailScene/LogsSamplingDetailScene.tsx
index f97860a26990..903beb6d2c88 100644
--- a/products/logs/frontend/scenes/LogsSamplingDetailScene/LogsSamplingDetailScene.tsx
+++ b/products/logs/frontend/scenes/LogsSamplingDetailScene/LogsSamplingDetailScene.tsx
@@ -3,7 +3,9 @@ import { Form } from 'kea-forms'
import { IconInfo, IconRefresh } from '@posthog/icons'
import { LemonButton, LemonDialog } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { Tooltip } from 'lib/lemon-ui/Tooltip/Tooltip'
import { compactNumber, humanizeBytes } from 'lib/utils/numbers'
import { SceneExport } from 'scenes/sceneTypes'
@@ -60,6 +62,7 @@ function LogsSamplingDetailFormBody({ rule }: { rule: LogsSamplingRuleApi }): JS
const { samplingForm, isSamplingFormSubmitting } = useValues(logsSamplingFormLogic(formProps))
const { ruleDropImpact24h, ruleDropImpact24hLoading } = useValues(logsSamplingDetailSceneLogic)
const saveDisabledReason = samplingFormSaveDisabledReason(samplingForm)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const confirmDelete = (): void => {
LemonDialog.open({
@@ -85,9 +88,15 @@ function LogsSamplingDetailFormBody({ rule }: { rule: LogsSamplingRuleApi }): JS
onNameChange={(name) => setSamplingFormValue('name', name)}
renameDebounceMs={0}
actions={
- <LemonButton type="secondary" status="danger" onClick={confirmDelete}>
- Delete
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="destructive-outline" onClick={confirmDelete}>
+ Delete
+ </Button>
+ ) : (
+ <LemonButton type="secondary" status="danger" onClick={confirmDelete}>
+ Delete
+ </LemonButton>
+ )
}
/>
<SceneStickyBar>
diff --git a/products/logs/package.json b/products/logs/package.json
index ee13feb1c866..23340eb134a3 100644
--- a/products/logs/package.json
+++ b/products/logs/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ skills/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
diff --git a/products/managed_migrations/frontend/ManagedMigration.tsx b/products/managed_migrations/frontend/ManagedMigration.tsx
index 3e1c17a3d1c2..d982fa6091db 100644
--- a/products/managed_migrations/frontend/ManagedMigration.tsx
+++ b/products/managed_migrations/frontend/ManagedMigration.tsx
@@ -3,12 +3,14 @@ import { Form } from 'kea-forms'
import { IconSort } from '@posthog/icons'
import { LemonButton, LemonTable, LemonTag, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { CodeSnippet, Language } from 'lib/components/CodeSnippet'
import { FlaggedFeature } from 'lib/components/FlaggedFeature'
import { TZLabel } from 'lib/components/TZLabel'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonCalendarSelectInput } from 'lib/lemon-ui/LemonCalendar/LemonCalendarSelect'
import { LemonCheckbox } from 'lib/lemon-ui/LemonCheckbox'
import { LemonField } from 'lib/lemon-ui/LemonField'
@@ -16,6 +18,7 @@ import { LemonInput } from 'lib/lemon-ui/LemonInput'
import { LemonProgress } from 'lib/lemon-ui/LemonProgress'
import { LemonSegmentedButton } from 'lib/lemon-ui/LemonSegmentedButton'
import { LemonSelect } from 'lib/lemon-ui/LemonSelect'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
import { humanFriendlyNumber } from 'lib/utils/numbers'
import { sceneConfigurations } from 'scenes/scenes'
@@ -141,6 +144,7 @@ function IamRoleSetupInstructions({
export function ManagedMigration(): JSX.Element {
const { managedMigration, isManagedMigrationSubmitting, awsIamSetup } = useValues(managedMigrationLogic)
const { setManagedMigrationValue } = useActions(managedMigrationLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const isS3Source = managedMigration.source_type === 's3' || managedMigration.source_type === 's3_gzip'
const usesIamRole = isS3Source && managedMigration.s3_auth_method === 'iam_role' && !!awsIamSetup?.available
@@ -152,9 +156,15 @@ export function ManagedMigration(): JSX.Element {
name="New managed migration"
resourceType={{ type: 'managed_migration', forceIcon: <IconSort /> }}
actions={
- <LemonButton type="primary" htmlType="submit" size="small">
- {managedMigration.is_trial ? 'Start trial run' : 'Import Data'}
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="primary" type="submit">
+ {managedMigration.is_trial ? 'Start trial run' : 'Import Data'}
+ </Button>
+ ) : (
+ <LemonButton type="primary" htmlType="submit" size="small">
+ {managedMigration.is_trial ? 'Start trial run' : 'Import Data'}
+ </LemonButton>
+ )
}
forceBackTo={{
path: urls.managedMigration(),
@@ -469,6 +479,7 @@ function completedLabel(migration: ManagedMigrationData): string {
export function ManagedMigrations(): JSX.Element {
const { managedMigrationId, migrations, migrationsLoading, promotingMigrationId } = useValues(managedMigrationLogic)
const { pauseMigration, resumeMigration, promoteTrial, viewTrialResults } = useActions(managedMigrationLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const calculateProgress = (
migration: ManagedMigrationData
@@ -502,14 +513,24 @@ export function ManagedMigrations(): JSX.Element {
forceIcon: <IconSort />,
}}
actions={
- <LemonButton
- data-attr="new-managed-migration"
- to={urls.managedMigrationNew()}
- type="primary"
- size="small"
- >
- New migration
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="primary"
+ data-attr="new-managed-migration"
+ render={<LinkPrimitive to={urls.managedMigrationNew()} />}
+ >
+ New migration
+ </Button>
+ ) : (
+ <LemonButton
+ data-attr="new-managed-migration"
+ to={urls.managedMigrationNew()}
+ type="primary"
+ size="small"
+ >
+ New migration
+ </LemonButton>
+ )
}
/>
<LemonTable
diff --git a/products/managed_migrations/package.json b/products/managed_migrations/package.json
index 9316e258fb08..40eeca506924 100644
--- a/products/managed_migrations/package.json
+++ b/products/managed_migrations/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/tests backend/api/test -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx b/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx
index f36fa82de988..4e110faa9947 100644
--- a/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx
+++ b/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx
@@ -2,9 +2,12 @@ import { useValues } from 'kea'
import { router, combineUrl } from 'kea-router'
import { LemonButton, LemonTab, LemonTabs, LemonTag } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { urls } from 'scenes/urls'
@@ -42,6 +45,7 @@ export function MCPAnalyticsScene(): JSX.Element {
const { notificationCount } = useValues(mcpAnalyticsNotificationsLogic)
const { featureFlags } = useValues(featureFlagLogic)
const intentRoutingEnabled = !!featureFlags[FEATURE_FLAGS.MCP_ANALYTICS_INTENT_ROUTING]
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (activeTab === 'intent-clustering' && !intentRoutingEnabled) {
return <NotFound object="page" />
@@ -128,9 +132,15 @@ export function MCPAnalyticsScene(): JSX.Element {
description={onboardingState === 'onboarded' ? TAB_DESCRIPTIONS[activeTab] : null}
resourceType={{ type: 'mcp_analytics' }}
actions={
- <LemonButton to={MCP_DOCS_URL} type="secondary" targetBlank size="small">
- Documentation
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="outline" render={<LinkPrimitive to={MCP_DOCS_URL} target="_blank" />}>
+ Documentation
+ </Button>
+ ) : (
+ <LemonButton to={MCP_DOCS_URL} type="secondary" targetBlank size="small">
+ Documentation
+ </LemonButton>
+ )
}
/>
diff --git a/products/mcp_analytics/package.json b/products/mcp_analytics/package.json
index a6420856526b..da097b4980b4 100644
--- a/products/mcp_analytics/package.json
+++ b/products/mcp_analytics/package.json
@@ -5,6 +5,7 @@
},
"dependencies": {
"@posthog/icons": "catalog:",
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"@posthog/quill-components": "workspace:*",
"@posthog/quill-primitives": "workspace:*",
diff --git a/products/metrics/frontend/MetricsScene.tsx b/products/metrics/frontend/MetricsScene.tsx
index 2f820289821d..aacaa54c15a2 100644
--- a/products/metrics/frontend/MetricsScene.tsx
+++ b/products/metrics/frontend/MetricsScene.tsx
@@ -2,7 +2,9 @@ import { useActions, useMountedLogic, useValues } from 'kea'
import posthog from 'posthog-js'
import { LemonBanner, LemonButton, LemonTabs } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { IconFeedback } from 'lib/lemon-ui/icons'
import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
@@ -21,6 +23,7 @@ import { MetricsOverview } from './components/MetricsOverview'
import { MetricsSqlEditor } from './components/MetricsSqlEditor'
import { metricsUsageTrackingLogic } from './components/metricsUsageTrackingLogic'
import { MetricsViewer } from './components/MetricsViewer'
+import { QuillMetricsDashboardActions } from './components/QuillMetricsDashboardActions'
import { MetricsDashboardImportModal } from './dashboardImport/MetricsDashboardImportModal'
import { metricsEmptyState } from './emptyState/metricsEmptyState'
import { metricsFeaturePreviewGate } from './featurePreviewGate'
@@ -79,6 +82,7 @@ const MetricsSceneContent = (): JSX.Element => {
useOnMountEffect(() => {
primeItems()
})
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const onFeedbackClick = (): void => {
posthog.displaySurvey(METRICS_FEEDBACK_SURVEY_ID)
@@ -93,15 +97,32 @@ const MetricsSceneContent = (): JSX.Element => {
type: sceneConfigurations[Scene.Metrics].iconType || 'default_icon_type',
}}
actions={
- <>
- {/* In a narrow scene, the tab bar has no space for the import menu. */}
- <div className="@min-[48rem]/metrics-scene:hidden">
- <MetricsDashboardActions />
+ todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ <div className="@min-[48rem]/metrics-scene:hidden">
+ <QuillMetricsDashboardActions />
+ </div>
+ <Button variant="outline" onClick={onFeedbackClick}>
+ <IconFeedback />
+ Feedback
+ </Button>
</div>
- <LemonButton size="small" type="secondary" icon={<IconFeedback />} onClick={onFeedbackClick}>
- Feedback
- </LemonButton>
- </>
+ ) : (
+ <>
+ {/* In a narrow scene, the tab bar has no space for the import menu. */}
+ <div className="@min-[48rem]/metrics-scene:hidden">
+ <MetricsDashboardActions />
+ </div>
+ <LemonButton
+ size="small"
+ type="secondary"
+ icon={<IconFeedback />}
+ onClick={onFeedbackClick}
+ >
+ Feedback
+ </LemonButton>
+ </>
+ )
}
/>
<LemonBanner
diff --git a/products/metrics/frontend/components/MetricsDashboardActions.tsx b/products/metrics/frontend/components/MetricsDashboardActions.tsx
index 6e81d1d688ea..2b125595ccb4 100644
--- a/products/metrics/frontend/components/MetricsDashboardActions.tsx
+++ b/products/metrics/frontend/components/MetricsDashboardActions.tsx
@@ -13,9 +13,9 @@ import type { DashboardImportApi } from 'products/metrics/frontend/generated/api
import { metricsDashboardImportLogic } from '../dashboardImport/metricsDashboardImportLogic'
import { SuggestedDashboardsMenu } from '../suggestedDashboards/SuggestedDashboardsMenu'
-const MAX_LISTED_IMPORTS = 5
+export const MAX_LISTED_IMPORTS = 5
-function importStatusLine(dashboardImport: DashboardImportApi): string {
+export function importStatusLine(dashboardImport: DashboardImportApi): string {
if (dashboardImport.status === 'running') {
const panels = dashboardImport.panel_progress
const settled = panels.filter((panel) => panel.state === 'done' || panel.state === 'skipped').length
diff --git a/products/metrics/frontend/components/QuillMetricsDashboardActions.tsx b/products/metrics/frontend/components/QuillMetricsDashboardActions.tsx
new file mode 100644
index 000000000000..b8a8b87b13a2
--- /dev/null
+++ b/products/metrics/frontend/components/QuillMetricsDashboardActions.tsx
@@ -0,0 +1,106 @@
+import { useActions, useValues } from 'kea'
+
+import { IconCheckCircle, IconChevronDown, IconWarning } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+ Spinner,
+} from '@posthog/quill'
+
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { metricsDashboardImportLogic } from '../dashboardImport/metricsDashboardImportLogic'
+import { QuillSuggestedDashboardsMenu } from '../suggestedDashboards/QuillSuggestedDashboardsMenu'
+import { importStatusLine, MAX_LISTED_IMPORTS } from './MetricsDashboardActions'
+
+export function QuillMetricsDashboardActions(): JSX.Element | null {
+ const { recentImports, runningImports } = useValues(metricsDashboardImportLogic)
+ const { openImportModal, openImport } = useActions(metricsDashboardImportLogic)
+ const importEnabled = useFeatureFlag('METRICS_DASHBOARD_IMPORT')
+ const suggestionsEnabled = useFeatureFlag('METRICS_SUGGESTED_DASHBOARDS')
+
+ if (!importEnabled && !suggestionsEnabled) {
+ return null
+ }
+ const importDisabledReason =
+ getAccessControlDisabledReason(AccessControlResourceType.Dashboard, AccessControlLevel.Editor) ??
+ getAccessControlDisabledReason(AccessControlResourceType.Insight, AccessControlLevel.Editor)
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ {suggestionsEnabled && <QuillSuggestedDashboardsMenu />}
+ {importEnabled && (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="outline"
+ disabledReason={importDisabledReason}
+ tooltip={
+ runningImports.length
+ ? `${runningImports.length} ${runningImports.length === 1 ? 'import is' : 'imports are'} running`
+ : undefined
+ }
+ data-attr="metrics-dashboard-import-menu"
+ />
+ }
+ >
+ {runningImports.length ? <Spinner /> : null}
+ Import
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-56">
+ <DropdownMenuGroup>
+ <DropdownMenuItem
+ onClick={() => openImportModal('grafana')}
+ data-attr="metrics-dashboard-import-grafana"
+ >
+ Import from Grafana
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={() => openImportModal('screenshot')}
+ data-attr="metrics-dashboard-import-screenshot"
+ >
+ Import from screenshot
+ </DropdownMenuItem>
+ </DropdownMenuGroup>
+ {recentImports.length > 0 && (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuGroup>
+ <DropdownMenuLabel>Recent imports</DropdownMenuLabel>
+ {recentImports.slice(0, MAX_LISTED_IMPORTS).map((dashboardImport, index) => (
+ <DropdownMenuItem
+ key={dashboardImport.id ?? index}
+ onClick={() => openImport(dashboardImport)}
+ data-attr="metrics-dashboard-import-recent"
+ description={importStatusLine(dashboardImport)}
+ >
+ {dashboardImport.status === 'running' ? (
+ <Spinner />
+ ) : dashboardImport.status === 'completed' ? (
+ <IconCheckCircle className="text-success" />
+ ) : (
+ <IconWarning className="text-danger" />
+ )}
+ <span className="truncate max-w-80">{dashboardImport.dashboard_name}</span>
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuGroup>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ </div>
+ )
+}
diff --git a/products/metrics/frontend/dashboardReview/DashboardTemplateDetail.tsx b/products/metrics/frontend/dashboardReview/DashboardTemplateDetail.tsx
index 5359904f31a8..2e922661fbfe 100644
--- a/products/metrics/frontend/dashboardReview/DashboardTemplateDetail.tsx
+++ b/products/metrics/frontend/dashboardReview/DashboardTemplateDetail.tsx
@@ -3,6 +3,7 @@ import { useActions, useValues } from 'kea'
import { IconSparkles } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonCollapse, LemonSkeleton, LemonTag } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { cn } from 'lib/utils/css-classes'
import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'
import { Dashboard } from 'scenes/dashboard/Dashboard'
@@ -19,6 +20,7 @@ import { useMcpToolApplyBack } from 'products/posthog_ai/frontend/api/logics'
import { DashboardTemplateStatusTag } from './DashboardTemplateStatusTag'
import { GenerationChecks } from './GenerationChecks'
import { metricsDashboardReviewSceneLogic } from './metricsDashboardReviewSceneLogic'
+import { QuillDashboardTemplateDetailActions } from './QuillDashboardTemplateDetailActions'
// PostHog AI edits the preview with these tools. The embedded dashboard reloads after each one.
const DASHBOARD_EDIT_TOOLS = [
@@ -47,6 +49,7 @@ export function DashboardTemplateDetail(): JSX.Element {
const { approveTemplate, rejectTemplate } = useActions(metricsDashboardReviewSceneLogic)
const { openSidePanel } = useActions(sidePanelStateLogic)
const { dataProcessingAccepted, dataProcessingApprovalDisabledReason } = useValues(maxGlobalLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!template) {
return templateLoading ? (
@@ -70,58 +73,62 @@ export function DashboardTemplateDetail(): JSX.Element {
description={template.description}
resourceType={{ type: 'metrics' }}
actions={
- <>
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconSparkles className="text-ai" />}
- onClick={editWithAI}
- disabledReason={
- !reviewable
- ? 'Only a dashboard that waits for review can be changed'
- : !previewDashboardId
- ? 'Open the preview first'
- : !dataProcessingAccepted
- ? (dataProcessingApprovalDisabledReason ??
- 'Approve AI data processing to use PostHog AI')
- : undefined
- }
- data-attr="metrics-dashboard-review-edit-with-ai"
- >
- <span
- className={cn(
- 'rainbow-text font-semibold',
- !(inStorybook() || inStorybookTestRunner()) && 'rainbow-text-animating'
- )}
- >
- Edit with PostHog AI
- </span>
- </LemonButton>
- {reviewable && template.status !== 'rejected' && (
+ todayRailNav ? (
+ <QuillDashboardTemplateDetailActions template={template} onEditWithAI={editWithAI} />
+ ) : (
+ <>
<LemonButton
type="secondary"
- status="danger"
- size="small"
- onClick={rejectTemplate}
- loading={templateLoading}
- data-attr="metrics-dashboard-review-reject"
- >
- Reject
- </LemonButton>
- )}
- {reviewable && (
- <LemonButton
- type="primary"
size="small"
- onClick={approveTemplate}
- loading={templateLoading}
- tooltip="Projects that send these metrics see this dashboard as a suggestion. Your changes to the preview become part of it."
- data-attr="metrics-dashboard-review-approve"
+ icon={<IconSparkles className="text-ai" />}
+ onClick={editWithAI}
+ disabledReason={
+ !reviewable
+ ? 'Only a dashboard that waits for review can be changed'
+ : !previewDashboardId
+ ? 'Open the preview first'
+ : !dataProcessingAccepted
+ ? (dataProcessingApprovalDisabledReason ??
+ 'Approve AI data processing to use PostHog AI')
+ : undefined
+ }
+ data-attr="metrics-dashboard-review-edit-with-ai"
>
- Approve
+ <span
+ className={cn(
+ 'rainbow-text font-semibold',
+ !(inStorybook() || inStorybookTestRunner()) && 'rainbow-text-animating'
+ )}
+ >
+ Edit with PostHog AI
+ </span>
</LemonButton>
- )}
- </>
+ {reviewable && template.status !== 'rejected' && (
+ <LemonButton
+ type="secondary"
+ status="danger"
+ size="small"
+ onClick={rejectTemplate}
+ loading={templateLoading}
+ data-attr="metrics-dashboard-review-reject"
+ >
+ Reject
+ </LemonButton>
+ )}
+ {reviewable && (
+ <LemonButton
+ type="primary"
+ size="small"
+ onClick={approveTemplate}
+ loading={templateLoading}
+ tooltip="Projects that send these metrics see this dashboard as a suggestion. Your changes to the preview become part of it."
+ data-attr="metrics-dashboard-review-approve"
+ >
+ Approve
+ </LemonButton>
+ )}
+ </>
+ )
}
/>
<div className="flex flex-wrap items-center gap-2">
diff --git a/products/metrics/frontend/dashboardReview/DashboardTemplateList.tsx b/products/metrics/frontend/dashboardReview/DashboardTemplateList.tsx
index 473988e61f7f..9c5f51eaadc1 100644
--- a/products/metrics/frontend/dashboardReview/DashboardTemplateList.tsx
+++ b/products/metrics/frontend/dashboardReview/DashboardTemplateList.tsx
@@ -1,8 +1,10 @@
import { useActions, useValues } from 'kea'
import { LemonButton, LemonSegmentedButton, LemonTable, LemonTag } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonTableLink } from 'lib/lemon-ui/LemonTable/LemonTableLink'
import { urls } from 'scenes/urls'
@@ -25,6 +27,7 @@ export function DashboardTemplateList(): JSX.Element {
metricsDashboardReviewSceneLogic
)
const { setStatusFilter, analyzeProject } = useActions(metricsDashboardReviewSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<>
@@ -33,16 +36,28 @@ export function DashboardTemplateList(): JSX.Element {
description="Approve AI-generated metrics dashboards before projects see them."
resourceType={{ type: 'metrics' }}
actions={
- <LemonButton
- type="secondary"
- size="small"
- onClick={analyzeProject}
- loading={analysisStartedLoading}
- tooltip="Look for new groups of metrics in this project, and generate dashboards for them."
- data-attr="metrics-dashboard-review-analyze"
- >
- Analyze this project
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="outline"
+ onClick={analyzeProject}
+ loading={analysisStartedLoading}
+ tooltip="Look for new groups of metrics in this project, and generate dashboards for them."
+ data-attr="metrics-dashboard-review-analyze"
+ >
+ Analyze this project
+ </Button>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ onClick={analyzeProject}
+ loading={analysisStartedLoading}
+ tooltip="Look for new groups of metrics in this project, and generate dashboards for them."
+ data-attr="metrics-dashboard-review-analyze"
+ >
+ Analyze this project
+ </LemonButton>
+ )
}
/>
<LemonSegmentedButton
diff --git a/products/metrics/frontend/dashboardReview/QuillDashboardTemplateDetailActions.tsx b/products/metrics/frontend/dashboardReview/QuillDashboardTemplateDetailActions.tsx
new file mode 100644
index 000000000000..ed571a7dd0fe
--- /dev/null
+++ b/products/metrics/frontend/dashboardReview/QuillDashboardTemplateDetailActions.tsx
@@ -0,0 +1,76 @@
+import { useActions, useValues } from 'kea'
+
+import { IconSparkles } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { cn } from 'lib/utils/css-classes'
+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'
+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+
+import type { MetricsDashboardTemplateApi } from 'products/metrics/frontend/generated/api.schemas'
+
+import { metricsDashboardReviewSceneLogic } from './metricsDashboardReviewSceneLogic'
+
+export interface QuillDashboardTemplateDetailActionsProps {
+ template: MetricsDashboardTemplateApi
+ onEditWithAI: () => void
+}
+
+export function QuillDashboardTemplateDetailActions({
+ template,
+ onEditWithAI,
+}: QuillDashboardTemplateDetailActionsProps): JSX.Element {
+ const { templateLoading, previewDashboardId, reviewable } = useValues(metricsDashboardReviewSceneLogic)
+ const { approveTemplate, rejectTemplate } = useActions(metricsDashboardReviewSceneLogic)
+ const { dataProcessingAccepted, dataProcessingApprovalDisabledReason } = useValues(maxGlobalLogic)
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ <Button
+ variant="outline"
+ onClick={onEditWithAI}
+ disabledReason={
+ !reviewable
+ ? 'Only a dashboard that waits for review can be changed'
+ : !previewDashboardId
+ ? 'Open the preview first'
+ : !dataProcessingAccepted
+ ? (dataProcessingApprovalDisabledReason ?? 'Approve AI data processing to use PostHog AI')
+ : undefined
+ }
+ data-attr="metrics-dashboard-review-edit-with-ai"
+ >
+ <IconSparkles className="text-ai" />
+ <span
+ className={cn(
+ 'rainbow-text font-semibold',
+ !(inStorybook() || inStorybookTestRunner()) && 'rainbow-text-animating'
+ )}
+ >
+ Edit with PostHog AI
+ </span>
+ </Button>
+ {reviewable && template.status !== 'rejected' && (
+ <Button
+ variant="destructive-outline"
+ onClick={rejectTemplate}
+ loading={templateLoading}
+ data-attr="metrics-dashboard-review-reject"
+ >
+ Reject
+ </Button>
+ )}
+ {reviewable && (
+ <Button
+ variant="primary"
+ onClick={approveTemplate}
+ loading={templateLoading}
+ tooltip="Projects that send these metrics see this dashboard as a suggestion. Your changes to the preview become part of it."
+ data-attr="metrics-dashboard-review-approve"
+ >
+ Approve
+ </Button>
+ )}
+ </div>
+ )
+}
diff --git a/products/metrics/frontend/suggestedDashboards/QuillSuggestedDashboardsMenu.tsx b/products/metrics/frontend/suggestedDashboards/QuillSuggestedDashboardsMenu.tsx
new file mode 100644
index 000000000000..cd1958629256
--- /dev/null
+++ b/products/metrics/frontend/suggestedDashboards/QuillSuggestedDashboardsMenu.tsx
@@ -0,0 +1,87 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+
+import { IconChevronDown, IconSparkles } from '@posthog/icons'
+import {
+ Badge,
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+import { cn } from 'lib/utils/css-classes'
+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'
+import { urls } from 'scenes/urls'
+import { userLogic } from 'scenes/userLogic'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { QuillSuggestionItem } from './QuillSuggestionItem'
+import { suggestedDashboardsLogic } from './suggestedDashboardsLogic'
+
+export function QuillSuggestedDashboardsMenu(): JSX.Element | null {
+ const { suggestions, openingId, newSuggestionCount } = useValues(suggestedDashboardsLogic)
+ const { openSuggestion, menuOpened } = useActions(suggestedDashboardsLogic)
+ const { user } = useValues(userLogic)
+
+ const disabledReason =
+ getAccessControlDisabledReason(AccessControlResourceType.Dashboard, AccessControlLevel.Editor) ??
+ getAccessControlDisabledReason(AccessControlResourceType.Insight, AccessControlLevel.Editor)
+
+ if (suggestions === null || (suggestions.length === 0 && !user?.is_staff)) {
+ return null
+ }
+
+ return (
+ <DropdownMenu
+ onOpenChange={(open) => {
+ if (open) {
+ menuOpened()
+ }
+ }}
+ >
+ <DropdownMenuTrigger render={<Button variant="outline" data-attr="metrics-suggested-dashboards-menu" />}>
+ <IconSparkles className="text-ai" />
+ <span
+ className={cn(
+ 'rainbow-text font-semibold',
+ !(inStorybook() || inStorybookTestRunner()) && 'rainbow-text-animating'
+ )}
+ >
+ Suggested
+ </span>
+ {newSuggestionCount > 0 && <Badge>{newSuggestionCount}</Badge>}
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-56">
+ {suggestions.length > 0 && (
+ <DropdownMenuGroup>
+ {suggestions.map((suggestion) => (
+ <QuillSuggestionItem
+ key={suggestion.id}
+ suggestion={suggestion}
+ openingId={openingId}
+ openSuggestion={openSuggestion}
+ disabledReason={disabledReason}
+ />
+ ))}
+ </DropdownMenuGroup>
+ )}
+ {suggestions.length > 0 && user?.is_staff && <DropdownMenuSeparator />}
+ {user?.is_staff && (
+ <DropdownMenuItem
+ onClick={() => router.actions.push(urls.metricsDashboardReview())}
+ data-attr="metrics-suggested-dashboards-review"
+ >
+ Review generated dashboards
+ </DropdownMenuItem>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/products/metrics/frontend/suggestedDashboards/QuillSuggestionItem.tsx b/products/metrics/frontend/suggestedDashboards/QuillSuggestionItem.tsx
new file mode 100644
index 000000000000..04e051ef3034
--- /dev/null
+++ b/products/metrics/frontend/suggestedDashboards/QuillSuggestionItem.tsx
@@ -0,0 +1,34 @@
+import { IconCheckCircle } from '@posthog/icons'
+import { DropdownMenuItem, Spinner } from '@posthog/quill'
+
+import type { MetricsSuggestedDashboardApi } from 'products/metrics/frontend/generated/api.schemas'
+
+export function QuillSuggestionItem({
+ suggestion,
+ openingId,
+ openSuggestion,
+ disabledReason,
+}: {
+ suggestion: MetricsSuggestedDashboardApi
+ openingId: string | null
+ openSuggestion: (suggestion: MetricsSuggestedDashboardApi) => void
+ disabledReason: string | null
+}): JSX.Element {
+ const created = suggestion.dashboard_id !== null
+ return (
+ <DropdownMenuItem
+ onClick={() => openSuggestion(suggestion)}
+ tooltip={created ? 'Created. Open the dashboard.' : undefined}
+ disabledReason={created ? null : disabledReason}
+ data-attr="metrics-suggested-dashboard"
+ description={suggestion.reason || `${suggestion.panel_count} charts`}
+ >
+ <span className="truncate max-w-80">{suggestion.name}</span>
+ {openingId === suggestion.id ? (
+ <Spinner className="ml-auto" />
+ ) : created ? (
+ <IconCheckCircle className="ml-auto text-success" />
+ ) : null}
+ </DropdownMenuItem>
+ )
+}
diff --git a/products/metrics/package.json b/products/metrics/package.json
index e26515a96bfc..ea4e5b1db591 100644
--- a/products/metrics/package.json
+++ b/products/metrics/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/notebooks/frontend/ReusableWidget/ReusableWidgetScene.tsx b/products/notebooks/frontend/ReusableWidget/ReusableWidgetScene.tsx
index cbb769c5390f..92af2757429a 100644
--- a/products/notebooks/frontend/ReusableWidget/ReusableWidgetScene.tsx
+++ b/products/notebooks/frontend/ReusableWidget/ReusableWidgetScene.tsx
@@ -9,8 +9,10 @@ import {
LemonTag,
LemonTextArea,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { SceneExport } from 'scenes/sceneTypes'
import { teamLogic } from 'scenes/teamLogic'
@@ -78,6 +80,7 @@ export function ReusableWidgetScene({ widgetId }: ReusableWidgetLogicProps): JSX
updateReusableWidget,
} = useActions(logic)
const { currentTeamId } = useValues(teamLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (reusableWidgetLoading && !reusableWidget) {
return (
@@ -128,12 +131,21 @@ export function ReusableWidgetScene({ widgetId }: ReusableWidgetLogicProps): JSX
path: `${urls.notebooks()}?tab=widgets`,
}}
actions={
- <div className="flex flex-wrap gap-2">
- <LemonButton onClick={openDemoDataModal} data-attr="reusable-widget-demo-data">
- Demo data
- </LemonButton>
- <LemonButton onClick={openSourceModal}>View source</LemonButton>
- </div>
+ todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ <Button onClick={openDemoDataModal} data-attr="reusable-widget-demo-data">
+ Demo data
+ </Button>
+ <Button onClick={openSourceModal}>View source</Button>
+ </div>
+ ) : (
+ <div className="flex flex-wrap gap-2">
+ <LemonButton onClick={openDemoDataModal} data-attr="reusable-widget-demo-data">
+ Demo data
+ </LemonButton>
+ <LemonButton onClick={openSourceModal}>View source</LemonButton>
+ </div>
+ )
}
/>
<div className="grid grid-cols-1 items-start gap-4 @min-[56rem]/reusable-widget:grid-cols-3">
diff --git a/products/notebooks/package.json b/products/notebooks/package.json
index 55f18f110292..d0844a5120e5 100644
--- a/products/notebooks/package.json
+++ b/products/notebooks/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ evals/test/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
"kea-router": "catalog:",
diff --git a/products/persons/frontend/pages/PersonScene.tsx b/products/persons/frontend/pages/PersonScene.tsx
index fb56942e1249..c6c43068e027 100644
--- a/products/persons/frontend/pages/PersonScene.tsx
+++ b/products/persons/frontend/pages/PersonScene.tsx
@@ -3,6 +3,7 @@ import { memo } from 'react'
import { IconChevronDown, IconCopy, IconInfo, IconRefresh, IconTrash } from '@posthog/icons'
import { LemonButton, LemonButtonProps, LemonDivider, LemonMenu, LemonSelect, LemonTag, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import api from 'lib/api'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
@@ -12,6 +13,7 @@ import { NotFound } from 'lib/components/NotFound'
import { PropertiesTable } from 'lib/components/PropertiesTable'
import { TZLabel } from 'lib/components/TZLabel'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { groupsAccessLogic } from 'lib/introductions/groupsAccessLogic'
import { IconOpenInApp } from 'lib/lemon-ui/icons'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
@@ -232,6 +234,7 @@ export function PersonScene(): JSX.Element | null {
const { featureFlags } = useValues(featureFlagLogic)
const { addProductIntentForCrossSell } = useActions(teamLogic)
const { user } = useValues(userLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const eventsQueryLogicKey = `${PERSON_EVENTS_CONTEXT_KEY}-${mountedPersonsLogic.key}`
if (personError) {
@@ -286,28 +289,56 @@ export function PersonScene(): JSX.Element | null {
type="secondary"
size="small"
/>
- <LemonButton
- onClick={() => showPersonDeleteModal(person, () => loadPersons())}
- disabled={deletedPersonLoading}
- loading={deletedPersonLoading}
- type="secondary"
- status="danger"
- data-attr="delete-person"
- size="small"
- icon={isMobile() ? <IconTrash /> : null}
- >
- {isMobile() ? null : 'Delete person'}
- </LemonButton>
+ {todayRailNav ? (
+ <>
+ <Button
+ onClick={() => showPersonDeleteModal(person, () => loadPersons())}
+ disabled={deletedPersonLoading}
+ loading={deletedPersonLoading}
+ variant="destructive-outline"
+ data-attr="delete-person"
+ size={isMobile() ? 'icon' : undefined}
+ aria-label={isMobile() ? 'Delete person' : undefined}
+ tooltip={isMobile() ? 'Delete person' : undefined}
+ >
+ {isMobile() ? <IconTrash /> : 'Delete person'}
+ </Button>
+ {person.distinct_ids.length > 1 && (
+ <Button
+ onClick={() => setSplitMergeModalShown(true)}
+ data-attr="merge-person-button"
+ variant="outline"
+ >
+ Split IDs
+ </Button>
+ )}
+ </>
+ ) : (
+ <>
+ <LemonButton
+ onClick={() => showPersonDeleteModal(person, () => loadPersons())}
+ disabled={deletedPersonLoading}
+ loading={deletedPersonLoading}
+ type="secondary"
+ status="danger"
+ data-attr="delete-person"
+ size="small"
+ icon={isMobile() ? <IconTrash /> : null}
+ >
+ {isMobile() ? null : 'Delete person'}
+ </LemonButton>
- {person.distinct_ids.length > 1 && (
- <LemonButton
- onClick={() => setSplitMergeModalShown(true)}
- data-attr="merge-person-button"
- type="secondary"
- size="small"
- >
- Split IDs
- </LemonButton>
+ {person.distinct_ids.length > 1 && (
+ <LemonButton
+ onClick={() => setSplitMergeModalShown(true)}
+ data-attr="merge-person-button"
+ type="secondary"
+ size="small"
+ >
+ Split IDs
+ </LemonButton>
+ )}
+ </>
)}
</>
}
@@ -578,6 +609,7 @@ const PersonFeatureFlagsTab = memo(function PersonFeatureFlagsTab({
function OpenInAdminPanelButton({ size = 'small' }: { size?: LemonButtonProps['size'] }): JSX.Element {
const { person } = useValues(personsLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const disabledReason = !person?.properties.email ? 'Person has no email' : undefined
const openInAdminPanel = async (email: string): Promise<void> => {
@@ -596,6 +628,18 @@ function OpenInAdminPanelButton({ size = 'small' }: { size?: LemonButtonProps['s
}
}
+ if (todayRailNav) {
+ return (
+ <Button
+ variant="outline"
+ onClick={() => openInAdminPanel(person?.properties.email)}
+ disabledReason={disabledReason}
+ >
+ Open in admin panel
+ </Button>
+ )
+ }
+
return (
<LemonButton
type="secondary"
diff --git a/products/persons/package.json b/products/persons/package.json
index c1aff58148c8..08b507ea0f4a 100644
--- a/products/persons/package.json
+++ b/products/persons/package.json
@@ -1,6 +1,7 @@
{
"name": "@posthog/products-persons",
"dependencies": {
+ "@posthog/quill": "workspace:*",
"fast-equals": "catalog:",
"kea": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskDetailPage.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskDetailPage.tsx
index 3bd9d13a57ed..1a50dba118b7 100644
--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskDetailPage.tsx
+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskDetailPage.tsx
@@ -34,6 +34,7 @@ export function TaskDetailPage({ taskId, isMobile, titleActions }: TaskDetailPag
const artifactsTabEnabled = useFeatureFlag('TODAY_RAIL_NAV')
const skin = useThreadSkin()
const piAcpEnabled = useFeatureFlag('PI_ACP')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (taskNotFound && !task) {
return <NotFound object="task" />
@@ -61,7 +62,7 @@ export function TaskDetailPage({ taskId, isMobile, titleActions }: TaskDetailPag
isActiveCreation ? undefined : (
<TaskHeaderActionsSkeleton />
)
- ) : skin === 'quill' ? (
+ ) : skin === 'quill' || todayRailNav ? (
<QuillTaskHeaderActions
desktopUrl={hasDesktopAccess ? urls.codeTaskLink(task.id) : null}
prUrl={prUrl}
diff --git a/products/product_analytics/frontend/insights/insightScene/InsightPageHeader.tsx b/products/product_analytics/frontend/insights/insightScene/InsightPageHeader.tsx
index 783739cc2118..e8a173992334 100644
--- a/products/product_analytics/frontend/insights/insightScene/InsightPageHeader.tsx
+++ b/products/product_analytics/frontend/insights/insightScene/InsightPageHeader.tsx
@@ -1,5 +1,4 @@
import { useActions, useValues } from 'kea'
-import { combineUrl, router } from 'kea-router'
import { useMemo } from 'react'
import { IconPlusSmall } from '@posthog/icons'
@@ -13,20 +12,12 @@ import { insightLogic } from 'scenes/insights/insightLogic'
import { insightSceneLogic } from 'scenes/insights/insightSceneLogic'
import { getInsightIconTypeFromQuery, getOverrideWarningPropsForButton } from 'scenes/insights/utils'
import { useMaxTool } from 'scenes/max/useMaxTool'
-import { urls } from 'scenes/urls'
import { breadcrumbsLogic } from '~/layout/navigation/Breadcrumbs/breadcrumbsLogic'
import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'
import { getLastNewFolder } from '~/layout/panel-layout/ProjectTree/projectTreeLogic'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
-import {
- isActorsQuery,
- isBIVisualizationNode,
- isDataVisualizationNode,
- isEventsQuery,
- isGroupsQuery,
- isInsightQueryNode,
-} from '~/queries/utils'
+import { isActorsQuery, isBIVisualizationNode, isEventsQuery, isGroupsQuery, isInsightQueryNode } from '~/queries/utils'
import { AccessControlLevel, AccessControlResourceType, InsightLogicProps, ItemMode } from '~/types'
import { areAlertsSupportedForInsight } from 'products/alerts/frontend/logic/insightAlertsLogic'
@@ -34,6 +25,8 @@ import { insightModalsLogic } from 'products/product_analytics/frontend/insights
import { InsightSaveButton } from 'products/product_analytics/frontend/insights/insightScene/InsightSaveButton'
import { InsightShareMenu } from 'products/product_analytics/frontend/insights/insightScene/InsightShareMenu'
+import { openInsightEditor } from './openInsightEditor'
+import { QuillInsightPageHeaderActions } from './QuillInsightPageHeaderActions'
import { InsightSceneMenuBar } from './sidePanel/InsightSceneMenuBar'
import { InsightSidePanelContent } from './sidePanel/InsightSidePanelContent'
@@ -76,7 +69,6 @@ export function InsightPageHeader({ insightLogicProps }: { insightLogicProps: In
insightDataLogic(insightProps)
)
const { cancelChanges, generateInsightMetadata } = useActions(insightDataLogic(insightProps))
- const { push } = useActions(router)
const { breadcrumbs } = useValues(breadcrumbsLogic)
const lastBreadcrumb = breadcrumbs[breadcrumbs.length - 1]
@@ -86,6 +78,7 @@ export function InsightPageHeader({ insightLogicProps }: { insightLogicProps: In
const metricsAlertsEnabled = useFeatureFlag('METRICS')
const spacesEnabled = useFeatureFlag('TODAY_RAIL_NAV')
const biEnabled = useFeatureFlag('SQL_EDITOR_BI_MODE')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const canCreateAlertForInsight = areAlertsSupportedForInsight(query, { metricsAlertsEnabled })
const insightDisplayName = insight?.name || insight?.derived_name
@@ -156,109 +149,113 @@ export function InsightPageHeader({ insightLogicProps }: { insightLogicProps: In
descriptionMaxLength={400}
maxToolProps={readDataMaxToolProps}
actions={
- <>
- {insightMode === ItemMode.Edit && isSavedInsight && (
- <LemonButton
- type="secondary"
- onClick={() => {
- cancelChanges()
- setInsightMode(ItemMode.View, null)
- }}
- data-attr="insight-cancel-edit-button"
- size="small"
- >
- Cancel
- </LemonButton>
- )}
+ todayRailNav ? (
+ <>
+ {insightMode !== ItemMode.Edit && isPersistedInsight && (
+ <InsightShareMenu insight={insight} />
+ )}
+ <QuillInsightPageHeaderActions
+ insightLogicProps={insightLogicProps}
+ isPersistedInsight={isPersistedInsight}
+ canCreateAlertForInsight={canCreateAlertForInsight}
+ saveInsightToFolder={saveInsightToFolder}
+ />
+ </>
+ ) : (
+ <>
+ {insightMode === ItemMode.Edit && isSavedInsight && (
+ <LemonButton
+ type="secondary"
+ onClick={() => {
+ cancelChanges()
+ setInsightMode(ItemMode.View, null)
+ }}
+ data-attr="insight-cancel-edit-button"
+ size="small"
+ >
+ Cancel
+ </LemonButton>
+ )}
- {insightMode !== ItemMode.Edit && isPersistedInsight && (
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconPlusSmall />}
- data-attr="insight-add-to-dashboard-prominent-button"
- onClick={() => openAddToDashboardModal()}
- >
- Add to dashboard
- </LemonButton>
- )}
+ {insightMode !== ItemMode.Edit && isPersistedInsight && (
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconPlusSmall />}
+ data-attr="insight-add-to-dashboard-prominent-button"
+ onClick={() => openAddToDashboardModal()}
+ >
+ Add to dashboard
+ </LemonButton>
+ )}
- {insightMode !== ItemMode.Edit && isPersistedInsight && spacesEnabled && (
- <InsightShareMenu insight={insight} />
- )}
+ {insightMode !== ItemMode.Edit && isPersistedInsight && spacesEnabled && (
+ <InsightShareMenu insight={insight} />
+ )}
- {insightMode !== ItemMode.Edit && isPersistedInsight && (
- <InsightSubscribeProminentButton
- insightShortId={insight.short_id!}
- canCreateAlert={canCreateAlertForInsight}
- />
- )}
+ {insightMode !== ItemMode.Edit && isPersistedInsight && (
+ <InsightSubscribeProminentButton
+ insightShortId={insight.short_id!}
+ canCreateAlert={canCreateAlertForInsight}
+ />
+ )}
- {insightMode !== ItemMode.Edit ? (
- canEditInsight && (
- <AccessControlAction
- resourceType={AccessControlResourceType.Insight}
- minAccessLevel={AccessControlLevel.Editor}
- userAccessLevel={insight.user_access_level}
- >
- <LemonButton
- type="primary"
- size="small"
- tooltipPlacement="bottom"
- onClick={() => {
- if (isDataVisualizationNode(query) && insight.short_id) {
- const editorUrl = isBIVisualizationNode(query)
- ? urls.businessIntelligence
- : urls.sqlEditor
- router.actions.push(
- editorUrl({
- insightShortId: insight.short_id,
- dashboard: dashboardId ?? undefined,
- // Carry unsaved view-mode filter edits into the editor so they can be saved
- filters: queryChanged ? query.source.filters : undefined,
- })
- )
- } else if (insight.short_id) {
- const editUrl = combineUrl(
- urls.insightEdit(insight.short_id),
- dashboardId ? { dashboard: dashboardId } : {},
- // Carry unsaved view-mode filter edits into the editor so they can be saved
- queryChanged ? { q: JSON.stringify(query) } : {}
- ).url
- push(editUrl)
- } else {
- setInsightMode(ItemMode.Edit, null)
- }
- }}
- {...getOverrideWarningPropsForButton(query, filtersOverride, variablesOverride)}
- {...(isBIVisualizationNode(query) && !biEnabled
- ? {
- disabledReason:
- 'Business intelligence is not enabled for this project',
- }
- : {})}
- data-attr="insight-edit-button"
+ {insightMode !== ItemMode.Edit ? (
+ canEditInsight && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Insight}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={insight.user_access_level}
>
- Edit
- </LemonButton>
- </AccessControlAction>
- )
- ) : (
- <InsightSaveButton
- saveAs={() => saveAs(undefined, undefined, 'Unfiled/Insights')}
- saveInsight={saveInsightToFolder}
- isSaved={isSavedInsight}
- addingToDashboard={!insight.id && !!insight.dashboards?.length}
- insightSaving={insightSaving}
- insightChanged={insightChanged || queryChanged}
- // Only offered for already-saved insights: the add-to-dashboard modal is keyed by the
- // insight id, so saving a brand-new insight navigates to its real id and re-keys the
- // modal logic, dropping the open state. New insights use the view-mode button instead.
- // `saveAndAddToDashboard` owns the save-then-open ordering (see insightModalsLogic).
- onSaveAndAddToDashboard={isPersistedInsight ? () => saveAndAddToDashboard() : undefined}
- />
- )}
- </>
+ <LemonButton
+ type="primary"
+ size="small"
+ tooltipPlacement="bottom"
+ onClick={() =>
+ openInsightEditor({
+ query,
+ insightShortId: insight.short_id,
+ dashboardId,
+ queryChanged,
+ enterEditMode: () => setInsightMode(ItemMode.Edit, null),
+ })
+ }
+ {...getOverrideWarningPropsForButton(
+ query,
+ filtersOverride,
+ variablesOverride
+ )}
+ {...(isBIVisualizationNode(query) && !biEnabled
+ ? {
+ disabledReason:
+ 'Business intelligence is not enabled for this project',
+ }
+ : {})}
+ data-attr="insight-edit-button"
+ >
+ Edit
+ </LemonButton>
+ </AccessControlAction>
+ )
+ ) : (
+ <InsightSaveButton
+ saveAs={() => saveAs(undefined, undefined, 'Unfiled/Insights')}
+ saveInsight={saveInsightToFolder}
+ isSaved={isSavedInsight}
+ addingToDashboard={!insight.id && !!insight.dashboards?.length}
+ insightSaving={insightSaving}
+ insightChanged={insightChanged || queryChanged}
+ // Only offered for already-saved insights: the add-to-dashboard modal is keyed by the
+ // insight id, so saving a brand-new insight navigates to its real id and re-keys the
+ // modal logic, dropping the open state. New insights use the view-mode button instead.
+ // `saveAndAddToDashboard` owns the save-then-open ordering (see insightModalsLogic).
+ onSaveAndAddToDashboard={
+ isPersistedInsight ? () => saveAndAddToDashboard() : undefined
+ }
+ />
+ )}
+ </>
+ )
}
/>
</>
diff --git a/products/product_analytics/frontend/insights/insightScene/InsightSaveButton.tsx b/products/product_analytics/frontend/insights/insightScene/InsightSaveButton.tsx
index 6b1ca4e3ee58..f5d137b3793d 100644
--- a/products/product_analytics/frontend/insights/insightScene/InsightSaveButton.tsx
+++ b/products/product_analytics/frontend/insights/insightScene/InsightSaveButton.tsx
@@ -1,5 +1,8 @@
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
+import { QuillInsightSaveButton } from './QuillInsightSaveButton'
+
export function InsightSaveButton({
saveAs,
saveInsight,
@@ -18,6 +21,20 @@ export function InsightSaveButton({
// When provided, adds a "Save & add to dashboard" dropdown option that saves then opens the add-to-dashboard modal.
onSaveAndAddToDashboard?: () => void
}): JSX.Element {
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return (
+ <QuillInsightSaveButton
+ saveAs={saveAs}
+ saveInsight={saveInsight}
+ isSaved={isSaved}
+ insightSaving={insightSaving}
+ insightChanged={insightChanged}
+ addingToDashboard={addingToDashboard}
+ onSaveAndAddToDashboard={onSaveAndAddToDashboard}
+ />
+ )
+ }
const disabled = isSaved && !insightChanged
const saveAsAvailable = isSaved && !addingToDashboard
diff --git a/products/product_analytics/frontend/insights/insightScene/QuillInsightPageHeaderActions.tsx b/products/product_analytics/frontend/insights/insightScene/QuillInsightPageHeaderActions.tsx
new file mode 100644
index 000000000000..f63fdf38e28d
--- /dev/null
+++ b/products/product_analytics/frontend/insights/insightScene/QuillInsightPageHeaderActions.tsx
@@ -0,0 +1,133 @@
+import { useActions, useValues } from 'kea'
+
+import { IconPlus } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { InsightSubscribeProminentButton } from 'lib/components/Scenes/InsightSubscribeProminentButton'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { insightDataLogic } from 'scenes/insights/insightDataLogic'
+import { insightLogic } from 'scenes/insights/insightLogic'
+import { insightSceneLogic } from 'scenes/insights/insightSceneLogic'
+import { getOverrideWarningPropsForButton } from 'scenes/insights/utils'
+
+import { isBIVisualizationNode } from '~/queries/utils'
+import { AccessControlLevel, AccessControlResourceType, InsightLogicProps, ItemMode } from '~/types'
+
+import { insightModalsLogic } from 'products/product_analytics/frontend/insights/insightScene/insightModalsLogic'
+
+import { openInsightEditor } from './openInsightEditor'
+import { QuillInsightSaveButton } from './QuillInsightSaveButton'
+
+export function QuillInsightPageHeaderActions({
+ insightLogicProps,
+ isPersistedInsight,
+ canCreateAlertForInsight,
+ saveInsightToFolder,
+}: {
+ insightLogicProps: InsightLogicProps
+ isPersistedInsight: boolean
+ canCreateAlertForInsight: boolean
+ saveInsightToFolder: (redirectToViewMode?: boolean) => void
+}): JSX.Element {
+ const { insightMode, filtersOverride, variablesOverride, dashboardId } = useValues(insightSceneLogic)
+ const { setInsightMode } = useActions(insightSceneLogic)
+ const {
+ insightProps,
+ canEditInsight,
+ insight,
+ insightChanged,
+ insightSaving,
+ hasDashboardItemId: isSavedInsight,
+ } = useValues(insightLogic(insightLogicProps))
+ const { saveAs } = useActions(insightLogic(insightLogicProps))
+ const { openAddToDashboardModal, saveAndAddToDashboard } = useActions(insightModalsLogic(insightLogicProps))
+ const { query, queryChanged } = useValues(insightDataLogic(insightProps))
+ const { cancelChanges } = useActions(insightDataLogic(insightProps))
+ const biEnabled = useFeatureFlag('SQL_EDITOR_BI_MODE')
+
+ const overrideWarning = getOverrideWarningPropsForButton(query, filtersOverride, variablesOverride)
+
+ const onEdit = (): void =>
+ openInsightEditor({
+ query,
+ insightShortId: insight.short_id,
+ dashboardId,
+ queryChanged,
+ enterEditMode: () => setInsightMode(ItemMode.Edit, null),
+ })
+
+ return (
+ <>
+ {insightMode === ItemMode.Edit && isSavedInsight && (
+ <Button
+ variant="outline"
+ onClick={() => {
+ cancelChanges()
+ setInsightMode(ItemMode.View, null)
+ }}
+ data-attr="insight-cancel-edit-button"
+ >
+ Cancel
+ </Button>
+ )}
+
+ {insightMode !== ItemMode.Edit && isPersistedInsight && (
+ <Button
+ variant="outline"
+ data-attr="insight-add-to-dashboard-prominent-button"
+ onClick={() => openAddToDashboardModal()}
+ >
+ <IconPlus />
+ Add to dashboard
+ </Button>
+ )}
+
+ {insightMode !== ItemMode.Edit && isPersistedInsight && (
+ <InsightSubscribeProminentButton
+ insightShortId={insight.short_id!}
+ canCreateAlert={canCreateAlertForInsight}
+ />
+ )}
+
+ {insightMode !== ItemMode.Edit ? (
+ canEditInsight && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Insight}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={insight.user_access_level}
+ >
+ <Button
+ variant="primary"
+ onClick={onEdit}
+ tooltip={
+ typeof overrideWarning.tooltip === 'function'
+ ? overrideWarning.tooltip()
+ : overrideWarning.tooltip
+ }
+ disabledReason={
+ isBIVisualizationNode(query) && !biEnabled
+ ? 'Business intelligence is not enabled for this project'
+ : undefined
+ }
+ data-attr="insight-edit-button"
+ >
+ {overrideWarning.icon}
+ Edit
+ </Button>
+ </AccessControlAction>
+ )
+ ) : (
+ <QuillInsightSaveButton
+ saveAs={() => saveAs(undefined, undefined, 'Unfiled/Insights')}
+ saveInsight={saveInsightToFolder}
+ isSaved={isSavedInsight}
+ addingToDashboard={!insight.id && !!insight.dashboards?.length}
+ insightSaving={insightSaving}
+ insightChanged={insightChanged || queryChanged}
+ onSaveAndAddToDashboard={isPersistedInsight ? () => saveAndAddToDashboard() : undefined}
+ />
+ )}
+ </>
+ )
+}
diff --git a/products/product_analytics/frontend/insights/insightScene/QuillInsightSaveButton.tsx b/products/product_analytics/frontend/insights/insightScene/QuillInsightSaveButton.tsx
new file mode 100644
index 000000000000..a2485512f1cc
--- /dev/null
+++ b/products/product_analytics/frontend/insights/insightScene/QuillInsightSaveButton.tsx
@@ -0,0 +1,84 @@
+import { IconChevronDown } from '@posthog/icons'
+import {
+ Button,
+ ButtonGroup,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+export function QuillInsightSaveButton({
+ saveAs,
+ saveInsight,
+ isSaved,
+ insightSaving,
+ insightChanged,
+ addingToDashboard,
+ onSaveAndAddToDashboard,
+}: {
+ saveAs: () => void
+ saveInsight: (redirectToViewMode?: boolean) => void
+ isSaved: boolean | undefined
+ insightSaving: boolean
+ insightChanged: boolean
+ addingToDashboard: boolean
+ onSaveAndAddToDashboard?: () => void
+}): JSX.Element {
+ const disabled = isSaved && !insightChanged
+ const saveAsAvailable = isSaved && !addingToDashboard
+
+ return (
+ <ButtonGroup>
+ <Button
+ variant="primary"
+ onClick={() => saveInsight(true)}
+ data-attr="insight-save-button"
+ disabled={disabled}
+ loading={!disabled && insightSaving}
+ >
+ {disabled ? 'No changes' : addingToDashboard ? 'Save & add to dashboard' : 'Save'}
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="primary"
+ size="icon"
+ aria-label="More save options"
+ data-attr="insight-save-dropdown"
+ disabled={disabled && !saveAsAvailable}
+ />
+ }
+ >
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-56">
+ {!disabled && (
+ <DropdownMenuItem
+ onClick={() => saveInsight(false)}
+ data-attr="insight-save-and-continue"
+ disabled={insightSaving}
+ >
+ {addingToDashboard ? 'Save, add to dashboard' : 'Save'} & continue editing
+ </DropdownMenuItem>
+ )}
+ {!disabled && onSaveAndAddToDashboard && (
+ <DropdownMenuItem
+ onClick={() => onSaveAndAddToDashboard()}
+ data-attr="insight-save-and-add-to-dashboard"
+ disabled={insightSaving}
+ >
+ Save & add to dashboard…
+ </DropdownMenuItem>
+ )}
+ {saveAsAvailable && (
+ <DropdownMenuItem onClick={() => saveAs()} data-attr="insight-save-as-new-insight">
+ Save as…
+ </DropdownMenuItem>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </ButtonGroup>
+ )
+}
diff --git a/products/product_analytics/frontend/insights/insightScene/openInsightEditor.ts b/products/product_analytics/frontend/insights/insightScene/openInsightEditor.ts
new file mode 100644
index 000000000000..f1e65b1db831
--- /dev/null
+++ b/products/product_analytics/frontend/insights/insightScene/openInsightEditor.ts
@@ -0,0 +1,43 @@
+import { combineUrl, router } from 'kea-router'
+
+import { urls } from 'scenes/urls'
+
+import { Node } from '~/queries/schema/schema-general'
+import { isBIVisualizationNode, isDataVisualizationNode } from '~/queries/utils'
+import { DashboardType, InsightShortId } from '~/types'
+
+export function openInsightEditor({
+ query,
+ insightShortId,
+ dashboardId,
+ queryChanged,
+ enterEditMode,
+}: {
+ query: Node | null
+ insightShortId: InsightShortId | undefined
+ dashboardId: DashboardType['id'] | null
+ queryChanged: boolean
+ enterEditMode: () => void
+}): void {
+ if (isDataVisualizationNode(query) && insightShortId) {
+ const editorUrl = isBIVisualizationNode(query) ? urls.businessIntelligence : urls.sqlEditor
+ router.actions.push(
+ editorUrl({
+ insightShortId,
+ dashboard: dashboardId ?? undefined,
+ // Carry unsaved view-mode filter edits into the editor so they can be saved
+ filters: queryChanged ? query.source.filters : undefined,
+ })
+ )
+ } else if (insightShortId) {
+ const editUrl = combineUrl(
+ urls.insightEdit(insightShortId),
+ dashboardId ? { dashboard: dashboardId } : {},
+ // Carry unsaved view-mode filter edits into the editor so they can be saved
+ queryChanged ? { q: JSON.stringify(query) } : {}
+ ).url
+ router.actions.push(editUrl)
+ } else {
+ enterEditMode()
+ }
+}
diff --git a/products/product_analytics/frontend/insights/insightScene/sidePanel/InsightSceneMenuBar.tsx b/products/product_analytics/frontend/insights/insightScene/sidePanel/InsightSceneMenuBar.tsx
index d2c0abb04ded..b6ce65ab4d97 100644
--- a/products/product_analytics/frontend/insights/insightScene/sidePanel/InsightSceneMenuBar.tsx
+++ b/products/product_analytics/frontend/insights/insightScene/sidePanel/InsightSceneMenuBar.tsx
@@ -186,7 +186,8 @@ function InsightSceneMenuBarInner({ insightLogicProps }: { insightLogicProps: In
const showCreateEndpoint =
isSavedInsight && !getAccessControlDisabledReason(AccessControlResourceType.Endpoint, AccessControlLevel.Editor)
const showCreateMetric = isSavedInsight
- const showAddToNotebook = isSavedInsight
+ // Adding to notebooks is deprecated under the rail redesign; gated here so an emptied menu can disable itself.
+ const showAddToNotebook = isSavedInsight && !featureFlags[FEATURE_FLAGS.TODAY_RAIL_NAV]
const showCreateMenu =
showCreateEndpoint ||
showCreateMetric ||
diff --git a/products/product_analytics/frontend/insights/newInsightMenu/NewInsightMenu.tsx b/products/product_analytics/frontend/insights/newInsightMenu/NewInsightMenu.tsx
index 0f5df5423720..0d1e91aad946 100644
--- a/products/product_analytics/frontend/insights/newInsightMenu/NewInsightMenu.tsx
+++ b/products/product_analytics/frontend/insights/newInsightMenu/NewInsightMenu.tsx
@@ -6,6 +6,7 @@ import { AccessControlAction } from 'lib/components/AccessControlAction'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconInsightNumber, IconInsightPie, IconInsightTable, IconInsightWorldMap } from 'lib/lemon-ui/icons'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
@@ -35,6 +36,7 @@ import {
TableSketch,
WorldMapSketch,
} from './InsightTypeSketch'
+import { QuillNewInsightButton } from './QuillNewInsightButton'
interface NewInsightCardSpec {
key: string
@@ -356,6 +358,10 @@ export function NewInsightMenuOverlay(): JSX.Element {
}
export function NewInsightButton({ compact = false }: { compact?: boolean }): JSX.Element {
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillNewInsightButton compact={compact} overlay={<NewInsightMenuOverlay />} />
+ }
const button = (
<LemonButton
type="primary"
diff --git a/products/product_analytics/frontend/insights/newInsightMenu/QuillNewInsightButton.tsx b/products/product_analytics/frontend/insights/newInsightMenu/QuillNewInsightButton.tsx
new file mode 100644
index 000000000000..68ac1a1f2c88
--- /dev/null
+++ b/products/product_analytics/frontend/insights/newInsightMenu/QuillNewInsightButton.tsx
@@ -0,0 +1,52 @@
+import { IconPlus } from '@posthog/icons'
+import { Button, Popover, PopoverContent, PopoverTrigger } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
+import { Scene } from 'scenes/sceneTypes'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+export function QuillNewInsightButton({
+ compact = false,
+ overlay,
+}: {
+ compact?: boolean
+ overlay: JSX.Element
+}): JSX.Element {
+ return (
+ <Popover>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Insight}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Shortcut
+ name="NewInsight"
+ keybind={[keyBinds.new]}
+ intent="New insight"
+ interaction="click"
+ scope={Scene.SavedInsights}
+ priority={100}
+ >
+ <PopoverTrigger
+ render={
+ <Button
+ variant="primary"
+ data-attr="saved-insights-new-insight-button"
+ tooltip="New insight"
+ aria-label="New insight"
+ />
+ }
+ >
+ <IconPlus />
+ {compact ? <span className="hidden @min-[32rem]/saved-insights:inline">New</span> : 'New'}
+ </PopoverTrigger>
+ </Shortcut>
+ </AccessControlAction>
+ <PopoverContent align="end" className="w-auto p-0">
+ {overlay}
+ </PopoverContent>
+ </Popover>
+ )
+}
diff --git a/products/product_analytics/frontend/insights/savedInsights/SavedInsights.tsx b/products/product_analytics/frontend/insights/savedInsights/SavedInsights.tsx
index bc3c25a6ee90..49367c4f0724 100644
--- a/products/product_analytics/frontend/insights/savedInsights/SavedInsights.tsx
+++ b/products/product_analytics/frontend/insights/savedInsights/SavedInsights.tsx
@@ -2,6 +2,16 @@ import { useActions, useValues } from 'kea'
import { router } from 'kea-router'
import { IconEllipsis, IconHeart, IconHeartFilled, IconTrash } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ Tooltip as QuillTooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@posthog/quill'
import 'scenes/saved-insights/SavedInsights.scss'
import { AccessControlAction } from 'lib/components/AccessControlAction'
@@ -12,6 +22,7 @@ import { SceneDashboardChoiceModal } from 'lib/components/SceneDashboardChoice/S
import { sceneDashboardChoiceModalLogic } from 'lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic'
import { TZLabel } from 'lib/components/TZLabel'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
@@ -103,6 +114,7 @@ export function SavedInsights(): JSX.Element {
} = useActions(dashboardChoiceLogic)
const { isLoading: dashboardCreationLoading } = useValues(newDashboardLogic)
const { addDashboard, setAsHomeTabDashboardAfterCreation, showNewDashboardModal } = useActions(newDashboardLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const { tab } = filters
@@ -400,12 +412,57 @@ export function SavedInsights(): JSX.Element {
type: sceneConfigurations[Scene.SavedInsights].iconType || 'default_icon_type',
}}
actions={
- <>
- <NewInsightButton compact={tab === SavedInsightsTabs.Home && showHomeTab} />
- {currentTeam?.home_tab_dashboard && (
- <div className="@min-[48rem]/saved-insights:hidden">{homeDashboardActions}</div>
- )}
- </>
+ todayRailNav ? (
+ <>
+ <NewInsightButton compact={tab === SavedInsightsTabs.Home && showHomeTab} />
+ {currentTeam?.home_tab_dashboard && tab === SavedInsightsTabs.Home && showHomeTab && (
+ <div className="@min-[48rem]/saved-insights:hidden">
+ <DropdownMenu>
+ <QuillTooltip>
+ <TooltipTrigger
+ delay={0}
+ render={
+ <DropdownMenuTrigger
+ render={
+ <Button
+ size="icon"
+ aria-label="Home dashboard options"
+ data-attr="home-tab-dashboard-options"
+ />
+ }
+ />
+ }
+ >
+ <IconEllipsis />
+ </TooltipTrigger>
+ <TooltipContent>Home dashboard options</TooltipContent>
+ </QuillTooltip>
+ <DropdownMenuContent align="end" className="min-w-48">
+ <DropdownMenuItem
+ onClick={openHomeDashboardStarter}
+ data-attr="home-tab-choose-dashboard"
+ >
+ Change Home dashboard
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={restorePostHogHome}
+ data-attr="home-tab-restore-posthog-home"
+ >
+ Use PostHog Home
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ )}
+ </>
+ ) : (
+ <>
+ <NewInsightButton compact={tab === SavedInsightsTabs.Home && showHomeTab} />
+ {currentTeam?.home_tab_dashboard && (
+ <div className="@min-[48rem]/saved-insights:hidden">{homeDashboardActions}</div>
+ )}
+ </>
+ )
}
/>
<LemonTabs
diff --git a/products/pulse/frontend/PulseScene.tsx b/products/pulse/frontend/PulseScene.tsx
index 66aa2686f1fb..d7ba8015ec9c 100644
--- a/products/pulse/frontend/PulseScene.tsx
+++ b/products/pulse/frontend/PulseScene.tsx
@@ -1,6 +1,7 @@
import { useActions, useValues } from 'kea'
-import { IconPencil, IconPlusSmall, IconPulse, IconTrash } from '@posthog/icons'
+import { IconPencil, IconPlus, IconPlusSmall, IconPulse, IconTrash } from '@posthog/icons'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
@@ -36,6 +37,7 @@ export function PulseScene(): JSX.Element {
const isEnabled = useFeatureFlag('PULSE')
const { briefConfigs, selectedConfigId, showAiConsentBanner } = useValues(pulseLogic)
const { selectConfig, openConfigModal } = useActions(pulseLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!isEnabled) {
return <NotFound object="Pulse" caption="This feature is not enabled for your project." />
@@ -48,12 +50,26 @@ export function PulseScene(): JSX.Element {
description={PULSE_DESCRIPTION}
resourceType={{ type: 'default_icon_type', forceIcon: <IconPulse /> }}
actions={
- <>
- <LemonButton type="secondary" icon={<IconPlusSmall />} onClick={() => openConfigModal(null)}>
- New config
- </LemonButton>
- <RunBriefButton />
- </>
+ todayRailNav ? (
+ <>
+ <Button variant="outline" onClick={() => openConfigModal(null)}>
+ <IconPlus />
+ New config
+ </Button>
+ <RunBriefButton />
+ </>
+ ) : (
+ <>
+ <LemonButton
+ type="secondary"
+ icon={<IconPlusSmall />}
+ onClick={() => openConfigModal(null)}
+ >
+ New config
+ </LemonButton>
+ <RunBriefButton />
+ </>
+ )
}
/>
diff --git a/products/pulse/frontend/QuillRunBriefButton.tsx b/products/pulse/frontend/QuillRunBriefButton.tsx
new file mode 100644
index 000000000000..1d7096147cc5
--- /dev/null
+++ b/products/pulse/frontend/QuillRunBriefButton.tsx
@@ -0,0 +1,28 @@
+import { useActions, useValues } from 'kea'
+
+import { Button } from '@posthog/quill'
+
+import { BRIEF_ALREADY_GENERATING_MESSAGE, pulseLogic } from './pulseLogic'
+
+export function QuillRunBriefButton(): JSX.Element {
+ const { isGeneratingForSelectedConfig, generatedBriefLoading, selectedConfigId, dataProcessingAccepted } =
+ useValues(pulseLogic)
+ const { generateBrief } = useActions(pulseLogic)
+
+ const disabledReason = !dataProcessingAccepted
+ ? 'Approve AI data processing first'
+ : isGeneratingForSelectedConfig && !generatedBriefLoading
+ ? BRIEF_ALREADY_GENERATING_MESSAGE
+ : undefined
+
+ return (
+ <Button
+ variant="primary"
+ loading={generatedBriefLoading}
+ disabledReason={disabledReason}
+ onClick={() => generateBrief({ configId: selectedConfigId })}
+ >
+ Run brief now
+ </Button>
+ )
+}
diff --git a/products/pulse/frontend/RunBriefButton.tsx b/products/pulse/frontend/RunBriefButton.tsx
index 8b874e4d3672..2df62f2df424 100644
--- a/products/pulse/frontend/RunBriefButton.tsx
+++ b/products/pulse/frontend/RunBriefButton.tsx
@@ -1,13 +1,20 @@
import { useActions, useValues } from 'kea'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { BRIEF_ALREADY_GENERATING_MESSAGE, pulseLogic } from './pulseLogic'
+import { QuillRunBriefButton } from './QuillRunBriefButton'
export function RunBriefButton(): JSX.Element {
const { isGeneratingForSelectedConfig, generatedBriefLoading, selectedConfigId, dataProcessingAccepted } =
useValues(pulseLogic)
const { generateBrief } = useActions(pulseLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ if (todayRailNav) {
+ return <QuillRunBriefButton />
+ }
const disabledReason = !dataProcessingAccepted
? 'Approve AI data processing first'
diff --git a/products/pulse/package.json b/products/pulse/package.json
index 6f9795b5b3ee..46b7b414b783 100644
--- a/products/pulse/package.json
+++ b/products/pulse/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/replay/package.json b/products/replay/package.json
index 429b6e4ab49b..6da1600bd9df 100644
--- a/products/replay/package.json
+++ b/products/replay/package.json
@@ -4,6 +4,7 @@
"backend:test": "echo 'No backend tests'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
"kea-router": "catalog:"
diff --git a/products/replay_vision/frontend/components/QuillReplayVisionFeedbackButton.tsx b/products/replay_vision/frontend/components/QuillReplayVisionFeedbackButton.tsx
new file mode 100644
index 000000000000..123ae8bc06e2
--- /dev/null
+++ b/products/replay_vision/frontend/components/QuillReplayVisionFeedbackButton.tsx
@@ -0,0 +1,24 @@
+import { LemonButtonProps } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+
+import { quillButtonVariant } from 'lib/lemon-ui/LemonButton/quillButtonVariant'
+import posthog from 'lib/posthog-typed'
+
+export function QuillReplayVisionFeedbackButton({
+ label = 'Feedback',
+ type,
+}: {
+ label?: string
+ type?: LemonButtonProps['type']
+} = {}): JSX.Element {
+ return (
+ <Button
+ data-attr="vision-feedback"
+ variant={quillButtonVariant(type)}
+ tooltip="Share feedback on Replay vision"
+ onClick={() => posthog.capture('replay_vision_feedback_clicked')}
+ >
+ {label}
+ </Button>
+ )
+}
diff --git a/products/replay_vision/frontend/components/ReplayVisionFeedbackButton.tsx b/products/replay_vision/frontend/components/ReplayVisionFeedbackButton.tsx
index 7255e7274e51..162838c9971c 100644
--- a/products/replay_vision/frontend/components/ReplayVisionFeedbackButton.tsx
+++ b/products/replay_vision/frontend/components/ReplayVisionFeedbackButton.tsx
@@ -1,7 +1,10 @@
import { LemonButton, LemonButtonProps } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import posthog from 'lib/posthog-typed'
+import { QuillReplayVisionFeedbackButton } from './QuillReplayVisionFeedbackButton'
+
/**
* Feedback button for the Replay vision product. Clicking it captures the `replay_vision_feedback_clicked`
* event, which triggers the Replay vision feedback survey (a popover) configured in PostHog.
@@ -13,6 +16,10 @@ export function ReplayVisionFeedbackButton({
label?: string
type?: LemonButtonProps['type']
} = {}): JSX.Element {
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillReplayVisionFeedbackButton label={label} type={type} />
+ }
return (
<LemonButton
data-attr="vision-feedback"
diff --git a/products/replay_vision/frontend/observations/ObservationShareButton.tsx b/products/replay_vision/frontend/observations/ObservationShareButton.tsx
index fa99d300da94..ee1305ac0bfe 100644
--- a/products/replay_vision/frontend/observations/ObservationShareButton.tsx
+++ b/products/replay_vision/frontend/observations/ObservationShareButton.tsx
@@ -64,19 +64,36 @@ function ObservationShareDialogContent(props: ObservationShareLogicProps): JSX.E
)
}
+export interface ObservationShareButtonProps {
+ observationId: string
+ sessionRecordingId: string
+ playerKey: string
+}
+
+export function openObservationShareDialog({
+ observationId,
+ sessionRecordingId,
+ playerKey,
+}: ObservationShareButtonProps): void {
+ LemonDialog.open({
+ title: 'Share observation',
+ // Read at click time: the player keeps moving, and reading it earlier would re-render the page.
+ content: () => (
+ <ObservationShareDialogContent
+ observationId={observationId}
+ seconds={getCurrentPlayerTime({ playerKey, sessionRecordingId })}
+ />
+ ),
+ maxWidth: '30rem',
+ primaryButton: null,
+ })
+}
+
/**
* Shares the observation page itself, not only the recording — the reader lands on the model's verdict with
* the recording already open at the moment being discussed.
*/
-export function ObservationShareButton({
- observationId,
- sessionRecordingId,
- playerKey,
-}: {
- observationId: string
- sessionRecordingId: string
- playerKey: string
-}): JSX.Element {
+export function ObservationShareButton(props: ObservationShareButtonProps): JSX.Element {
return (
<LemonButton
icon={<IconShare />}
@@ -84,20 +101,7 @@ export function ObservationShareButton({
size="small"
tooltip="Copy a link to this observation, starting the recording where you are"
data-attr="vision-observation-share"
- onClick={() =>
- LemonDialog.open({
- title: 'Share observation',
- // Read at click time: the player keeps moving, and reading it earlier would re-render the page.
- content: () => (
- <ObservationShareDialogContent
- observationId={observationId}
- seconds={getCurrentPlayerTime({ playerKey, sessionRecordingId })}
- />
- ),
- maxWidth: '30rem',
- primaryButton: null,
- })
- }
+ onClick={() => openObservationShareDialog(props)}
>
Share
</LemonButton>
diff --git a/products/replay_vision/frontend/observations/QuillObservationShareButton.tsx b/products/replay_vision/frontend/observations/QuillObservationShareButton.tsx
new file mode 100644
index 000000000000..80afeee9bb28
--- /dev/null
+++ b/products/replay_vision/frontend/observations/QuillObservationShareButton.tsx
@@ -0,0 +1,18 @@
+import { IconShare } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { ObservationShareButtonProps, openObservationShareDialog } from './ObservationShareButton'
+
+export function QuillObservationShareButton(props: ObservationShareButtonProps): JSX.Element {
+ return (
+ <Button
+ variant="outline"
+ tooltip="Copy a link to this observation, starting the recording where you are"
+ data-attr="vision-observation-share"
+ onClick={() => openObservationShareDialog(props)}
+ >
+ <IconShare />
+ Share
+ </Button>
+ )
+}
diff --git a/products/replay_vision/frontend/observations/QuillReplayObservationActions.tsx b/products/replay_vision/frontend/observations/QuillReplayObservationActions.tsx
new file mode 100644
index 000000000000..6f80aff7fb1b
--- /dev/null
+++ b/products/replay_vision/frontend/observations/QuillReplayObservationActions.tsx
@@ -0,0 +1,85 @@
+import { IconArrowLeft, IconArrowRight } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+
+import { ReplayVisionFeedbackButton } from '../components/ReplayVisionFeedbackButton'
+import { QuillObservationShareButton } from './QuillObservationShareButton'
+
+export function QuillReplayObservationActions({
+ previousUrl,
+ nextUrl,
+ neighborsPending,
+ neighborsFiltered,
+ observationId,
+ sessionRecordingId,
+ playerKey,
+}: {
+ previousUrl: string | undefined
+ nextUrl: string | undefined
+ neighborsPending: boolean
+ neighborsFiltered: boolean
+ observationId: string
+ sessionRecordingId: string
+ playerKey: string
+}): JSX.Element {
+ return (
+ <>
+ <Button
+ variant="outline"
+ loading={neighborsPending}
+ render={previousUrl ? <LinkPrimitive to={previousUrl} /> : undefined}
+ disabledReason={
+ previousUrl || neighborsPending
+ ? undefined
+ : neighborsFiltered
+ ? 'No previous observation matching your filters'
+ : 'No newer observation'
+ }
+ tooltip={
+ <>
+ {neighborsFiltered
+ ? 'Previous observation matching your filters'
+ : 'Previous (newer) observation for this scanner'}{' '}
+ <KeyboardShortcut k />
+ </>
+ }
+ data-attr="vision-observation-prev"
+ >
+ <IconArrowLeft />
+ Previous
+ </Button>
+ <Button
+ variant="outline"
+ loading={neighborsPending}
+ render={nextUrl ? <LinkPrimitive to={nextUrl} /> : undefined}
+ disabledReason={
+ nextUrl || neighborsPending
+ ? undefined
+ : neighborsFiltered
+ ? 'No next observation matching your filters'
+ : 'No older observation'
+ }
+ tooltip={
+ <>
+ {neighborsFiltered
+ ? 'Next observation matching your filters'
+ : 'Next (older) observation for this scanner'}{' '}
+ <KeyboardShortcut j />
+ </>
+ }
+ data-attr="vision-observation-next"
+ >
+ Next
+ <IconArrowRight />
+ </Button>
+ <QuillObservationShareButton
+ observationId={observationId}
+ sessionRecordingId={sessionRecordingId}
+ playerKey={playerKey}
+ />
+ <ReplayVisionFeedbackButton />
+ </>
+ )
+}
diff --git a/products/replay_vision/frontend/observations/ReplayObservation.tsx b/products/replay_vision/frontend/observations/ReplayObservation.tsx
index f48d137cff25..03e0dde497b1 100644
--- a/products/replay_vision/frontend/observations/ReplayObservation.tsx
+++ b/products/replay_vision/frontend/observations/ReplayObservation.tsx
@@ -6,6 +6,7 @@ import { IconArrowLeft, IconArrowRight } from '@posthog/icons'
import { LemonButton, LemonCard, LemonTabs, Link, Spinner } from '@posthog/lemon-ui'
import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { lazyWithRetry } from 'lib/utils/retryImport'
@@ -35,6 +36,7 @@ import { ObservationReasoning } from './ObservationReasoning'
import { ObservationRecordingUnavailable } from './ObservationRecordingUnavailable'
import { ObservationShareButton } from './ObservationShareButton'
import { ObservationUnsuccessfulScan } from './ObservationUnsuccessfulScan'
+import { QuillReplayObservationActions } from './QuillReplayObservationActions'
import {
neighborFilterParams,
observationDetailUrl,
@@ -78,6 +80,7 @@ export function ReplayObservationSceneComponent(): JSX.Element {
const { observation, observationLoading, retrying, previousObservationId, nextObservationId, neighborsPending } =
useValues(observationLogic)
const { retryObservation } = useActions(observationLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const hasTimeline = useMemo(
() => (observation ? recordingTimeline([observation]).chapters.length > 0 : false),
[observation]
@@ -155,64 +158,76 @@ export function ReplayObservationSceneComponent(): JSX.Element {
description={observation.recording_subject_email ?? undefined}
resourceType={{ type: 'replay_vision' }}
actions={
- <>
- <LemonButton
- icon={<IconArrowLeft />}
- type="secondary"
- size="small"
- loading={neighborsPending}
- to={previousObservationId ? observationUrl(previousObservationId) : undefined}
- disabledReason={
- previousObservationId || neighborsPending
- ? undefined
- : neighborsFiltered
- ? 'No previous observation matching your filters'
- : 'No newer observation'
- }
- tooltip={
- <>
- {neighborsFiltered
- ? 'Previous observation matching your filters'
- : 'Previous (newer) observation for this scanner'}{' '}
- <KeyboardShortcut k />
- </>
- }
- data-attr="vision-observation-prev"
- >
- Previous
- </LemonButton>
- <LemonButton
- sideIcon={<IconArrowRight />}
- type="secondary"
- size="small"
- loading={neighborsPending}
- to={nextObservationId ? observationUrl(nextObservationId) : undefined}
- disabledReason={
- nextObservationId || neighborsPending
- ? undefined
- : neighborsFiltered
- ? 'No next observation matching your filters'
- : 'No older observation'
- }
- tooltip={
- <>
- {neighborsFiltered
- ? 'Next observation matching your filters'
- : 'Next (older) observation for this scanner'}{' '}
- <KeyboardShortcut j />
- </>
- }
- data-attr="vision-observation-next"
- >
- Next
- </LemonButton>
- <ObservationShareButton
+ todayRailNav ? (
+ <QuillReplayObservationActions
+ previousUrl={previousObservationId ? observationUrl(previousObservationId) : undefined}
+ nextUrl={nextObservationId ? observationUrl(nextObservationId) : undefined}
+ neighborsPending={neighborsPending}
+ neighborsFiltered={neighborsFiltered}
observationId={observation.id}
sessionRecordingId={observation.session_id}
playerKey={playerKey}
/>
- <ReplayVisionFeedbackButton />
- </>
+ ) : (
+ <>
+ <LemonButton
+ icon={<IconArrowLeft />}
+ type="secondary"
+ size="small"
+ loading={neighborsPending}
+ to={previousObservationId ? observationUrl(previousObservationId) : undefined}
+ disabledReason={
+ previousObservationId || neighborsPending
+ ? undefined
+ : neighborsFiltered
+ ? 'No previous observation matching your filters'
+ : 'No newer observation'
+ }
+ tooltip={
+ <>
+ {neighborsFiltered
+ ? 'Previous observation matching your filters'
+ : 'Previous (newer) observation for this scanner'}{' '}
+ <KeyboardShortcut k />
+ </>
+ }
+ data-attr="vision-observation-prev"
+ >
+ Previous
+ </LemonButton>
+ <LemonButton
+ sideIcon={<IconArrowRight />}
+ type="secondary"
+ size="small"
+ loading={neighborsPending}
+ to={nextObservationId ? observationUrl(nextObservationId) : undefined}
+ disabledReason={
+ nextObservationId || neighborsPending
+ ? undefined
+ : neighborsFiltered
+ ? 'No next observation matching your filters'
+ : 'No older observation'
+ }
+ tooltip={
+ <>
+ {neighborsFiltered
+ ? 'Next observation matching your filters'
+ : 'Next (older) observation for this scanner'}{' '}
+ <KeyboardShortcut j />
+ </>
+ }
+ data-attr="vision-observation-next"
+ >
+ Next
+ </LemonButton>
+ <ObservationShareButton
+ observationId={observation.id}
+ sessionRecordingId={observation.session_id}
+ playerKey={playerKey}
+ />
+ <ReplayVisionFeedbackButton />
+ </>
+ )
}
/>
diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScanner.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScanner.tsx
index 6877344d3e35..44200cefdce0 100644
--- a/products/replay_vision/frontend/replay_scanners/ReplayScanner.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ReplayScanner.tsx
@@ -2,9 +2,11 @@ import { useActions, useValues } from 'kea'
import { Suspense, useEffect } from 'react'
import { LemonBanner, LemonButton, LemonTag, Spinner } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { lazyWithRetry } from 'lib/utils/retryImport'
import { SceneExport } from 'scenes/sceneTypes'
@@ -54,6 +56,7 @@ export function ReplayScannerSceneComponent(): JSX.Element {
const { scanner, scannerLoading } = useValues(scannerLogic)
const experimentScanners = useFeatureFlag('VISION_EXPERIMENT_SCANNER')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const isExperimentScanner = experimentScanners && scanner?.scanner_type === 'experiment'
const loadedScannerId = scanner?.id ?? null
@@ -72,6 +75,9 @@ export function ReplayScannerSceneComponent(): JSX.Element {
)
}
+ const editDisabledReason = getReplayVisionEditDisabledReason(scanner.user_access_level)
+ const editUrl = scannerEditUrl(scannerId, activeTab === defaultTab ? null : activeTab)
+
return (
<SceneContent>
<SceneTitleSection
@@ -79,19 +85,34 @@ export function ReplayScannerSceneComponent(): JSX.Element {
description={scanner.description}
resourceType={{ type: 'replay_vision' }}
actions={
- <>
- <LemonButton
- type="primary"
- size="small"
- to={scannerEditUrl(scannerId, activeTab === defaultTab ? null : activeTab)}
- disabledReason={getReplayVisionEditDisabledReason(scanner.user_access_level)}
- data-attr="vision-scanner-edit"
- data-ph-capture-attribute-scanner-type={scanner.scanner_type}
- >
- Edit scanner
- </LemonButton>
- <ReplayVisionFeedbackButton />
- </>
+ todayRailNav ? (
+ <>
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={editDisabledReason ? undefined : editUrl} />}
+ disabledReason={editDisabledReason}
+ data-attr="vision-scanner-edit"
+ data-ph-capture-attribute-scanner-type={scanner.scanner_type}
+ >
+ Edit scanner
+ </Button>
+ <ReplayVisionFeedbackButton />
+ </>
+ ) : (
+ <>
+ <LemonButton
+ type="primary"
+ size="small"
+ to={editUrl}
+ disabledReason={editDisabledReason}
+ data-attr="vision-scanner-edit"
+ data-ph-capture-attribute-scanner-type={scanner.scanner_type}
+ >
+ Edit scanner
+ </LemonButton>
+ <ReplayVisionFeedbackButton />
+ </>
+ )
}
/>
diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx
index 56ddd0d5cf6b..f4a57fd97c97 100644
--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx
@@ -16,6 +16,7 @@ import {
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'
@@ -40,6 +41,7 @@ import { getReplayVisionDeleteDisabledReason, getReplayVisionEditDisabledReason
import { creditsToUsd, formatCreditCount } from '../utils/credits'
import { quotaBannerState } from '../utils/quotaProjection'
import { CreateScannerButton } from './components/CreateScannerButton'
+import { QuillCreateScannerButton } from './components/QuillCreateScannerButton'
import { ScannerStatusLabel } from './components/ScannerStatusLabel'
import { VisionMetrics } from './components/VisionMetrics'
import { VisionUsageTab } from './components/VisionUsageTab'
@@ -146,6 +148,7 @@ export function ReplayScannersScene(): JSX.Element {
const { showUsd, quota } = useValues(visionQuotaLogic)
const quotaExhausted = quotaBannerState(quota).kind === 'exhausted'
const { featureFlags } = useValues(featureFlagLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const activeTab = KNOWN_TABS.includes(searchParams.tab) ? searchParams.tab : DEFAULT_TAB
const columns: LemonTableColumns<ReplayScanner> = [
@@ -256,7 +259,11 @@ export function ReplayScannersScene(): JSX.Element {
actions={
<>
<ReplayVisionFeedbackButton />
- <CreateScannerButton acceptedLabel="New scanner" dataAttr="vision-scanner-create" />
+ {todayRailNav ? (
+ <QuillCreateScannerButton acceptedLabel="New scanner" dataAttr="vision-scanner-create" />
+ ) : (
+ <CreateScannerButton acceptedLabel="New scanner" dataAttr="vision-scanner-create" />
+ )}
</>
}
/>
diff --git a/products/replay_vision/frontend/replay_scanners/components/QuillCreateScannerButton.tsx b/products/replay_vision/frontend/replay_scanners/components/QuillCreateScannerButton.tsx
new file mode 100644
index 000000000000..6bbcee0c4e73
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/components/QuillCreateScannerButton.tsx
@@ -0,0 +1,66 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+import { useState } from 'react'
+
+import { IconPlus } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'
+import { AIConsentPopoverWrapper } from 'scenes/settings/organization/AIConsentPopoverWrapper'
+import { urls } from 'scenes/urls'
+
+import { getReplayVisionEditDisabledReason } from '../../utils/accessControl'
+
+export function QuillCreateScannerButton({
+ acceptedLabel,
+ dataAttr,
+}: {
+ acceptedLabel: string
+ dataAttr: string
+}): JSX.Element {
+ const { dataProcessingAccepted, dataProcessingApprovalDisabledReason } = useValues(aiConsentLogic)
+ const { push } = useActions(router)
+ const [consentRequested, setConsentRequested] = useState(false)
+ const goToCreate = (): void => push(urls.replayVisionNewScanner())
+
+ const canApproveConsent = !dataProcessingApprovalDisabledReason
+ const label = dataProcessingAccepted
+ ? acceptedLabel
+ : canApproveConsent
+ ? 'Allow AI analysis and create scanner'
+ : 'Ask an admin to enable AI analysis'
+
+ const button = (
+ <Button
+ variant="primary"
+ disabledReason={getReplayVisionEditDisabledReason()}
+ data-attr={dataAttr}
+ onClick={() => (dataProcessingAccepted ? goToCreate() : setConsentRequested(true))}
+ >
+ {(dataProcessingAccepted || canApproveConsent) && <IconPlus />}
+ {label}
+ </Button>
+ )
+
+ if (dataProcessingAccepted) {
+ return button
+ }
+
+ return (
+ <AIConsentPopoverWrapper
+ placement="bottom-end"
+ showArrow
+ ignoreDismissal
+ hideTrainingDisclaimer
+ pendingRedirectUrl={urls.replayVisionNewScanner()}
+ hidden={!consentRequested}
+ onApprove={() => {
+ setConsentRequested(false)
+ goToCreate()
+ }}
+ onDismiss={() => setConsentRequested(false)}
+ >
+ {button}
+ </AIConsentPopoverWrapper>
+ )
+}
diff --git a/products/replay_vision/package.json b/products/replay_vision/package.json
index 599738f9e1f3..f4c1ccfe19d2 100644
--- a/products/replay_vision/package.json
+++ b/products/replay_vision/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/tests evals/test/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
diff --git a/products/signals/frontend/inbox/components/config/scouts/QuillScoutNewMenu.tsx b/products/signals/frontend/inbox/components/config/scouts/QuillScoutNewMenu.tsx
new file mode 100644
index 000000000000..f92d537f4c09
--- /dev/null
+++ b/products/signals/frontend/inbox/components/config/scouts/QuillScoutNewMenu.tsx
@@ -0,0 +1,47 @@
+import { IconChat, IconDocument, IconPlus } from '@posthog/icons'
+import { Badge, Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+export interface QuillScoutNewMenuProps {
+ creationDisabledReason: string | null
+ chatDisabledReason: string | null | undefined
+ onChat: () => void
+ onForm: () => void
+}
+
+export function QuillScoutNewMenu({
+ creationDisabledReason,
+ chatDisabledReason,
+ onChat,
+ onForm,
+}: QuillScoutNewMenuProps): JSX.Element {
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={<Button variant="primary" disabledReason={creationDisabledReason} data-attr="scout-new" />}
+ >
+ <IconPlus />
+ New scout
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="max-w-80">
+ <DropdownMenuItem
+ disabledReason={chatDisabledReason}
+ onClick={onChat}
+ data-attr="scout-new-chat"
+ description="Say what you want watched. The agent checks your data and builds the scout with you."
+ >
+ <IconChat />
+ Chat with an agent
+ <Badge variant="success">Recommended</Badge>
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={onForm}
+ data-attr="scout-new-form"
+ description="You already know the instructions, schedule and where reports go."
+ >
+ <IconDocument />
+ Fill in the form
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutNewButton.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutNewButton.tsx
index 15f8c12ac08f..b3544b0b194a 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutNewButton.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutNewButton.tsx
@@ -4,6 +4,8 @@ import { useState } from 'react'
import { IconChat, IconDocument, IconPlus } from '@posthog/icons'
import { LemonButton, type LemonButtonProps, LemonMenu, LemonTag } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+
import type { SignalScoutCreateResponseApi } from 'products/signals/frontend/generated/api.schemas'
import {
@@ -13,6 +15,7 @@ import {
} from '../../../inboxAnalytics'
import type { ScoutCreateInitialValues } from '../../../logics/scoutCreateModalLogic'
import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
+import { QuillScoutNewMenu } from './QuillScoutNewMenu'
import { SCOUT_CHAT_PROMPT_MAX_LENGTH, ScoutChatModal } from './ScoutChatModal'
import { ScoutCreateModalHost, useScoutCreateDisabledReason } from './ScoutCreateModalHost'
@@ -46,6 +49,7 @@ export function ScoutNewButton({
const [openModal, setOpenModal] = useState<OpenScoutModal | null>(null)
const { runningChatType, aiConsentDisabledReason } = useValues(scoutFleetLogic)
const creationDisabledReason = useScoutCreateDisabledReason()
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const chatDisabledReason =
aiConsentDisabledReason ?? (runningChatType !== null ? 'Starting another task…' : undefined)
@@ -60,7 +64,14 @@ export function ScoutNewButton({
return (
<>
- {layout === 'menu' ? (
+ {layout === 'menu' && todayRailNav ? (
+ <QuillScoutNewMenu
+ creationDisabledReason={creationDisabledReason}
+ chatDisabledReason={chatDisabledReason}
+ onChat={openChat}
+ onForm={openForm}
+ />
+ ) : layout === 'menu' ? (
<LemonMenu
items={[
{
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterActions.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterActions.tsx
index cc9b5af0253e..97675957a217 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterActions.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterActions.tsx
@@ -2,7 +2,10 @@ import { useActions, useValues } from 'kea'
import { IconSparkles } from '@posthog/icons'
import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
@@ -20,9 +23,19 @@ export function ScoutsRosterActions(): JSX.Element {
const { user } = useValues(userLogic)
// Every trial endpoint requires skill editor access, so the page is empty without it.
const trialsDisabledReason = useScoutCreateDisabledReason()
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<>
- {currentTeamId === 2 && user?.is_staff && (
+ {currentTeamId === 2 && user?.is_staff && todayRailNav ? (
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={urls.inboxScoutTrials()} />}
+ disabledReason={trialsDisabledReason}
+ data-attr="scout-open-comparisons"
+ >
+ Trials
+ </Button>
+ ) : currentTeamId === 2 && user?.is_staff ? (
<LemonButton
type="secondary"
size="small"
@@ -32,7 +45,7 @@ export function ScoutsRosterActions(): JSX.Element {
>
Trials
</LemonButton>
- )}
+ ) : null}
<AskAboutScoutsMenu />
<ShowSuggestionsButton />
<ScoutNewButton surface="fleet_list" size="small" onCreated={() => loadScoutConfigs()} />
@@ -51,11 +64,26 @@ function ShowSuggestionsButton(): JSX.Element | null {
const { askForSuggestions } = useActions(scoutSuggestionsLogic)
// Opening the chat ends in a skill write, so it carries the editor gate. Reopening needs neither.
const creationDisabledReason = useScoutCreateDisabledReason()
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
if (!suggestButtonVisible) {
return null
}
const busyReason = showSuggestionsBusyReason({ hasPicks, isRefreshing, suggestionSetLoading, runningChatType })
const gateReason = hasPicks ? null : (creationDisabledReason ?? aiConsentDisabledReason)
+ if (todayRailNav) {
+ return (
+ <Button
+ variant="outline"
+ loading={!!busyReason}
+ disabledReason={busyReason ?? gateReason}
+ onClick={() => askForSuggestions()}
+ data-attr="scout-suggestions-show"
+ >
+ <IconSparkles />
+ Suggest a scout
+ </Button>
+ )
+ }
return (
<LemonButton
type="secondary"
@@ -119,6 +147,37 @@ function AskAboutScoutsMenu(): JSX.Element {
// doesn't make every scout CTA in the header look like it's loading.
const isStarting = prompts.some(({ chatType }) => chatType === runningChatType)
const anotherTaskIsStarting = runningChatType !== null && !isStarting
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ if (todayRailNav) {
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="outline"
+ loading={isStarting}
+ disabledReason={anotherTaskIsStarting ? 'Starting another task…' : undefined}
+ />
+ }
+ >
+ <IconSparkles />
+ Ask
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {prompts.map(({ label, chatType }) => (
+ <DropdownMenuItem
+ key={chatType}
+ disabled={anotherTaskIsStarting || isStarting || !!aiConsentDisabledReason}
+ onClick={() => startScoutChatTask(chatType, label)}
+ >
+ {label}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+ }
return (
<LemonMenu
diff --git a/products/skills/frontend/LLMSkillScene.tsx b/products/skills/frontend/LLMSkillScene.tsx
index e35f2707f3af..6fb95dd4c251 100644
--- a/products/skills/frontend/LLMSkillScene.tsx
+++ b/products/skills/frontend/LLMSkillScene.tsx
@@ -22,6 +22,7 @@ import { NotFound } from 'lib/components/NotFound'
import { openPublishToCommunityDialog } from 'lib/components/openPublishToCommunityDialog'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconLink } from 'lib/lemon-ui/icons'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonField } from 'lib/lemon-ui/LemonField'
@@ -49,6 +50,7 @@ import type { LLMSkillFileManifestApi, LLMSkillVersionSummaryApi } from 'product
import type { SkillFormFileValues } from './llmSkillLogic'
import { SkillLogicProps, SkillMode, isSkill, llmSkillLogic } from './llmSkillLogic'
import { llmSkillsLogic } from './llmSkillsLogic'
+import { QuillLLMSkillActions } from './QuillLLMSkillActions'
import {
PRODUCT_OWNED_SKILL_NAME_PREFIXES,
SKILL_NAME_MAX_LENGTH,
@@ -121,6 +123,7 @@ export function LLMSkillScene(): JSX.Element {
const { publishToCommunity } = useActions(llmSkillsLogic)
const { featureFlags } = useValues(featureFlagLogic)
const { user } = useValues(userLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const {
submitSkillForm,
@@ -204,111 +207,122 @@ export function LLMSkillScene(): JSX.Element {
resourceType={{ type: 'llm_skill' }}
isLoading={skillLoading}
actions={
- <>
- {isSkill(skill) && (
- <LemonButton
- type="secondary"
- icon={<IconDownload />}
- onClick={downloadSkill}
- loading={downloadingZip}
- size="small"
- tooltip="Download this skill as a spec-compliant .zip (SKILL.md + bundled files)"
- data-attr="llma-skill-download-zip-button"
- >
- Download .zip
- </LemonButton>
- )}
+ todayRailNav ? (
+ <QuillLLMSkillActions
+ view
+ communitySkillsEnabled={communitySkillsEnabled}
+ publishDisabledReason={publishDisabledReason}
+ renameDisabledReason={renameDisabledReason}
+ />
+ ) : (
+ <>
+ {isSkill(skill) && (
+ <LemonButton
+ type="secondary"
+ icon={<IconDownload />}
+ onClick={downloadSkill}
+ loading={downloadingZip}
+ size="small"
+ tooltip="Download this skill as a spec-compliant .zip (SKILL.md + bundled files)"
+ data-attr="llma-skill-download-zip-button"
+ >
+ Download .zip
+ </LemonButton>
+ )}
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmSkill}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonButton
- type="primary"
- icon={<IconPencil />}
- onClick={() => {
- if (isSkill(skill)) {
- setSkillFormValues({
- name: skill.name,
- description: skill.description,
- body: skill.body,
- license: skill.license || '',
- compatibility: skill.compatibility || '',
- })
- setMode(SkillMode.Edit)
- }
- }}
- size="small"
- tooltip={
- isHistoricalVersion
- ? 'Start a new version from this historical version'
- : undefined
- }
- data-attr="llma-skill-new-version-button"
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
>
- New version
- </LemonButton>
- </AccessControlAction>
+ <LemonButton
+ type="primary"
+ icon={<IconPencil />}
+ onClick={() => {
+ if (isSkill(skill)) {
+ setSkillFormValues({
+ name: skill.name,
+ description: skill.description,
+ body: skill.body,
+ license: skill.license || '',
+ compatibility: skill.compatibility || '',
+ })
+ setMode(SkillMode.Edit)
+ }
+ }}
+ size="small"
+ tooltip={
+ isHistoricalVersion
+ ? 'Start a new version from this historical version'
+ : undefined
+ }
+ data-attr="llma-skill-new-version-button"
+ >
+ New version
+ </LemonButton>
+ </AccessControlAction>
- <More
- size="small"
- overlay={
- <>
- {communitySkillsEnabled && isSkill(skill) && (
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmSkill}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonButton
- onClick={() =>
- openPublishToCommunityDialog({
- skillName: skill.name,
- githubLogin,
- onPublish: publishToCommunity,
- })
- }
- disabledReason={publishDisabledReason}
- data-attr="llma-skill-publish-community-button"
- fullWidth
+ <More
+ size="small"
+ overlay={
+ <>
+ {communitySkillsEnabled && isSkill(skill) && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
>
- Publish to PostHog community…
- </LemonButton>
- </AccessControlAction>
- )}
+ <LemonButton
+ onClick={() =>
+ openPublishToCommunityDialog({
+ skillName: skill.name,
+ githubLogin,
+ onPublish: publishToCommunity,
+ })
+ }
+ disabledReason={publishDisabledReason}
+ data-attr="llma-skill-publish-community-button"
+ fullWidth
+ >
+ Publish to PostHog community…
+ </LemonButton>
+ </AccessControlAction>
+ )}
+
+ {isSkill(skill) && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <LemonButton
+ onClick={() => openRenameSkillDialog(skill.name, renameSkill)}
+ disabledReason={
+ renamingSkill ? 'Renaming…' : renameDisabledReason
+ }
+ data-attr="llma-skill-rename-button"
+ fullWidth
+ >
+ Rename
+ </LemonButton>
+ </AccessControlAction>
+ )}
- {isSkill(skill) && (
<AccessControlAction
resourceType={AccessControlResourceType.LlmSkill}
minAccessLevel={AccessControlLevel.Editor}
>
<LemonButton
- onClick={() => openRenameSkillDialog(skill.name, renameSkill)}
- disabledReason={renamingSkill ? 'Renaming…' : renameDisabledReason}
- data-attr="llma-skill-rename-button"
+ status="danger"
+ onClick={() => openArchiveSkillDialog(deleteSkill)}
+ data-attr="llma-skill-delete-button"
fullWidth
>
- Rename
+ Archive
</LemonButton>
</AccessControlAction>
- )}
-
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmSkill}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonButton
- status="danger"
- onClick={() => openArchiveSkillDialog(deleteSkill)}
- data-attr="llma-skill-delete-button"
- fullWidth
- >
- Archive
- </LemonButton>
- </AccessControlAction>
- </>
- }
- />
- </>
+ </>
+ }
+ />
+ </>
+ )
}
/>
@@ -338,41 +352,50 @@ export function LLMSkillScene(): JSX.Element {
resourceType={{ type: 'llm_analytics' }}
isLoading={skillLoading}
actions={
- <>
- <LemonButton
- type="secondary"
- onClick={() => cancelEditing()}
- disabledReason={isSkillFormSubmitting ? 'Saving…' : undefined}
- size="small"
- data-attr="llma-skill-cancel-button"
- >
- Cancel
- </LemonButton>
-
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmSkill}
- minAccessLevel={AccessControlLevel.Editor}
- >
+ todayRailNav ? (
+ <QuillLLMSkillActions
+ view={false}
+ communitySkillsEnabled={communitySkillsEnabled}
+ publishDisabledReason={publishDisabledReason}
+ renameDisabledReason={renameDisabledReason}
+ />
+ ) : (
+ <>
<LemonButton
- type="primary"
- onClick={isNewSkill ? submitSkillForm : requestPublish}
- loading={isSkillFormSubmitting}
- disabledReason={
- !isNewSkill && !isHistoricalVersion && !isSkillFormDirty
- ? 'No changes to publish'
- : undefined
- }
+ type="secondary"
+ onClick={() => cancelEditing()}
+ disabledReason={isSkillFormSubmitting ? 'Saving…' : undefined}
size="small"
- data-attr={isNewSkill ? 'skill-create-button' : 'skill-save-button'}
+ data-attr="llma-skill-cancel-button"
>
- {isNewSkill
- ? 'Create skill'
- : nextVersion
- ? `Publish v${nextVersion}`
- : 'Publish version'}
+ Cancel
</LemonButton>
- </AccessControlAction>
- </>
+
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <LemonButton
+ type="primary"
+ onClick={isNewSkill ? submitSkillForm : requestPublish}
+ loading={isSkillFormSubmitting}
+ disabledReason={
+ !isNewSkill && !isHistoricalVersion && !isSkillFormDirty
+ ? 'No changes to publish'
+ : undefined
+ }
+ size="small"
+ data-attr={isNewSkill ? 'skill-create-button' : 'skill-save-button'}
+ >
+ {isNewSkill
+ ? 'Create skill'
+ : nextVersion
+ ? `Publish v${nextVersion}`
+ : 'Publish version'}
+ </LemonButton>
+ </AccessControlAction>
+ </>
+ )
}
/>
diff --git a/products/skills/frontend/LLMSkillsScene.tsx b/products/skills/frontend/LLMSkillsScene.tsx
index 141dde10b667..0192c2aad034 100644
--- a/products/skills/frontend/LLMSkillsScene.tsx
+++ b/products/skills/frontend/LLMSkillsScene.tsx
@@ -2,8 +2,9 @@ import { useActions, useValues } from 'kea'
import { combineUrl, router } from 'kea-router'
import { useMemo, useRef } from 'react'
-import { IconDownload, IconPlusSmall, IconUpload } from '@posthog/icons'
+import { IconDownload, IconPlus, IconPlusSmall, IconUpload } from '@posthog/icons'
import { LemonDivider, LemonModal, LemonSwitch, LemonTag, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { CodeSnippet, Language } from 'lib/components/CodeSnippet/CodeSnippet'
@@ -11,10 +12,12 @@ import { MemberSelect } from 'lib/components/MemberSelect'
import { openPublishToCommunityDialog } from 'lib/components/openPublishToCommunityDialog'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonCollapse } from 'lib/lemon-ui/LemonCollapse'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { ProfileBubbles } from 'lib/lemon-ui/ProfilePicture/ProfileBubbles'
import { Spinner } from 'lib/lemon-ui/Spinner'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -475,6 +478,7 @@ export function LLMSkillsScene(): JSX.Element {
const { searchParams } = useValues(router)
const skillUrl = (name: string): string => combineUrl(urls.skill(name), searchParams).url
const fileInputRef = useRef<HTMLInputElement | null>(null)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const showScoutOrigin = activeCategory === 'scout'
const communitySkillsEnabled = !!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_COMMUNITY_SKILLS]
@@ -622,46 +626,86 @@ export function LLMSkillsScene(): JSX.Element {
activeTabKey={activeTabKey}
description={activeTabDescription}
actions={
- <>
- <LemonButton
- type="secondary"
- size="small"
- onClick={() => setConnectModalOpen(true)}
- data-attr="connect-coding-agent-button"
- >
- Load skills in your agent
- </LemonButton>
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmSkill}
- minAccessLevel={AccessControlLevel.Editor}
- >
+ todayRailNav ? (
+ <>
+ <Button
+ variant="outline"
+ onClick={() => setConnectModalOpen(true)}
+ data-attr="connect-coding-agent-button"
+ >
+ Load skills in your agent
+ </Button>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant="outline"
+ onClick={() => fileInputRef.current?.click()}
+ loading={importing}
+ data-attr="import-skill-button"
+ tooltip="Import a skill from a spec-compliant .zip"
+ >
+ <IconUpload />
+ Import
+ </Button>
+ </AccessControlAction>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={skillUrl('new')} />}
+ data-attr="new-skill-button"
+ >
+ <IconPlus />
+ New skill
+ </Button>
+ </AccessControlAction>
+ </>
+ ) : (
+ <>
<LemonButton
type="secondary"
size="small"
- icon={<IconUpload />}
- onClick={() => fileInputRef.current?.click()}
- loading={importing}
- data-attr="import-skill-button"
- tooltip="Import a skill from a spec-compliant .zip"
+ onClick={() => setConnectModalOpen(true)}
+ data-attr="connect-coding-agent-button"
>
- Import
+ Load skills in your agent
</LemonButton>
- </AccessControlAction>
- <AccessControlAction
- resourceType={AccessControlResourceType.LlmSkill}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonButton
- type="primary"
- size="small"
- to={skillUrl('new')}
- icon={<IconPlusSmall />}
- data-attr="new-skill-button"
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
>
- New skill
- </LemonButton>
- </AccessControlAction>
- </>
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconUpload />}
+ onClick={() => fileInputRef.current?.click()}
+ loading={importing}
+ data-attr="import-skill-button"
+ tooltip="Import a skill from a spec-compliant .zip"
+ >
+ Import
+ </LemonButton>
+ </AccessControlAction>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <LemonButton
+ type="primary"
+ size="small"
+ to={skillUrl('new')}
+ icon={<IconPlusSmall />}
+ data-attr="new-skill-button"
+ >
+ New skill
+ </LemonButton>
+ </AccessControlAction>
+ </>
+ )
}
content={content}
/>
diff --git a/products/skills/frontend/QuillLLMSkillActions.tsx b/products/skills/frontend/QuillLLMSkillActions.tsx
new file mode 100644
index 000000000000..098d28bcc848
--- /dev/null
+++ b/products/skills/frontend/QuillLLMSkillActions.tsx
@@ -0,0 +1,187 @@
+import { useActions, useValues } from 'kea'
+
+import { IconDownload, IconEllipsis, IconPencil } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { openPublishToCommunityDialog } from 'lib/components/openPublishToCommunityDialog'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { SkillMode, isSkill, llmSkillLogic } from './llmSkillLogic'
+import { llmSkillsLogic } from './llmSkillsLogic'
+import { openArchiveSkillDialog, openRenameSkillDialog } from './skillSceneComponents'
+
+export interface QuillLLMSkillActionsProps {
+ /** The read-only view, as opposed to the edit form. */
+ view: boolean
+ communitySkillsEnabled: boolean
+ publishDisabledReason: string | undefined
+ renameDisabledReason: string | undefined
+}
+
+export function QuillLLMSkillActions({
+ view,
+ communitySkillsEnabled,
+ publishDisabledReason,
+ renameDisabledReason,
+}: QuillLLMSkillActionsProps): JSX.Element {
+ const {
+ isSkillFormSubmitting,
+ isNewSkill,
+ skill,
+ isHistoricalVersion,
+ downloadingZip,
+ isSkillFormDirty,
+ nextVersion,
+ renamingSkill,
+ } = useValues(llmSkillLogic)
+ const { githubLogin } = useValues(llmSkillsLogic)
+ const { publishToCommunity } = useActions(llmSkillsLogic)
+ const {
+ submitSkillForm,
+ requestPublish,
+ deleteSkill,
+ renameSkill,
+ setMode,
+ setSkillFormValues,
+ downloadSkill,
+ cancelEditing,
+ } = useActions(llmSkillLogic)
+ const editAccessDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.LlmSkill,
+ AccessControlLevel.Editor
+ )
+
+ if (!view) {
+ return (
+ <>
+ <Button
+ variant="outline"
+ onClick={() => cancelEditing()}
+ disabledReason={isSkillFormSubmitting ? 'Saving…' : undefined}
+ data-attr="llma-skill-cancel-button"
+ >
+ Cancel
+ </Button>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant="primary"
+ onClick={isNewSkill ? submitSkillForm : requestPublish}
+ loading={isSkillFormSubmitting}
+ disabledReason={
+ !isNewSkill && !isHistoricalVersion && !isSkillFormDirty
+ ? 'No changes to publish'
+ : undefined
+ }
+ data-attr={isNewSkill ? 'skill-create-button' : 'skill-save-button'}
+ >
+ {isNewSkill ? 'Create skill' : nextVersion ? `Publish v${nextVersion}` : 'Publish version'}
+ </Button>
+ </AccessControlAction>
+ </>
+ )
+ }
+
+ const publishReason = editAccessDisabledReason || publishDisabledReason
+ const renameReason = editAccessDisabledReason || (renamingSkill ? 'Renaming…' : renameDisabledReason)
+
+ return (
+ <>
+ {isSkill(skill) && (
+ <Button
+ variant="outline"
+ onClick={downloadSkill}
+ loading={downloadingZip}
+ tooltip="Download this skill as a spec-compliant .zip (SKILL.md + bundled files)"
+ data-attr="llma-skill-download-zip-button"
+ >
+ <IconDownload />
+ Download .zip
+ </Button>
+ )}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant="primary"
+ onClick={() => {
+ if (isSkill(skill)) {
+ setSkillFormValues({
+ name: skill.name,
+ description: skill.description,
+ body: skill.body,
+ license: skill.license || '',
+ compatibility: skill.compatibility || '',
+ })
+ setMode(SkillMode.Edit)
+ }
+ }}
+ tooltip={isHistoricalVersion ? 'Start a new version from this historical version' : undefined}
+ data-attr="llma-skill-new-version-button"
+ >
+ <IconPencil />
+ New version
+ </Button>
+ </AccessControlAction>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="default"
+ size="icon"
+ aria-label="More"
+ tooltip="More"
+ data-attr="more-button"
+ />
+ }
+ >
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {communitySkillsEnabled && isSkill(skill) && (
+ <DropdownMenuItem
+ disabledReason={publishReason}
+ onClick={() =>
+ openPublishToCommunityDialog({
+ skillName: skill.name,
+ githubLogin,
+ onPublish: publishToCommunity,
+ })
+ }
+ data-attr="llma-skill-publish-community-button"
+ >
+ Publish to PostHog community…
+ </DropdownMenuItem>
+ )}
+ {isSkill(skill) && (
+ <DropdownMenuItem
+ disabledReason={renameReason}
+ onClick={() => openRenameSkillDialog(skill.name, renameSkill)}
+ data-attr="llma-skill-rename-button"
+ >
+ Rename
+ </DropdownMenuItem>
+ )}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={() => openArchiveSkillDialog(deleteSkill)}
+ data-attr="llma-skill-delete-button"
+ >
+ Archive
+ </DropdownMenuItem>
+ </AccessControlAction>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </>
+ )
+}
diff --git a/products/skills/package.json b/products/skills/package.json
index d333e5c3ea2d..4b656126136a 100644
--- a/products/skills/package.json
+++ b/products/skills/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/streamlit_apps/frontend/StreamlitApp.tsx b/products/streamlit_apps/frontend/StreamlitApp.tsx
index 5e14b64c4b14..59669ebf58e0 100644
--- a/products/streamlit_apps/frontend/StreamlitApp.tsx
+++ b/products/streamlit_apps/frontend/StreamlitApp.tsx
@@ -2,9 +2,11 @@ import { useActions, useValues } from 'kea'
import { IconPencil } from '@posthog/icons'
import { LemonBanner, LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -50,6 +52,7 @@ function curateErrorMessage(raw?: string | null): string {
export function StreamlitAppViewer(props: Record<string, any>): JSX.Element {
const streamlitAppsFeatureFlagEnabled = useFeatureFlag('STREAMLIT_APPS')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const shortId = props.id as string
const { streamlitApp, streamlitAppLoading, appStatus, iframeSrc, sandboxStatus, connectError } = useValues(
streamlitAppLogic({ shortId })
@@ -86,14 +89,24 @@ export function StreamlitAppViewer(props: Record<string, any>): JSX.Element {
name={streamlitApp.name}
resourceType={{ type: 'streamlit_app' }}
actions={
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconPencil />}
- to={urls.streamlitAppEdit(streamlitApp.short_id)}
- >
- Edit
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={urls.streamlitAppEdit(streamlitApp.short_id)} />}
+ >
+ <IconPencil />
+ Edit
+ </Button>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconPencil />}
+ to={urls.streamlitAppEdit(streamlitApp.short_id)}
+ >
+ Edit
+ </LemonButton>
+ )
}
/>
{/* Nudge on version mismatch between activated and running versions. */}
diff --git a/products/streamlit_apps/package.json b/products/streamlit_apps/package.json
index 886add34f7df..61810b9ff007 100644
--- a/products/streamlit_apps/package.json
+++ b/products/streamlit_apps/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
"kea-router": "catalog:"
diff --git a/products/subscriptions/frontend/scenes/QuillSubscriptionDetailActions.tsx b/products/subscriptions/frontend/scenes/QuillSubscriptionDetailActions.tsx
new file mode 100644
index 000000000000..5abb87fb7f33
--- /dev/null
+++ b/products/subscriptions/frontend/scenes/QuillSubscriptionDetailActions.tsx
@@ -0,0 +1,70 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+
+import { Button, Label, Switch } from '@posthog/quill'
+
+import { deleteWithUndo } from 'lib/utils/deleteWithUndo'
+import { getCurrentTeamId } from 'lib/utils/getAppContext'
+import { urls } from 'scenes/urls'
+
+import type { SubscriptionApi } from 'products/subscriptions/frontend/generated/api.schemas'
+
+import { isSubscriptionEnabled, subscriptionEditHref, subscriptionName } from './components/SubscriptionsTable'
+import { subscriptionSceneLogic } from './subscriptionSceneLogic'
+import { subscriptionsSceneLogic } from './subscriptionsSceneLogic'
+
+export function QuillSubscriptionDetailActions({ sub }: { sub: SubscriptionApi }): JSX.Element {
+ const { push } = useActions(router)
+ const { setEnabled, deliverSubscription } = useActions(subscriptionSceneLogic)
+ const { subscriptionLoading, deliveringSubscriptionId } = useValues(subscriptionSceneLogic)
+ const editHref = subscriptionEditHref(sub)
+ const enabled = isSubscriptionEnabled(sub)
+ const isDelivering = deliveringSubscriptionId === sub.id
+
+ const deleteSubscription = (): void => {
+ const name = subscriptionName(sub)
+ void deleteWithUndo({
+ endpoint: `projects/${String(getCurrentTeamId())}/subscriptions`,
+ object: {
+ id: sub.id,
+ name,
+ },
+ callback: () => {
+ subscriptionsSceneLogic.findMounted()?.actions.deleteSubscriptionSuccess()
+ push(urls.subscriptions())
+ },
+ })
+ }
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ <div className="flex items-center gap-2">
+ <Switch
+ id="subscription-toggle-enabled"
+ checked={enabled}
+ onCheckedChange={(newEnabled) => setEnabled({ enabled: newEnabled })}
+ disabledReason={subscriptionLoading ? 'Updating subscription…' : undefined}
+ data-attr="subscription-toggle-enabled"
+ />
+ <Label htmlFor="subscription-toggle-enabled">{enabled ? 'Enabled' : 'Disabled'}</Label>
+ </div>
+ {editHref ? (
+ <Button variant="outline" onClick={() => push(editHref)}>
+ Edit subscription
+ </Button>
+ ) : null}
+ <Button
+ variant="primary"
+ onClick={() => deliverSubscription(sub.id)}
+ loading={isDelivering}
+ disabledReason={isDelivering ? 'Sending test delivery…' : null}
+ data-attr="subscription-detail-header-test-delivery"
+ >
+ Test delivery
+ </Button>
+ <Button variant="destructive-outline" data-attr="subscription-detail-delete" onClick={deleteSubscription}>
+ Delete
+ </Button>
+ </div>
+ )
+}
diff --git a/products/subscriptions/frontend/scenes/SubscriptionScene.tsx b/products/subscriptions/frontend/scenes/SubscriptionScene.tsx
index cd831ae76bea..fb78b32578a1 100644
--- a/products/subscriptions/frontend/scenes/SubscriptionScene.tsx
+++ b/products/subscriptions/frontend/scenes/SubscriptionScene.tsx
@@ -5,6 +5,7 @@ import { LemonButton } from '@posthog/lemon-ui'
import { AccessDenied } from 'lib/components/AccessDenied'
import { NotFound } from 'lib/components/NotFound'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonSwitch } from 'lib/lemon-ui/LemonSwitch'
import { deleteWithUndo } from 'lib/utils/deleteWithUndo'
import { getCurrentTeamId } from 'lib/utils/getAppContext'
@@ -20,6 +21,7 @@ import { SubscriptionResourceTypeEnumApi } from 'products/subscriptions/frontend
import { SubscriptionDeliveryHistory } from './components/SubscriptionDeliveryHistory'
import { isSubscriptionEnabled, subscriptionEditHref, subscriptionName } from './components/SubscriptionsTable'
import { SubscriptionSummary } from './components/SubscriptionSummary'
+import { QuillSubscriptionDetailActions } from './QuillSubscriptionDetailActions'
import { subscriptionSceneLogic } from './subscriptionSceneLogic'
import { subscriptionsSceneLogic } from './subscriptionsSceneLogic'
@@ -27,6 +29,10 @@ function SubscriptionDetailActions({ sub }: { sub: SubscriptionApi }): JSX.Eleme
const { push } = useActions(router)
const { setEnabled, deliverSubscription } = useActions(subscriptionSceneLogic)
const { subscriptionLoading, deliveringSubscriptionId } = useValues(subscriptionSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillSubscriptionDetailActions sub={sub} />
+ }
const editHref = subscriptionEditHref(sub)
const enabled = isSubscriptionEnabled(sub)
const isDelivering = deliveringSubscriptionId === sub.id
diff --git a/products/subscriptions/frontend/scenes/SubscriptionsScene.tsx b/products/subscriptions/frontend/scenes/SubscriptionsScene.tsx
index 5052af395192..dd6d59cb2221 100644
--- a/products/subscriptions/frontend/scenes/SubscriptionsScene.tsx
+++ b/products/subscriptions/frontend/scenes/SubscriptionsScene.tsx
@@ -3,7 +3,9 @@ import { router } from 'kea-router'
import { IconEllipsis } from '@posthog/icons'
import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonSwitch } from 'lib/lemon-ui/LemonSwitch'
import { LemonTab, LemonTabs } from 'lib/lemon-ui/LemonTabs'
import { Spinner } from 'lib/lemon-ui/Spinner'
@@ -110,6 +112,7 @@ export function SubscriptionsScene(): JSX.Element {
aiSubscriptionsAvailable,
} = useValues(subscriptionsSceneLogic)
const { setCurrentTab, setSubscriptionsSorting } = useActions(subscriptionsSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const subscriptionTabs: LemonTab<SubscriptionsTab>[] = [
{ key: SubscriptionsTab.All, label: 'All subscriptions' },
@@ -125,13 +128,23 @@ export function SubscriptionsScene(): JSX.Element {
description={sceneConfigurations[Scene.Subscriptions].description}
resourceType={{ type: 'inbox' }}
actions={
- <LemonButton
- type="primary"
- data-attr="new-subscription-button"
- onClick={() => router.actions.push(urls.subscriptionNew())}
- >
- New subscription
- </LemonButton>
+ todayRailNav ? (
+ <Button
+ variant="primary"
+ data-attr="new-subscription-button"
+ onClick={() => router.actions.push(urls.subscriptionNew())}
+ >
+ New subscription
+ </Button>
+ ) : (
+ <LemonButton
+ type="primary"
+ data-attr="new-subscription-button"
+ onClick={() => router.actions.push(urls.subscriptionNew())}
+ >
+ New subscription
+ </LemonButton>
+ )
}
/>
<LemonTabs
diff --git a/products/subscriptions/package.json b/products/subscriptions/package.json
index 80eef67ac82b..1b356cedb478 100644
--- a/products/subscriptions/package.json
+++ b/products/subscriptions/package.json
@@ -5,6 +5,7 @@
},
"dependencies": {
"@posthog/brand": "catalog:",
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/surveys/package.json b/products/surveys/package.json
index d8a52ebeb611..c324831adcdc 100644
--- a/products/surveys/package.json
+++ b/products/surveys/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
"kea-router": "catalog:",
diff --git a/products/tracing/frontend/TracingScene.tsx b/products/tracing/frontend/TracingScene.tsx
index 41baf3c01eea..8abaaa814f6c 100644
--- a/products/tracing/frontend/TracingScene.tsx
+++ b/products/tracing/frontend/TracingScene.tsx
@@ -4,9 +4,12 @@ import posthog from 'posthog-js'
import { useCallback, useMemo } from 'react'
import { LemonButton, LemonModal, LemonTabs, Link } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconFeedback } from 'lib/lemon-ui/icons'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { cn } from 'lib/utils/css-classes'
@@ -128,6 +131,7 @@ function TracingSceneContents(): JSX.Element {
} = useValues(tracingSceneLogic())
const { traceLoadFiltersActive } = useValues(tracingDataLogic)
const { featureFlags } = useValues(featureFlagLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const {
openTrace,
closeTrace,
@@ -230,20 +234,41 @@ function TracingSceneContents(): JSX.Element {
type: 'tracing',
}}
actions={
- <>
- <LemonButton size="small" type="secondary" icon={<IconFeedback />} onClick={onFeedbackClick}>
- Feedback
- </LemonButton>
- <LemonButton
- to={TRACING_DOCS_URL}
- onClick={onDocsLinkClick}
- type="secondary"
- size="small"
- targetBlank
- >
- Documentation
- </LemonButton>
- </>
+ todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ <Button variant="outline" onClick={onFeedbackClick}>
+ <IconFeedback />
+ Feedback
+ </Button>
+ <Button
+ variant="outline"
+ render={<LinkPrimitive to={TRACING_DOCS_URL} target="_blank" />}
+ onClick={onDocsLinkClick}
+ >
+ Documentation
+ </Button>
+ </div>
+ ) : (
+ <>
+ <LemonButton
+ size="small"
+ type="secondary"
+ icon={<IconFeedback />}
+ onClick={onFeedbackClick}
+ >
+ Feedback
+ </LemonButton>
+ <LemonButton
+ to={TRACING_DOCS_URL}
+ onClick={onDocsLinkClick}
+ type="secondary"
+ size="small"
+ targetBlank
+ >
+ Documentation
+ </LemonButton>
+ </>
+ )
}
/>
{sceneTabsEnabled && (
diff --git a/products/tracing/frontend/scenes/TracingRetentionDetailScene/TracingRetentionDetailScene.tsx b/products/tracing/frontend/scenes/TracingRetentionDetailScene/TracingRetentionDetailScene.tsx
index 2da5ff339667..74904f263f1e 100644
--- a/products/tracing/frontend/scenes/TracingRetentionDetailScene/TracingRetentionDetailScene.tsx
+++ b/products/tracing/frontend/scenes/TracingRetentionDetailScene/TracingRetentionDetailScene.tsx
@@ -2,7 +2,9 @@ import { BindLogic, useActions, useValues } from 'kea'
import { Form } from 'kea-forms'
import { LemonButton, LemonDialog } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { SceneExport } from 'scenes/sceneTypes'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
@@ -58,6 +60,7 @@ function TracingRetentionDetailFormBody({ rule }: { rule: LogsRetentionRuleApi }
const { setRetentionFormValue } = useActions(logsRetentionFormLogic(formProps))
const { retentionForm, isRetentionFormSubmitting } = useValues(logsRetentionFormLogic(formProps))
const saveDisabledReason = retentionFormSaveDisabledReason(retentionForm)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const confirmDelete = (): void => {
LemonDialog.open({
@@ -83,9 +86,15 @@ function TracingRetentionDetailFormBody({ rule }: { rule: LogsRetentionRuleApi }
onNameChange={(name) => setRetentionFormValue('name', name)}
renameDebounceMs={0}
actions={
- <LemonButton type="secondary" status="danger" onClick={confirmDelete}>
- Delete
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="destructive-outline" onClick={confirmDelete}>
+ Delete
+ </Button>
+ ) : (
+ <LemonButton type="secondary" status="danger" onClick={confirmDelete}>
+ Delete
+ </LemonButton>
+ )
}
/>
<SceneStickyBar>
diff --git a/products/tracing/package.json b/products/tracing/package.json
index 97af1dfefa81..8fb82c863eed 100644
--- a/products/tracing/package.json
+++ b/products/tracing/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/tests -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
diff --git a/products/visual_review/frontend/scenes/QuillAddRepoDropdown.tsx b/products/visual_review/frontend/scenes/QuillAddRepoDropdown.tsx
new file mode 100644
index 000000000000..0901619d65e0
--- /dev/null
+++ b/products/visual_review/frontend/scenes/QuillAddRepoDropdown.tsx
@@ -0,0 +1,88 @@
+import { useActions, useValues } from 'kea'
+import { useRef } from 'react'
+
+import {
+ Button,
+ Combobox,
+ ComboboxContent,
+ ComboboxEmpty,
+ ComboboxInput,
+ ComboboxItem,
+ ComboboxList,
+ ComboboxListFooter,
+ ComboboxTrigger,
+ Spinner,
+} from '@posthog/quill'
+
+import { integrationsLogic } from 'lib/integrations/integrationsLogic'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { urls } from 'scenes/urls'
+
+import type { GitHubRepoApi } from 'products/integrations/frontend/generated/api.schemas'
+
+import { visualReviewSettingsSceneLogic } from './visualReviewSettingsSceneLogic'
+
+export function QuillAddRepoDropdown(): JSX.Element {
+ const { availableRepos, existingRepoNames, saving, githubManageAccessUrl } =
+ useValues(visualReviewSettingsSceneLogic)
+ const { addRepo } = useActions(visualReviewSettingsSceneLogic)
+ const { githubRepositoriesLoading } = useValues(integrationsLogic)
+ const triggerRef = useRef<HTMLButtonElement>(null)
+
+ if (githubRepositoriesLoading && availableRepos.length === 0) {
+ return (
+ <div className="flex items-center gap-2 text-muted text-sm">
+ <Spinner /> Loading repositories...
+ </div>
+ )
+ }
+
+ const unaddedRepoNames = availableRepos
+ .filter((r: GitHubRepoApi) => !existingRepoNames.has(r.full_name))
+ .map((r: GitHubRepoApi) => r.full_name)
+ const manageAccessUrl = githubManageAccessUrl ?? urls.settings('environment-integrations')
+
+ return (
+ <Combobox<string>
+ items={unaddedRepoNames}
+ value={null}
+ onValueChange={(fullName) => {
+ const repo = availableRepos.find((r: GitHubRepoApi) => r.full_name === fullName)
+ if (repo) {
+ addRepo(repo)
+ }
+ }}
+ >
+ <ComboboxTrigger render={<Button ref={triggerRef} variant="outline" loading={saving} />}>
+ Add a repository...
+ </ComboboxTrigger>
+ <ComboboxContent anchor={triggerRef} align="end" className="min-w-[280px]">
+ <div className="p-1">
+ <ComboboxInput placeholder="Search repositories" showTrigger={false} className="w-full" />
+ </div>
+ <ComboboxEmpty>
+ {unaddedRepoNames.length === 0 ? 'No more repositories' : 'No repositories found'}
+ </ComboboxEmpty>
+ <ComboboxList>
+ {(fullName: string) => (
+ <ComboboxItem key={fullName} value={fullName}>
+ <span className="min-w-0 break-all">{fullName}</span>
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ <ComboboxListFooter>
+ <Button
+ size="sm"
+ left
+ className="w-full text-muted"
+ render={
+ <LinkPrimitive to={manageAccessUrl} target={githubManageAccessUrl ? '_blank' : undefined} />
+ }
+ >
+ Manage access
+ </Button>
+ </ComboboxListFooter>
+ </ComboboxContent>
+ </Combobox>
+ )
+}
diff --git a/products/visual_review/frontend/scenes/QuillFinalizeRunActions.tsx b/products/visual_review/frontend/scenes/QuillFinalizeRunActions.tsx
new file mode 100644
index 000000000000..ba5c8045efd1
--- /dev/null
+++ b/products/visual_review/frontend/scenes/QuillFinalizeRunActions.tsx
@@ -0,0 +1,50 @@
+import { IconInfo } from '@posthog/icons'
+import { Button, Checkbox, Label, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'
+
+export interface QuillFinalizeRunActionsProps {
+ addImagesToComment: boolean
+ setAddImagesToComment: (enabled: boolean) => void
+ isFinalizing: boolean
+ finalizeRun: () => void
+ reviewPending: number
+}
+
+export function QuillFinalizeRunActions({
+ addImagesToComment,
+ setAddImagesToComment,
+ isFinalizing,
+ finalizeRun,
+ reviewPending,
+}: QuillFinalizeRunActionsProps): JSX.Element {
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ <div className="flex items-center gap-2">
+ <Checkbox
+ id="visual-review-add-images-to-comment"
+ checked={addImagesToComment}
+ onCheckedChange={(checked) => setAddImagesToComment(checked)}
+ disabledReason={isFinalizing ? 'Finalizing…' : undefined}
+ data-attr="visual-review-add-images-to-comment"
+ />
+ <Label htmlFor="visual-review-add-images-to-comment">Add snapshots to the PR comment</Label>
+ <Tooltip>
+ <TooltipTrigger render={<span className="flex text-secondary" />}>
+ <IconInfo className="size-4" />
+ </TooltipTrigger>
+ <TooltipContent>
+ The PR comment is always posted; tick this to attach the before/after snapshot images to it.
+ Remembered for next time.
+ </TooltipContent>
+ </Tooltip>
+ </div>
+ <Button
+ variant="primary"
+ onClick={finalizeRun}
+ loading={isFinalizing}
+ data-attr="visual-review-finalize-run"
+ >
+ {reviewPending > 0 ? `Approve ${reviewPending} and finalize` : 'Finalize run'}
+ </Button>
+ </div>
+ )
+}
diff --git a/products/visual_review/frontend/scenes/VisualReviewFlakinessScene.tsx b/products/visual_review/frontend/scenes/VisualReviewFlakinessScene.tsx
index e1cd4dad5c80..c3ca45c88386 100644
--- a/products/visual_review/frontend/scenes/VisualReviewFlakinessScene.tsx
+++ b/products/visual_review/frontend/scenes/VisualReviewFlakinessScene.tsx
@@ -10,10 +10,13 @@ import {
LemonTable,
Link,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -79,6 +82,7 @@ export function VisualReviewFlakinessScene(): JSX.Element {
quarantineIdentifier,
unquarantineIdentifier,
} = useActions(visualReviewFlakinessSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const isFiltered =
filters.typeKeys.length > 0 || filters.areas.length > 0 || filters.teams.length > 0 || filters.search.length > 0
@@ -107,9 +111,16 @@ export function VisualReviewFlakinessScene(): JSX.Element {
repoFullName={repoFullName}
activeTab="flakiness"
actions={
- <LemonButton size="small" type="secondary" icon={<IconGear />} to={urls.visualReviewSettings()}>
- Settings
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="outline" render={<LinkPrimitive to={urls.visualReviewSettings()} />}>
+ <IconGear />
+ Settings
+ </Button>
+ ) : (
+ <LemonButton size="small" type="secondary" icon={<IconGear />} to={urls.visualReviewSettings()}>
+ Settings
+ </LemonButton>
+ )
}
/>
<VisualReviewTabs activeKey="flakiness" repoFullName={repoFullName} />
diff --git a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
index 35de5e658f6d..17792207002a 100644
--- a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
+++ b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
@@ -8,6 +8,7 @@ import { PostHogCaptureOnViewed } from '@posthog/react'
import { pngHoggie } from 'lib/brand/hoggies'
import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'
@@ -26,6 +27,7 @@ import { VisualReviewTabs } from '../components/VisualReviewTabs'
import { VisualReviewTrail } from '../components/VisualReviewTrail'
import type { SnapshotApi } from '../generated/api.schemas'
import { repoFullNameFromParams, runPath, splitRepoFullName } from '../lib/repoPaths'
+import { QuillFinalizeRunActions } from './QuillFinalizeRunActions'
import { VisualReviewRunSceneLogicProps, visualReviewRunSceneLogic } from './visualReviewRunSceneLogic'
const HedgehogMagnifyingGlass = pngHoggie(magnifyingGlassPng)
@@ -301,6 +303,7 @@ export function VisualReviewRunScene(): JSX.Element {
toggleCleanQuarantined,
setAddImagesToComment,
} = useActions(visualReviewRunSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const quarantinedNavCount = sortedChangedSnapshots.filter((s: SnapshotApi) =>
quarantinedIdentifierSet.has(s.identifier)
@@ -451,24 +454,34 @@ export function VisualReviewRunScene(): JSX.Element {
branch={run.branch}
actions={
!isReportingOnly && !run.approved && !run.is_stale && (reviewPending > 0 || reviewApproved > 0) ? (
- <div className="flex items-center gap-2">
- <LemonCheckbox
- checked={addImagesToComment}
- onChange={setAddImagesToComment}
- disabledReason={isFinalizing ? 'Finalizing…' : undefined}
- label="Add snapshots to the PR comment"
- info="The PR comment is always posted; tick this to attach the before/after snapshot images to it. Remembered for next time."
- data-attr="visual-review-add-images-to-comment"
+ todayRailNav ? (
+ <QuillFinalizeRunActions
+ addImagesToComment={addImagesToComment}
+ setAddImagesToComment={setAddImagesToComment}
+ isFinalizing={isFinalizing}
+ finalizeRun={finalizeRun}
+ reviewPending={reviewPending}
/>
- <LemonButton
- type="primary"
- onClick={finalizeRun}
- loading={isFinalizing}
- data-attr="visual-review-finalize-run"
- >
- {reviewPending > 0 ? `Approve ${reviewPending} and finalize` : 'Finalize run'}
- </LemonButton>
- </div>
+ ) : (
+ <div className="flex items-center gap-2">
+ <LemonCheckbox
+ checked={addImagesToComment}
+ onChange={setAddImagesToComment}
+ disabledReason={isFinalizing ? 'Finalizing…' : undefined}
+ label="Add snapshots to the PR comment"
+ info="The PR comment is always posted; tick this to attach the before/after snapshot images to it. Remembered for next time."
+ data-attr="visual-review-add-images-to-comment"
+ />
+ <LemonButton
+ type="primary"
+ onClick={finalizeRun}
+ loading={isFinalizing}
+ data-attr="visual-review-finalize-run"
+ >
+ {reviewPending > 0 ? `Approve ${reviewPending} and finalize` : 'Finalize run'}
+ </LemonButton>
+ </div>
+ )
) : undefined
}
/>
diff --git a/products/visual_review/frontend/scenes/VisualReviewRunsScene.tsx b/products/visual_review/frontend/scenes/VisualReviewRunsScene.tsx
index e529e4adf852..ae8922925c95 100644
--- a/products/visual_review/frontend/scenes/VisualReviewRunsScene.tsx
+++ b/products/visual_review/frontend/scenes/VisualReviewRunsScene.tsx
@@ -11,9 +11,12 @@ import {
LemonTag,
Link,
} from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -74,6 +77,7 @@ export function VisualReviewRunsScene(): JSX.Element {
const { runs, runsLoading, activeTab, counts, repoNotFound, repoFullName, page, totalCount, searchQuery } =
useValues(visualReviewRunsSceneLogic)
const { loadRuns, loadCounts, setActiveTab, setPage, setSearchQuery } = useActions(visualReviewRunsSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const columns: LemonTableColumns<RunApi> = [
{
@@ -151,9 +155,16 @@ export function VisualReviewRunsScene(): JSX.Element {
repoFullName={repoFullName}
activeTab="runs"
actions={
- <LemonButton size="small" type="secondary" icon={<IconGear />} to={urls.visualReviewSettings()}>
- Settings
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="outline" render={<LinkPrimitive to={urls.visualReviewSettings()} />}>
+ <IconGear />
+ Settings
+ </Button>
+ ) : (
+ <LemonButton size="small" type="secondary" icon={<IconGear />} to={urls.visualReviewSettings()}>
+ Settings
+ </LemonButton>
+ )
}
/>
<VisualReviewTabs activeKey="runs" repoFullName={repoFullName} />
diff --git a/products/visual_review/frontend/scenes/VisualReviewSettingsScene.tsx b/products/visual_review/frontend/scenes/VisualReviewSettingsScene.tsx
index 507d07d8e10f..eb4fca14f714 100644
--- a/products/visual_review/frontend/scenes/VisualReviewSettingsScene.tsx
+++ b/products/visual_review/frontend/scenes/VisualReviewSettingsScene.tsx
@@ -4,6 +4,7 @@ import { IconArrowRight, IconCopy, IconGear, IconGithub, IconPencil, IconPlus, I
import { LemonButton, LemonInput, LemonSearchableSelect, LemonSkeleton, LemonSwitch, Spinner } from '@posthog/lemon-ui'
import api from 'lib/api'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
@@ -17,6 +18,7 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import type { GitHubRepoApi } from 'products/integrations/frontend/generated/api.schemas'
import type { RepoApi } from '../generated/api.schemas'
+import { QuillAddRepoDropdown } from './QuillAddRepoDropdown'
import { visualReviewSettingsSceneLogic } from './visualReviewSettingsSceneLogic'
export const scene: SceneExport = {
@@ -250,6 +252,11 @@ function AddRepoDropdown(): JSX.Element {
useValues(visualReviewSettingsSceneLogic)
const { addRepo } = useActions(visualReviewSettingsSceneLogic)
const { githubRepositoriesLoading } = useValues(integrationsLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ if (todayRailNav) {
+ return <QuillAddRepoDropdown />
+ }
const unaddedRepos = availableRepos.filter((r: GitHubRepoApi) => !existingRepoNames.has(r.full_name))
diff --git a/products/visual_review/frontend/scenes/VisualReviewSnapshotOverviewScene.tsx b/products/visual_review/frontend/scenes/VisualReviewSnapshotOverviewScene.tsx
index 7c01fb9f43cf..5ab87d44b605 100644
--- a/products/visual_review/frontend/scenes/VisualReviewSnapshotOverviewScene.tsx
+++ b/products/visual_review/frontend/scenes/VisualReviewSnapshotOverviewScene.tsx
@@ -2,8 +2,11 @@ import { useActions, useValues } from 'kea'
import { IconFlag, IconGear, IconPulse, IconWarning } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonInput, LemonSegmentedButton, LemonSkeleton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -50,6 +53,7 @@ export function VisualReviewSnapshotOverviewScene(): JSX.Element {
const { setStatPreset, toggleType, toggleArea, toggleStability, setTheme, setSearch, clearAllFilters } = useActions(
visualReviewSnapshotOverviewSceneLogic
)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
// Theme is never neutral (always Light or Dark), so we don't count it
// toward `isFiltered` — picking a side is the default state.
@@ -70,9 +74,16 @@ export function VisualReviewSnapshotOverviewScene(): JSX.Element {
repoFullName={repoFullName}
activeTab="snapshots"
actions={
- <LemonButton size="small" type="secondary" icon={<IconGear />} to={urls.visualReviewSettings()}>
- Settings
- </LemonButton>
+ todayRailNav ? (
+ <Button variant="outline" render={<LinkPrimitive to={urls.visualReviewSettings()} />}>
+ <IconGear />
+ Settings
+ </Button>
+ ) : (
+ <LemonButton size="small" type="secondary" icon={<IconGear />} to={urls.visualReviewSettings()}>
+ Settings
+ </LemonButton>
+ )
}
/>
<VisualReviewTabs activeKey="snapshots" repoFullName={repoFullName} />
diff --git a/products/visual_review/package.json b/products/visual_review/package.json
index 554b64bd65b8..fc34bf9e4c1e 100644
--- a/products/visual_review/package.json
+++ b/products/visual_review/package.json
@@ -8,6 +8,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
"kea-router": "catalog:",
diff --git a/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene.tsx b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene.tsx
index addf631416dc..526f89b38824 100644
--- a/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene.tsx
+++ b/products/warehouse_sources/frontend/scenes/PipelineOverviewScene/PipelineOverviewScene.tsx
@@ -1,11 +1,14 @@
import { useActions, useValues } from 'kea'
-import { IconPlusSmall, IconRefresh } from '@posthog/icons'
+import { IconPlus, IconPlusSmall, IconRefresh } from '@posthog/icons'
import { LemonButton, LemonSelect } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { NotFound } from 'lib/components/NotFound'
import { TZLabel } from 'lib/components/TZLabel'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -35,6 +38,7 @@ export function PipelineOverviewScene(): JSX.Element {
const { featureFlags, receivedFeatureFlags } = useValues(featureFlagLogic)
const { window, jobStatsLoading, hasIssues, lastUpdatedAt } = useValues(pipelineOverviewSceneLogic)
const { setWindow, refresh } = useActions(pipelineOverviewSceneLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
// Wait for the flags to land before refusing. Rendering NotFound first and the scene a beat
// later reads as a broken page to anyone who does have the flag.
@@ -49,27 +53,49 @@ export function PipelineOverviewScene(): JSX.Element {
description="Every source you import from and every destination you write to, with the health of each."
resourceType={{ type: 'data_pipeline' }}
actions={
- <div className="flex flex-wrap gap-2">
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconRefresh />}
- onClick={refresh}
- loading={jobStatsLoading}
- data-attr="etl-refresh"
- >
- Refresh
- </LemonButton>
- <LemonButton
- type="primary"
- size="small"
- icon={<IconPlusSmall />}
- to={urls.dataPipelinesNew('source')}
- data-attr="etl-new-source"
- >
- New source
- </LemonButton>
- </div>
+ todayRailNav ? (
+ <div className="flex flex-wrap items-center gap-2">
+ <Button
+ variant="outline"
+ onClick={refresh}
+ loading={jobStatsLoading}
+ data-attr="etl-refresh"
+ >
+ <IconRefresh />
+ Refresh
+ </Button>
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.dataPipelinesNew('source')} />}
+ data-attr="etl-new-source"
+ >
+ <IconPlus />
+ New source
+ </Button>
+ </div>
+ ) : (
+ <div className="flex flex-wrap gap-2">
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconRefresh />}
+ onClick={refresh}
+ loading={jobStatsLoading}
+ data-attr="etl-refresh"
+ >
+ Refresh
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ size="small"
+ icon={<IconPlusSmall />}
+ to={urls.dataPipelinesNew('source')}
+ data-attr="etl-new-source"
+ >
+ New source
+ </LemonButton>
+ </div>
+ )
}
/>
diff --git a/products/warehouse_sources/package.json b/products/warehouse_sources/package.json
index 1788aecdecb4..6372e8ca2935 100644
--- a/products/warehouse_sources/package.json
+++ b/products/warehouse_sources/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.tsx b/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.tsx
index 512a49e95dc1..1c07627f0e3c 100644
--- a/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.tsx
+++ b/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.tsx
@@ -10,6 +10,7 @@ import { pngHoggie } from 'lib/brand/hoggies'
import { appEditorUrl } from 'lib/components/AuthorizedUrlList/authorizedUrlListLogic'
import { HeatmapCanvas } from 'lib/components/heatmaps/HeatmapCanvas'
import { MAX_HEATMAP_HEIGHT } from 'lib/components/heatmaps/heatmapDataLogic'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner/LemonBanner'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LoadingBar } from 'lib/lemon-ui/LoadingBar'
@@ -31,6 +32,7 @@ import { pageHistoryLogic } from '../../history/pageHistoryLogic'
import { PageHistoryStrip } from '../../history/PageHistoryStrip'
import { formatCaptureDay } from '../../history/pageHistoryUtils'
import { heatmapLogic } from './heatmapLogic'
+import { QuillHeatmapActions } from './QuillHeatmapActions'
const HedgehogDirector = pngHoggie(directorPng)
@@ -99,6 +101,7 @@ export function HeatmapScene({ id }: { id: string }): JSX.Element {
switchToScreenshot,
} = useActions(logic)
const { updateHeatmap } = useAsyncActions(logic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const toolbarAccessDisabledReason = getAccessControlDisabledReason(
AccessControlResourceType.Toolbar,
@@ -156,54 +159,21 @@ export function HeatmapScene({ id }: { id: string }): JSX.Element {
key: 'heatmaps',
}}
actions={
- <>
- {(hasUnsavedChanges || saving) && !editDisabledReason && (
- <>
- <LemonButton
- type="secondary"
- onClick={() => {
- discardChanges()
- focusExport()
- }}
- disabledReason={saving ? 'Saving changes' : null}
- size="small"
- data-attr="heatmap-discard-changes"
- >
- Discard changes
- </LemonButton>
- <LemonButton
- type="primary"
- onClick={() => void saveAndRefocus()}
- loading={saving}
- disabledReason={saveDisabledReason}
- size="small"
- data-attr="heatmap-save"
- >
- {saving ? 'Saving…' : 'Save'}
- </LemonButton>
- </>
- )}
- <LemonButton
- type="tertiary"
- size="small"
- to={displayUrl ? appEditorUrl(displayUrl, { userIntent: 'heatmaps' }) : undefined}
- targetBlank
- data-attr="heatmaps-open-in-toolbar"
- disabledReason={!displayUrl ? 'Select a URL first' : toolbarAccessDisabledReason}
- tooltip="Explore heatmaps on your website, including pages that require a login"
- >
- Open in toolbar
- </LemonButton>
- <LemonButton
- ref={exportRef}
- onClick={exportHeatmap}
- data-attr="export-heatmap"
- type="secondary"
- icon={<IconDownload />}
- size="small"
- tooltip="Export heatmap as PNG"
- tooltipPlacement="bottom"
- disabledReason={
+ todayRailNav ? (
+ <QuillHeatmapActions
+ showSaveButtons={(hasUnsavedChanges || saving) && !editDisabledReason}
+ saving={saving}
+ saveDisabledReason={saveDisabledReason}
+ onDiscard={() => {
+ discardChanges()
+ focusExport()
+ }}
+ onSave={() => void saveAndRefocus()}
+ displayUrl={displayUrl}
+ openInToolbarDisabledReason={toolbarAccessDisabledReason}
+ exportRef={exportRef}
+ onExport={exportHeatmap}
+ exportDisabledReason={
historySelectionActive
? 'Exit history to export your current view.'
: previewType === 'screenshot' &&
@@ -211,10 +181,68 @@ export function HeatmapScene({ id }: { id: string }): JSX.Element {
? 'Screenshot is not ready'
: undefined
}
- >
- Export
- </LemonButton>
- </>
+ />
+ ) : (
+ <>
+ {(hasUnsavedChanges || saving) && !editDisabledReason && (
+ <>
+ <LemonButton
+ type="secondary"
+ onClick={() => {
+ discardChanges()
+ focusExport()
+ }}
+ disabledReason={saving ? 'Saving changes' : null}
+ size="small"
+ data-attr="heatmap-discard-changes"
+ >
+ Discard changes
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ onClick={() => void saveAndRefocus()}
+ loading={saving}
+ disabledReason={saveDisabledReason}
+ size="small"
+ data-attr="heatmap-save"
+ >
+ {saving ? 'Saving…' : 'Save'}
+ </LemonButton>
+ </>
+ )}
+ <LemonButton
+ type="tertiary"
+ size="small"
+ to={displayUrl ? appEditorUrl(displayUrl, { userIntent: 'heatmaps' }) : undefined}
+ targetBlank
+ data-attr="heatmaps-open-in-toolbar"
+ disabledReason={!displayUrl ? 'Select a URL first' : toolbarAccessDisabledReason}
+ tooltip="Explore heatmaps on your website, including pages that require a login"
+ >
+ Open in toolbar
+ </LemonButton>
+ <LemonButton
+ ref={exportRef}
+ onClick={exportHeatmap}
+ data-attr="export-heatmap"
+ type="secondary"
+ icon={<IconDownload />}
+ size="small"
+ tooltip="Export heatmap as PNG"
+ tooltipPlacement="bottom"
+ disabledReason={
+ historySelectionActive
+ ? 'Exit history to export your current view.'
+ : previewType === 'screenshot' &&
+ (!screenshotUrl || !screenshotLoaded || generatingScreenshot)
+ ? 'Screenshot is not ready'
+ : undefined
+ }
+ >
+ Export
+ </LemonButton>
+ </>
+ )
}
/>
<HeatmapsPricingNotice />
diff --git a/products/web_analytics/frontend/heatmaps/scenes/heatmap/QuillHeatmapActions.tsx b/products/web_analytics/frontend/heatmaps/scenes/heatmap/QuillHeatmapActions.tsx
new file mode 100644
index 000000000000..073504c366cc
--- /dev/null
+++ b/products/web_analytics/frontend/heatmaps/scenes/heatmap/QuillHeatmapActions.tsx
@@ -0,0 +1,88 @@
+import type { MutableRefObject } from 'react'
+
+import { IconDownload } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { appEditorUrl } from 'lib/components/AuthorizedUrlList/authorizedUrlListLogic'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+
+export interface QuillHeatmapActionsProps {
+ showSaveButtons: boolean
+ saving: boolean
+ saveDisabledReason: string | null | undefined
+ onDiscard: () => void
+ onSave: () => void
+ displayUrl: string | null | undefined
+ openInToolbarDisabledReason: string | null | undefined
+ exportRef: MutableRefObject<HTMLButtonElement | null>
+ onExport: () => void
+ exportDisabledReason: string | undefined
+}
+
+export function QuillHeatmapActions({
+ showSaveButtons,
+ saving,
+ saveDisabledReason,
+ onDiscard,
+ onSave,
+ displayUrl,
+ openInToolbarDisabledReason,
+ exportRef,
+ onExport,
+ exportDisabledReason,
+}: QuillHeatmapActionsProps): JSX.Element {
+ return (
+ <>
+ {showSaveButtons && (
+ <>
+ <Button
+ variant="outline"
+ onClick={onDiscard}
+ disabledReason={saving ? 'Saving changes' : null}
+ data-attr="heatmap-discard-changes"
+ >
+ Discard changes
+ </Button>
+ <Button
+ variant="primary"
+ onClick={onSave}
+ loading={saving}
+ disabledReason={saveDisabledReason}
+ data-attr="heatmap-save"
+ >
+ {saving ? 'Saving…' : 'Save'}
+ </Button>
+ </>
+ )}
+ <Button
+ {...(displayUrl
+ ? {
+ nativeButton: false,
+ render: (
+ <LinkPrimitive
+ to={appEditorUrl(displayUrl, { userIntent: 'heatmaps' })}
+ target="_blank"
+ />
+ ),
+ }
+ : {})}
+ data-attr="heatmaps-open-in-toolbar"
+ disabledReason={!displayUrl ? 'Select a URL first' : openInToolbarDisabledReason}
+ tooltip="Explore heatmaps on your website, including pages that require a login"
+ >
+ Open in toolbar
+ </Button>
+ <Button
+ ref={exportRef}
+ onClick={onExport}
+ data-attr="export-heatmap"
+ variant="outline"
+ tooltip="Export heatmap as PNG"
+ disabledReason={exportDisabledReason}
+ >
+ <IconDownload />
+ Export
+ </Button>
+ </>
+ )
+}
diff --git a/products/web_analytics/frontend/heatmaps/scenes/heatmaps/HeatmapsScene.tsx b/products/web_analytics/frontend/heatmaps/scenes/heatmaps/HeatmapsScene.tsx
index fb3a70cf931d..ef96882ce6df 100644
--- a/products/web_analytics/frontend/heatmaps/scenes/heatmaps/HeatmapsScene.tsx
+++ b/products/web_analytics/frontend/heatmaps/scenes/heatmaps/HeatmapsScene.tsx
@@ -1,14 +1,17 @@
import { useActions, useValues } from 'kea'
-import { IconBrowser, IconHide, IconImage, IconPlusSmall } from '@posthog/icons'
+import { IconBrowser, IconHide, IconImage, IconPlus, IconPlusSmall } from '@posthog/icons'
import { LemonButton, LemonInput, LemonTable, LemonTableColumns, LemonTag, Link, Tooltip } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { MemberSelect } from 'lib/components/MemberSelect'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { More } from 'lib/lemon-ui/LemonButton/More'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { teamLogic } from 'scenes/teamLogic'
@@ -36,6 +39,7 @@ export function HeatmapsScene(): JSX.Element {
const { savedHeatmaps, savedHeatmapsLoading, filters, totalCount } = useValues(heatmapsSceneLogic)
const { deleteHeatmap, setHeatmapsFilters } = useActions(heatmapsSceneLogic)
const { currentTeamId } = useValues(teamLogic)
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const { settings, urlAllowlist, captureMode } = useValues(
heatmapCaptureSettingsLogic({ teamId: currentTeamId ?? 0 })
)
@@ -129,39 +133,73 @@ export function HeatmapsScene(): JSX.Element {
type: sceneConfigurations[Scene.Heatmaps].iconType || 'default',
}}
actions={
- <>
- <LemonButton
- type="secondary"
- size="small"
- id="heatmaps-feedback-button"
- data-attr="heatmaps-feedback-button"
- >
- Send feedback
- </LemonButton>
- <Shortcut
- name="NewHeatmap"
- keybind={[keyBinds.new]}
- intent="New heatmap"
- interaction="click"
- scope={Scene.Heatmaps}
- >
- <AccessControlAction
- resourceType={AccessControlResourceType.Heatmap}
- minAccessLevel={AccessControlLevel.Editor}
+ todayRailNav ? (
+ <>
+ <Button
+ variant="outline"
+ id="heatmaps-feedback-button"
+ data-attr="heatmaps-feedback-button"
>
- <LemonButton
- type="primary"
- to={urls.heatmap('new')}
- data-attr="heatmaps-new-heatmap-button"
- size="small"
- icon={<IconPlusSmall />}
- tooltip="New heatmap"
+ Send feedback
+ </Button>
+ <Shortcut
+ name="NewHeatmap"
+ keybind={[keyBinds.new]}
+ intent="New heatmap"
+ interaction="click"
+ scope={Scene.Heatmaps}
+ >
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Heatmap}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.heatmap('new')} />}
+ data-attr="heatmaps-new-heatmap-button"
+ tooltip="New heatmap"
+ >
+ <IconPlus />
+ New heatmap
+ </Button>
+ </AccessControlAction>
+ </Shortcut>
+ </>
+ ) : (
+ <>
+ <LemonButton
+ type="secondary"
+ size="small"
+ id="heatmaps-feedback-button"
+ data-attr="heatmaps-feedback-button"
+ >
+ Send feedback
+ </LemonButton>
+ <Shortcut
+ name="NewHeatmap"
+ keybind={[keyBinds.new]}
+ intent="New heatmap"
+ interaction="click"
+ scope={Scene.Heatmaps}
+ >
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Heatmap}
+ minAccessLevel={AccessControlLevel.Editor}
>
- New heatmap
- </LemonButton>
- </AccessControlAction>
- </Shortcut>
- </>
+ <LemonButton
+ type="primary"
+ to={urls.heatmap('new')}
+ data-attr="heatmaps-new-heatmap-button"
+ size="small"
+ icon={<IconPlusSmall />}
+ tooltip="New heatmap"
+ >
+ New heatmap
+ </LemonButton>
+ </AccessControlAction>
+ </Shortcut>
+ </>
+ )
}
/>
<HeatmapsWarnings />
diff --git a/products/web_analytics/package.json b/products/web_analytics/package.json
index 694a2e3f1d8d..83c13d01bbe7 100644
--- a/products/web_analytics/package.json
+++ b/products/web_analytics/package.json
@@ -4,6 +4,7 @@
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"kea": "catalog:",
"kea-forms": "catalog:",
"kea-loaders": "catalog:",
diff --git a/products/workflows/frontend/Broadcasts/BroadcastSummary.tsx b/products/workflows/frontend/Broadcasts/BroadcastSummary.tsx
index 9016afd819ca..a3a17680e9c0 100644
--- a/products/workflows/frontend/Broadcasts/BroadcastSummary.tsx
+++ b/products/workflows/frontend/Broadcasts/BroadcastSummary.tsx
@@ -14,6 +14,7 @@ import {
import PropertyFiltersDisplay from 'lib/components/PropertyFilters/components/PropertyFiltersDisplay'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonMenu } from 'lib/lemon-ui/LemonMenu'
import { LemonTable, LemonTableColumns } from 'lib/lemon-ui/LemonTable'
import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
@@ -39,6 +40,7 @@ import { BroadcastStatusTag } from './BroadcastStatusTag'
import { broadcastPath } from './broadcastUsage'
import { broadcastWizardLogic } from './broadcastWizardLogic'
import { ComposerDraftFeedback } from './ComposerDraftFeedback'
+import { QuillBroadcastActionsMenu } from './QuillBroadcastActionsMenu'
const BATCH_JOB_STATUS_TAG: Record<string, LemonTagType> = {
waiting: 'default',
@@ -282,6 +284,7 @@ export function BroadcastSummary(): JSX.Element {
useActions(broadcastWizardLogic)
const { props } = useMountedLogic(broadcastWizardLogic)
const { nonCohortAudience } = useValues(broadcastAudienceCohortsLogic(props))
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const pendingSchedule = broadcast?.schedules?.find((schedule) => schedule.status === 'active')
const confirmMoveToDraft = (): void => {
@@ -363,7 +366,24 @@ export function BroadcastSummary(): JSX.Element {
}
: null,
]
- const actionsMenu = (
+ const actionsMenu = todayRailNav ? (
+ <QuillBroadcastActionsMenu
+ items={actionItems.flatMap((item) =>
+ item
+ ? [
+ {
+ label: item.label,
+ onClick: item.onClick,
+ disabledReason: 'disabledReason' in item ? item.disabledReason : undefined,
+ danger: 'status' in item && item.status === 'danger',
+ 'data-attr': item['data-attr'],
+ },
+ ]
+ : []
+ )}
+ loading={movingToDraft || duplicating}
+ />
+ ) : (
<LemonMenu items={actionItems}>
<LemonButton
type="secondary"
diff --git a/products/workflows/frontend/Broadcasts/BroadcastWizard.tsx b/products/workflows/frontend/Broadcasts/BroadcastWizard.tsx
index e9d79f0a7552..64013090446e 100644
--- a/products/workflows/frontend/Broadcasts/BroadcastWizard.tsx
+++ b/products/workflows/frontend/Broadcasts/BroadcastWizard.tsx
@@ -3,6 +3,7 @@ import { useActions, useValues } from 'kea'
import { IconChevronDown } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonMenu } from 'lib/lemon-ui/LemonMenu'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
@@ -15,6 +16,7 @@ import { manageDisabledReason } from './broadcastLifecycle'
import { BroadcastSceneHeader } from './BroadcastSceneHeader'
import { broadcastWizardLogic } from './broadcastWizardLogic'
import { BroadcastWizardStepper } from './BroadcastWizardStepper'
+import { QuillBroadcastActionsMenu } from './QuillBroadcastActionsMenu'
import { BroadcastContentStep } from './steps/BroadcastContentStep'
import { BroadcastGoalStep } from './steps/BroadcastGoalStep'
import { BroadcastRecipientsStep } from './steps/BroadcastRecipientsStep'
@@ -30,6 +32,7 @@ export function BroadcastWizard(): JSX.Element {
useActions(broadcastWizardLogic)
const { broadcastId, broadcast } = useValues(broadcastWizardLogic)
useBroadcastAgentPanel()
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
return (
<SceneContent className="min-h-full w-full shrink-0" data-attr="broadcast-wizard">
@@ -38,35 +41,62 @@ export function BroadcastWizard(): JSX.Element {
actions={
// A draft not saved yet has nothing to archive.
broadcastId ? (
- <LemonMenu
- items={[
- {
- label: 'Open in workflow editor',
- onClick: openInWorkflowEditor,
- disabledReason:
- saving || launching ? 'Wait for the broadcast to finish saving' : undefined,
- 'data-attr': 'broadcast-open-in-workflow-editor',
- },
- {
- label: 'Archive',
- status: 'danger',
- onClick: archiveBroadcast,
- disabledReason:
- manageDisabledReason(broadcast?.user_access_level) ??
- (saving || launching ? 'Wait for the broadcast to finish saving' : undefined),
- 'data-attr': 'broadcast-archive',
- },
- ]}
- >
- <LemonButton
- type="secondary"
- size="small"
- sideIcon={<IconChevronDown />}
- data-attr="broadcast-actions"
+ todayRailNav ? (
+ <QuillBroadcastActionsMenu
+ items={[
+ {
+ label: 'Open in workflow editor',
+ onClick: openInWorkflowEditor,
+ disabledReason:
+ saving || launching ? 'Wait for the broadcast to finish saving' : undefined,
+ 'data-attr': 'broadcast-open-in-workflow-editor',
+ },
+ {
+ label: 'Archive',
+ danger: true,
+ onClick: archiveBroadcast,
+ disabledReason:
+ manageDisabledReason(broadcast?.user_access_level) ??
+ (saving || launching
+ ? 'Wait for the broadcast to finish saving'
+ : undefined),
+ 'data-attr': 'broadcast-archive',
+ },
+ ]}
+ />
+ ) : (
+ <LemonMenu
+ items={[
+ {
+ label: 'Open in workflow editor',
+ onClick: openInWorkflowEditor,
+ disabledReason:
+ saving || launching ? 'Wait for the broadcast to finish saving' : undefined,
+ 'data-attr': 'broadcast-open-in-workflow-editor',
+ },
+ {
+ label: 'Archive',
+ status: 'danger',
+ onClick: archiveBroadcast,
+ disabledReason:
+ manageDisabledReason(broadcast?.user_access_level) ??
+ (saving || launching
+ ? 'Wait for the broadcast to finish saving'
+ : undefined),
+ 'data-attr': 'broadcast-archive',
+ },
+ ]}
>
- Actions
- </LemonButton>
- </LemonMenu>
+ <LemonButton
+ type="secondary"
+ size="small"
+ sideIcon={<IconChevronDown />}
+ data-attr="broadcast-actions"
+ >
+ Actions
+ </LemonButton>
+ </LemonMenu>
+ )
) : undefined
}
/>
diff --git a/products/workflows/frontend/Broadcasts/BroadcastsScene.tsx b/products/workflows/frontend/Broadcasts/BroadcastsScene.tsx
index 41f77d412b6a..7dc3f3b0b735 100644
--- a/products/workflows/frontend/Broadcasts/BroadcastsScene.tsx
+++ b/products/workflows/frontend/Broadcasts/BroadcastsScene.tsx
@@ -2,6 +2,7 @@ import { useActions, useValues } from 'kea'
import { router } from 'kea-router'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
@@ -40,6 +41,7 @@ export function BroadcastsScene(): JSX.Element {
const { startNewBroadcast } = useActions(newBroadcastAgentLogic)
// The tab routes are literal paths, so the tab is the last path segment rather than a route param.
const showCalendar = useFeatureFlag('WORKFLOWS_SEND_CALENDAR')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const lastSegment = location.pathname.split('/').pop() as MessagingNavTabKey | 'calendar'
const currentTab: MessagingNavTabKey | 'broadcasts' | 'calendar' =
lastSegment === 'calendar'
@@ -74,14 +76,20 @@ export function BroadcastsScene(): JSX.Element {
resourceType={AccessControlResourceType.Workflow}
minAccessLevel={AccessControlLevel.Editor}
>
- <LemonButton
- data-attr="new-broadcast"
- onClick={startNewBroadcast}
- type="primary"
- size="small"
- >
- New broadcast
- </LemonButton>
+ {todayRailNav ? (
+ <Button data-attr="new-broadcast" onClick={startNewBroadcast} variant="primary">
+ New broadcast
+ </Button>
+ ) : (
+ <LemonButton
+ data-attr="new-broadcast"
+ onClick={startNewBroadcast}
+ type="primary"
+ size="small"
+ >
+ New broadcast
+ </LemonButton>
+ )}
</AccessControlAction>
) : (
<MessagingTabActions tab={currentTab} channelsUrl={urls.broadcasts('channels')} />
diff --git a/products/workflows/frontend/Broadcasts/QuillBroadcastActionsMenu.tsx b/products/workflows/frontend/Broadcasts/QuillBroadcastActionsMenu.tsx
new file mode 100644
index 000000000000..d928597b5d83
--- /dev/null
+++ b/products/workflows/frontend/Broadcasts/QuillBroadcastActionsMenu.tsx
@@ -0,0 +1,40 @@
+import { IconChevronDown } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+export interface QuillBroadcastActionItem {
+ label: string
+ onClick: () => void
+ disabledReason?: string | null
+ danger?: boolean
+ 'data-attr': string
+}
+
+export function QuillBroadcastActionsMenu({
+ items,
+ loading,
+}: {
+ items: QuillBroadcastActionItem[]
+ loading?: boolean
+}): JSX.Element {
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger render={<Button variant="outline" loading={loading} data-attr="broadcast-actions" />}>
+ Actions
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {items.map((item) => (
+ <DropdownMenuItem
+ key={item['data-attr']}
+ variant={item.danger ? 'destructive' : 'default'}
+ disabledReason={item.disabledReason}
+ onClick={item.onClick}
+ data-attr={item['data-attr']}
+ >
+ {item.label}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/products/workflows/frontend/MessagingTabActions.tsx b/products/workflows/frontend/MessagingTabActions.tsx
index 9281c6087427..2c5322e01b55 100644
--- a/products/workflows/frontend/MessagingTabActions.tsx
+++ b/products/workflows/frontend/MessagingTabActions.tsx
@@ -7,6 +7,7 @@ import api from 'lib/api'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'
import { FEATURE_FLAGS, TeamMembershipLevel } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { IconSlack, IconTwilio } from 'lib/lemon-ui/icons'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -15,6 +16,7 @@ import { AccessControlLevel, AccessControlResourceType } from '~/types'
import type { MessagingNavTabKey } from './messagingTabs'
import { optOutCategoriesLogic } from './OptOuts/optOutCategoriesLogic'
+import { QuillMessagingTabActions } from './QuillMessagingTabActions'
import { newTemplateAgentLogic } from './TemplateLibrary/newTemplateAgentLogic'
/** The scene-header action for a shared messaging tab, the same on every surface that shows the tab. */
@@ -26,6 +28,10 @@ export function MessagingTabActions({
/** Where the Slack authorization flow returns to, so it lands back on the surface it left. */
channelsUrl: string
}): JSX.Element | null {
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ if (todayRailNav) {
+ return <QuillMessagingTabActions tab={tab} channelsUrl={channelsUrl} />
+ }
// One component per action, so a tab mounts (and loads) only the logic its own button needs.
if (tab === 'library') {
return <NewTemplateButton />
diff --git a/products/workflows/frontend/QuillMessagingTabActions.tsx b/products/workflows/frontend/QuillMessagingTabActions.tsx
new file mode 100644
index 000000000000..54f7deb482a5
--- /dev/null
+++ b/products/workflows/frontend/QuillMessagingTabActions.tsx
@@ -0,0 +1,24 @@
+import type { MessagingNavTabKey } from './messagingTabs'
+import { QuillNewCategoryButton } from './QuillNewCategoryButton'
+import { QuillNewChannelButton } from './QuillNewChannelButton'
+import { QuillNewTemplateButton } from './QuillNewTemplateButton'
+
+export function QuillMessagingTabActions({
+ tab,
+ channelsUrl,
+}: {
+ tab: MessagingNavTabKey
+ channelsUrl: string
+}): JSX.Element | null {
+ // One component per action, so a tab mounts (and loads) only the logic its own button needs.
+ if (tab === 'library') {
+ return <QuillNewTemplateButton />
+ }
+ if (tab === 'channels') {
+ return <QuillNewChannelButton channelsUrl={channelsUrl} />
+ }
+ if (tab === 'opt-outs') {
+ return <QuillNewCategoryButton />
+ }
+ return null
+}
diff --git a/products/workflows/frontend/QuillNewCategoryButton.tsx b/products/workflows/frontend/QuillNewCategoryButton.tsx
new file mode 100644
index 000000000000..0bd80d1d3d53
--- /dev/null
+++ b/products/workflows/frontend/QuillNewCategoryButton.tsx
@@ -0,0 +1,17 @@
+import { useActions } from 'kea'
+
+import { IconPlus } from '@posthog/icons'
+import { Button } from '@posthog/quill'
+
+import { optOutCategoriesLogic } from './OptOuts/optOutCategoriesLogic'
+
+export function QuillNewCategoryButton(): JSX.Element {
+ const { openNewCategoryModal } = useActions(optOutCategoriesLogic)
+
+ return (
+ <Button data-attr="new-optout-category" variant="primary" onClick={() => openNewCategoryModal()}>
+ <IconPlus />
+ New category
+ </Button>
+ )
+}
diff --git a/products/workflows/frontend/QuillNewChannelButton.tsx b/products/workflows/frontend/QuillNewChannelButton.tsx
new file mode 100644
index 000000000000..a6c4c91c6e30
--- /dev/null
+++ b/products/workflows/frontend/QuillNewChannelButton.tsx
@@ -0,0 +1,68 @@
+import { useActions, useValues } from 'kea'
+
+import { IconApple, IconAndroid, IconLetter, IconPlus } from '@posthog/icons'
+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@posthog/quill'
+
+import api from 'lib/api'
+import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'
+import { FEATURE_FLAGS, TeamMembershipLevel } from 'lib/constants'
+import { integrationsLogic } from 'lib/integrations/integrationsLogic'
+import { IconSlack, IconTwilio } from 'lib/lemon-ui/icons'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+
+export function QuillNewChannelButton({ channelsUrl }: { channelsUrl: string }): JSX.Element {
+ const { featureFlags } = useValues(featureFlagLogic)
+ const { openSetupModal } = useActions(integrationsLogic)
+ const newChannelRestrictedReason = useRestrictedArea({
+ scope: RestrictionScope.Project,
+ minimumAccessLevel: TeamMembershipLevel.Admin,
+ })
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ data-attr="new-channel-button"
+ variant="primary"
+ disabledReason={newChannelRestrictedReason}
+ />
+ }
+ >
+ <IconPlus />
+ New channel
+ </DropdownMenuTrigger>
+ <DropdownMenuContent>
+ <DropdownMenuItem onClick={() => openSetupModal(undefined, 'email')}>
+ <IconLetter />
+ Email
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={() => {
+ // The Slack OAuth flow leaves the app, so this is a full page load.
+ window.location.href = api.integrations.authorizeUrl({ kind: 'slack', next: channelsUrl })
+ }}
+ >
+ <IconSlack />
+ Slack
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={() => openSetupModal(undefined, 'twilio')}>
+ <IconTwilio />
+ Twilio
+ </DropdownMenuItem>
+ {featureFlags[FEATURE_FLAGS.WORKFLOWS_PUSH_NOTIFICATIONS] && (
+ <>
+ <DropdownMenuItem onClick={() => openSetupModal(undefined, 'firebase')}>
+ <IconAndroid />
+ Firebase Cloud Messaging
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={() => openSetupModal(undefined, 'apns')}>
+ <IconApple />
+ Apple Push Notifications
+ </DropdownMenuItem>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/products/workflows/frontend/QuillNewTemplateButton.tsx b/products/workflows/frontend/QuillNewTemplateButton.tsx
new file mode 100644
index 000000000000..89a0cb706c4b
--- /dev/null
+++ b/products/workflows/frontend/QuillNewTemplateButton.tsx
@@ -0,0 +1,23 @@
+import { useActions } from 'kea'
+
+import { Button } from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { newTemplateAgentLogic } from './TemplateLibrary/newTemplateAgentLogic'
+
+export function QuillNewTemplateButton(): JSX.Element {
+ const { startNewTemplate } = useActions(newTemplateAgentLogic)
+ return (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Workflow}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <Button data-attr="new-message-button" onClick={startNewTemplate} variant="primary">
+ New template
+ </Button>
+ </AccessControlAction>
+ )
+}
diff --git a/products/workflows/frontend/TemplateLibrary/MessageTemplate.tsx b/products/workflows/frontend/TemplateLibrary/MessageTemplate.tsx
index dc32b6063e62..f5494845e0b0 100644
--- a/products/workflows/frontend/TemplateLibrary/MessageTemplate.tsx
+++ b/products/workflows/frontend/TemplateLibrary/MessageTemplate.tsx
@@ -37,6 +37,7 @@ import { MessageTemplateSceneLogicProps, messageTemplateSceneLogic } from './mes
import { messageTemplateTestSendLogic } from './messageTemplateTestSendLogic'
import { NewTemplateAgent } from './NewTemplateAgent'
import { newTemplateAgentLogic } from './newTemplateAgentLogic'
+import { QuillMessageTemplateActions } from './QuillMessageTemplateActions'
import { SendTestEmailModal } from './SendTestEmailModal'
import { NEW_TEMPLATE_AGENT_HEADLINES } from './templateAgentContext'
import { TransactionalEmailApiExample } from './TransactionalEmailApiExample'
@@ -85,6 +86,7 @@ export function MessageTemplate(props: MessageTemplateSceneLogicProps): JSX.Elem
isDiscardingDraft,
} = useValues(logic)
const transactionalEmailsEnabled = useFeatureFlag('WORKFLOWS_TRANSACTIONAL_EMAIL_API')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const showTransactional = transactionalEmailsEnabled && props.id !== 'new'
const { setIsSaveTemplateModalOpen } = useActions(emailTemplaterLogic)
@@ -215,34 +217,13 @@ export function MessageTemplate(props: MessageTemplateSceneLogicProps): JSX.Elem
) : undefined
}
actions={
- <>
- <LemonDivider vertical />
- <LemonButton
- data-attr="send-test-message-template"
- type="secondary"
- onClick={() => setSendTestEmailModalOpen(true)}
- disabledReason={!template.content.email?.subject ? 'Add a subject first' : undefined}
- size="small"
- >
- Send test
- </LemonButton>
- {templateChanged && !draftsEnabled && (
- <LemonButton
- data-attr="cancel-message-template"
- type="secondary"
- onClick={() => resetTemplate(originalTemplate)}
- size="small"
- >
- Discard changes
- </LemonButton>
- )}
- <LemonButton
- type="primary"
- htmlType="submit"
- form="template"
- onClick={submitTemplate}
- loading={isTemplateSubmitting || templateLoading}
- disabledReason={
+ todayRailNav ? (
+ <QuillMessageTemplateActions
+ isNew={props.id === 'new'}
+ sendTestDisabledReason={
+ !template.content.email?.subject ? 'Add a subject first' : undefined
+ }
+ saveDisabledReason={
draftsEnabled && isSavingDraft
? 'Saving your draft'
: draftsEnabled && !hasDraft && !hasUnsavedChanges
@@ -253,79 +234,133 @@ export function MessageTemplate(props: MessageTemplateSceneLogicProps): JSX.Elem
? 'Name is required'
: undefined
}
- size="small"
- sideAction={
- draftsEnabled
- ? {
- 'data-attr': 'message-template-draft-actions',
- 'aria-label': 'More draft actions',
- dropdown: {
- placement: 'bottom-end',
- overlay: (
- <LemonMenuOverlay
- items={[
- {
- label: 'Discard draft',
- icon: <IconTrash />,
- status: 'danger',
- onClick: discardDraft,
- disabledReason: !hasDraft
- ? 'There is no draft to discard'
- : isSavingDraft || isDiscardingDraft
- ? 'Wait for the draft to finish saving'
- : undefined,
- 'data-attr': 'message-template-discard-draft',
- },
- ]}
- />
- ),
- },
- }
- : undefined
- }
- >
- {props.id === 'new' ? 'Create' : draftsEnabled ? 'Publish' : 'Save'}
- </LemonButton>
- <More
- size="small"
- overlay={
- <>
- <LemonButton
- data-attr="save-as-new-template"
- fullWidth
- onClick={() => setIsSaveTemplateModalOpen(true)}
- >
- Save as new template
- </LemonButton>
- {props.id !== 'new' && (
- <>
- <LemonButton
- data-attr="duplicate-message-template"
- fullWidth
- onClick={duplicateTemplate}
- disabledReason={
- hasUnsavedChanges
- ? 'Save your changes before duplicating'
- : undefined
- }
- >
- Duplicate
- </LemonButton>
- <LemonDivider />
- <LemonButton
- data-attr="delete-message-template"
- status="danger"
- fullWidth
- onClick={deleteTemplate}
- >
- Delete
- </LemonButton>
- </>
- )}
- </>
+ duplicateDisabledReason={
+ templateChanged ? 'Save your changes before duplicating' : undefined
}
+ templateChanged={templateChanged && !draftsEnabled}
+ saving={isTemplateSubmitting || templateLoading}
+ onSendTest={() => setSendTestEmailModalOpen(true)}
+ onDiscard={() => resetTemplate(originalTemplate)}
+ onSave={submitTemplate}
+ onSaveAsNew={() => setIsSaveTemplateModalOpen(true)}
+ onDuplicate={duplicateTemplate}
+ onDelete={deleteTemplate}
/>
- </>
+ ) : (
+ <>
+ <LemonDivider vertical />
+ <LemonButton
+ data-attr="send-test-message-template"
+ type="secondary"
+ onClick={() => setSendTestEmailModalOpen(true)}
+ disabledReason={
+ !template.content.email?.subject ? 'Add a subject first' : undefined
+ }
+ size="small"
+ >
+ Send test
+ </LemonButton>
+ {templateChanged && !draftsEnabled && (
+ <LemonButton
+ data-attr="cancel-message-template"
+ type="secondary"
+ onClick={() => resetTemplate(originalTemplate)}
+ size="small"
+ >
+ Discard changes
+ </LemonButton>
+ )}
+ <LemonButton
+ type="primary"
+ htmlType="submit"
+ form="template"
+ onClick={submitTemplate}
+ loading={isTemplateSubmitting || templateLoading}
+ disabledReason={
+ draftsEnabled && isSavingDraft
+ ? 'Saving your draft'
+ : draftsEnabled && !hasDraft && !hasUnsavedChanges
+ ? 'No changes to publish'
+ : !draftsEnabled && !templateChanged && props.id !== 'new'
+ ? 'No changes to save'
+ : !template.name
+ ? 'Name is required'
+ : undefined
+ }
+ size="small"
+ sideAction={
+ draftsEnabled
+ ? {
+ 'data-attr': 'message-template-draft-actions',
+ 'aria-label': 'More draft actions',
+ dropdown: {
+ placement: 'bottom-end',
+ overlay: (
+ <LemonMenuOverlay
+ items={[
+ {
+ label: 'Discard draft',
+ icon: <IconTrash />,
+ status: 'danger',
+ onClick: discardDraft,
+ disabledReason: !hasDraft
+ ? 'There is no draft to discard'
+ : isSavingDraft || isDiscardingDraft
+ ? 'Wait for the draft to finish saving'
+ : undefined,
+ 'data-attr': 'message-template-discard-draft',
+ },
+ ]}
+ />
+ ),
+ },
+ }
+ : undefined
+ }
+ >
+ {props.id === 'new' ? 'Create' : draftsEnabled ? 'Publish' : 'Save'}
+ </LemonButton>
+ <More
+ size="small"
+ overlay={
+ <>
+ <LemonButton
+ data-attr="save-as-new-template"
+ fullWidth
+ onClick={() => setIsSaveTemplateModalOpen(true)}
+ >
+ Save as new template
+ </LemonButton>
+ {props.id !== 'new' && (
+ <>
+ <LemonButton
+ data-attr="duplicate-message-template"
+ fullWidth
+ onClick={duplicateTemplate}
+ disabledReason={
+ hasUnsavedChanges
+ ? 'Save your changes before duplicating'
+ : undefined
+ }
+ >
+ Duplicate
+ </LemonButton>
+ <LemonDivider />
+ <LemonButton
+ data-attr="delete-message-template"
+ status="danger"
+ fullWidth
+ onClick={deleteTemplate}
+ >
+ Delete
+ </LemonButton>
+ </>
+ )}
+ </>
+ }
+ />
+ </>
+ )
}
/>
diff --git a/products/workflows/frontend/TemplateLibrary/QuillMessageTemplateActions.tsx b/products/workflows/frontend/TemplateLibrary/QuillMessageTemplateActions.tsx
new file mode 100644
index 000000000000..70d2af8d047b
--- /dev/null
+++ b/products/workflows/frontend/TemplateLibrary/QuillMessageTemplateActions.tsx
@@ -0,0 +1,96 @@
+import { IconEllipsis } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+ Separator,
+} from '@posthog/quill'
+
+export function QuillMessageTemplateActions({
+ isNew,
+ sendTestDisabledReason,
+ saveDisabledReason,
+ duplicateDisabledReason,
+ templateChanged,
+ saving,
+ onSendTest,
+ onDiscard,
+ onSave,
+ onSaveAsNew,
+ onDuplicate,
+ onDelete,
+}: {
+ isNew: boolean
+ sendTestDisabledReason?: string
+ saveDisabledReason?: string
+ duplicateDisabledReason?: string
+ templateChanged: boolean
+ saving: boolean
+ onSendTest: () => void
+ onDiscard: () => void
+ onSave: () => void
+ onSaveAsNew: () => void
+ onDuplicate: () => void
+ onDelete: () => void
+}): JSX.Element {
+ return (
+ <>
+ <Separator orientation="vertical" />
+ <Button
+ data-attr="send-test-message-template"
+ variant="outline"
+ onClick={onSendTest}
+ disabledReason={sendTestDisabledReason}
+ >
+ Send test
+ </Button>
+ {templateChanged && (
+ <Button data-attr="cancel-message-template" variant="outline" onClick={onDiscard}>
+ Discard changes
+ </Button>
+ )}
+ <Button
+ variant="primary"
+ type="submit"
+ form="template"
+ onClick={onSave}
+ loading={saving}
+ disabledReason={saveDisabledReason}
+ >
+ {isNew ? 'Create' : 'Save'}
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger render={<Button size="icon" aria-label="More" tooltip="More" variant="default" />}>
+ <IconEllipsis />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem data-attr="save-as-new-template" onClick={onSaveAsNew}>
+ Save as new template
+ </DropdownMenuItem>
+ {!isNew && (
+ <>
+ <DropdownMenuItem
+ data-attr="duplicate-message-template"
+ disabledReason={duplicateDisabledReason}
+ onClick={onDuplicate}
+ >
+ Duplicate
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ data-attr="delete-message-template"
+ variant="destructive"
+ onClick={onDelete}
+ >
+ Delete
+ </DropdownMenuItem>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </>
+ )
+}
diff --git a/products/workflows/frontend/Workflows/QuillWorkflowSaveActions.tsx b/products/workflows/frontend/Workflows/QuillWorkflowSaveActions.tsx
new file mode 100644
index 000000000000..44fe9fe8c914
--- /dev/null
+++ b/products/workflows/frontend/Workflows/QuillWorkflowSaveActions.tsx
@@ -0,0 +1,165 @@
+import { IconChevronDown, IconTrash } from '@posthog/icons'
+import {
+ Button,
+ ButtonGroup,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { AccessControlAction } from 'lib/components/AccessControlAction'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+// Module-level so AccessControlAction sees a stable element type and reconciles instead of
+// remounting; an inline child would close the draft menu whenever autosave re-rendered the header.
+function PublishActions({
+ isPrimary,
+ draftActionPending,
+ publishDisabledReason,
+ discardDisabledReason,
+ disabledReason,
+ onPublish,
+ onDiscardDraft,
+}: {
+ isPrimary: boolean
+ draftActionPending: string | null
+ publishDisabledReason: string | null | undefined
+ discardDisabledReason: string | null | undefined
+ disabledReason?: string | null
+ onPublish: () => void
+ onDiscardDraft: () => void
+}): JSX.Element {
+ const variant = isPrimary ? 'primary' : 'outline'
+ return (
+ <ButtonGroup>
+ <Button
+ data-attr="workflow-publish"
+ variant={variant}
+ onClick={onPublish}
+ loading={draftActionPending === 'publish'}
+ disabledReason={publishDisabledReason ?? disabledReason}
+ >
+ Publish
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant={variant}
+ size="icon"
+ aria-label="More draft actions"
+ tooltip="More draft actions"
+ data-attr="workflow-draft-actions"
+ disabledReason={disabledReason}
+ />
+ }
+ >
+ <IconChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem
+ variant="destructive"
+ disabledReason={discardDisabledReason}
+ onClick={onDiscardDraft}
+ data-attr="workflow-discard-draft"
+ >
+ <IconTrash />
+ Discard draft
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </ButtonGroup>
+ )
+}
+
+export function QuillWorkflowSaveActions({
+ hasUnsavedChanges,
+ hasStagedDraft,
+ showDraftActions,
+ editTemplateId,
+ isWorkflowSubmitting,
+ draftActionPending,
+ saveDisabledReason,
+ publishDisabledReason,
+ discardDisabledReason,
+ saveLabel,
+ saveUserAccessLevel,
+ workflowUserAccessLevel,
+ onDiscardChanges,
+ onUpdateTemplate,
+ onSave,
+ onPublish,
+ onDiscardDraft,
+}: {
+ hasUnsavedChanges: boolean
+ hasStagedDraft: boolean
+ showDraftActions: boolean
+ editTemplateId: string | undefined
+ isWorkflowSubmitting: boolean
+ draftActionPending: string | null
+ saveDisabledReason: string | undefined
+ publishDisabledReason: string | null | undefined
+ discardDisabledReason: string | null | undefined
+ saveLabel: string
+ saveUserAccessLevel: AccessControlLevel | undefined
+ workflowUserAccessLevel: AccessControlLevel | undefined
+ onDiscardChanges: () => void
+ onUpdateTemplate: () => void
+ onSave: () => void
+ onPublish: () => void
+ onDiscardDraft: () => void
+}): JSX.Element {
+ const publishIsPrimary = hasStagedDraft && !hasUnsavedChanges
+ return (
+ <>
+ {hasUnsavedChanges && (
+ <Button data-attr="discard-workflow-changes" variant="outline" onClick={onDiscardChanges}>
+ Clear changes
+ </Button>
+ )}
+ {editTemplateId ? (
+ <Button variant="primary" onClick={onUpdateTemplate} loading={isWorkflowSubmitting}>
+ Update template
+ </Button>
+ ) : (
+ <>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Workflow}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={saveUserAccessLevel}
+ >
+ <Button
+ data-attr="workflow-save"
+ variant={publishIsPrimary ? 'outline' : 'primary'}
+ type="submit"
+ form="workflow"
+ onClick={onSave}
+ loading={isWorkflowSubmitting}
+ disabledReason={saveDisabledReason}
+ >
+ {saveLabel}
+ </Button>
+ </AccessControlAction>
+ {showDraftActions && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Workflow}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={workflowUserAccessLevel}
+ >
+ <PublishActions
+ isPrimary={publishIsPrimary}
+ draftActionPending={draftActionPending}
+ publishDisabledReason={publishDisabledReason}
+ discardDisabledReason={discardDisabledReason}
+ onPublish={onPublish}
+ onDiscardDraft={onDiscardDraft}
+ />
+ </AccessControlAction>
+ )}
+ </>
+ )}
+ </>
+ )
+}
diff --git a/products/workflows/frontend/Workflows/WorkflowSceneHeader.tsx b/products/workflows/frontend/Workflows/WorkflowSceneHeader.tsx
index 996e16593161..0dac99050343 100644
--- a/products/workflows/frontend/Workflows/WorkflowSceneHeader.tsx
+++ b/products/workflows/frontend/Workflows/WorkflowSceneHeader.tsx
@@ -4,10 +4,12 @@ import { useEffect, useRef, useState } from 'react'
import { IconArchive, IconClock, IconCopy, IconScreen, IconTrash, IconUpload } from '@posthog/icons'
import { LemonButton, LemonDivider } from '@posthog/lemon-ui'
+import { Button, Separator } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { SceneMenuBarFileItems } from 'lib/components/Scenes/SceneMenuBarFileItems'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonMenuOverlay } from 'lib/lemon-ui/LemonMenu/LemonMenu'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
@@ -24,6 +26,7 @@ import { ScenePanel, ScenePanelActionsSection, ScenePanelDivider } from '~/layou
import { AccessControlLevel, AccessControlResourceType } from '~/types'
import { HogFlowManualTriggerButton } from './hogflows/HogFlowManualTriggerButton'
+import { QuillWorkflowSaveActions } from './QuillWorkflowSaveActions'
import { workflowSuggestionsAvailabilityLogic } from './suggestions/workflowSuggestionsAvailabilityLogic'
import { WorkflowSuggestionsMenuItem } from './suggestions/WorkflowSuggestionsMenuItem'
import { WorkflowSuggestionsPanelToggle } from './suggestions/WorkflowSuggestionsPanelToggle'
@@ -69,6 +72,7 @@ export const WorkflowSceneHeader = (props: WorkflowSceneLogicProps = {}): JSX.El
const isManualWorkflow = ['manual', 'batch'].includes(workflow?.trigger?.type || '')
const { featureFlags } = useValues(featureFlagLogic)
const sceneMenuBarEnabled = !!featureFlags[FEATURE_FLAGS.SCENE_MENU_BAR]
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const { suggestionsAvailable } = useValues(workflowSuggestionsAvailabilityLogic)
const [displayStatus, setDisplayStatus] = useState(workflow?.status)
const [isTransitioning, setIsTransitioning] = useState(false)
@@ -224,31 +228,56 @@ export const WorkflowSceneHeader = (props: WorkflowSceneLogicProps = {}): JSX.El
minAccessLevel={AccessControlLevel.Editor}
userAccessLevel={workflowUserAccessLevel ?? undefined}
>
- <LemonButton
- type={displayStatus === 'active' ? 'primary' : 'secondary'}
- // Stays clickable when steps have errors: the attempt is what
- // reveals the per-field messages, and saveWorkflowPartial
- // guards the actual enable with a toast.
- onClick={() =>
- saveWorkflowPartial({
- status: workflow?.status === 'draft' ? 'active' : 'draft',
- })
- }
- size="small"
- disabledReason={hasUnsavedChanges ? 'Save changes first' : undefined}
- className="transition-colors duration-300 ease-in-out"
- data-attr="workflow-launch"
- >
- <span
- className={`inline-block transition-opacity duration-300 ease-in-out ${
- isTransitioning ? 'opacity-0' : 'opacity-100'
- }`}
+ {todayRailNav ? (
+ <Button
+ variant={displayStatus === 'active' ? 'primary' : 'outline'}
+ // Stays clickable when steps have errors: the attempt is what
+ // reveals the per-field messages, and saveWorkflowPartial
+ // guards the actual enable with a toast.
+ onClick={() =>
+ saveWorkflowPartial({
+ status: workflow?.status === 'draft' ? 'active' : 'draft',
+ })
+ }
+ disabledReason={hasUnsavedChanges ? 'Save changes first' : undefined}
+ className="transition-colors duration-300 ease-in-out"
+ data-attr="workflow-launch"
>
- {displayStatus === 'draft' ? 'Enable' : 'Disable'}
- </span>
- </LemonButton>
+ <span
+ className={`inline-block transition-opacity duration-300 ease-in-out ${
+ isTransitioning ? 'opacity-0' : 'opacity-100'
+ }`}
+ >
+ {displayStatus === 'draft' ? 'Enable' : 'Disable'}
+ </span>
+ </Button>
+ ) : (
+ <LemonButton
+ type={displayStatus === 'active' ? 'primary' : 'secondary'}
+ // Stays clickable when steps have errors: the attempt is what
+ // reveals the per-field messages, and saveWorkflowPartial
+ // guards the actual enable with a toast.
+ onClick={() =>
+ saveWorkflowPartial({
+ status: workflow?.status === 'draft' ? 'active' : 'draft',
+ })
+ }
+ size="small"
+ disabledReason={hasUnsavedChanges ? 'Save changes first' : undefined}
+ className="transition-colors duration-300 ease-in-out"
+ data-attr="workflow-launch"
+ >
+ <span
+ className={`inline-block transition-opacity duration-300 ease-in-out ${
+ isTransitioning ? 'opacity-0' : 'opacity-100'
+ }`}
+ >
+ {displayStatus === 'draft' ? 'Enable' : 'Disable'}
+ </span>
+ </LemonButton>
+ )}
</AccessControlAction>
- <LemonDivider vertical />
+ {todayRailNav ? <Separator orientation="vertical" /> : <LemonDivider vertical />}
<ScenePanel>
{suggestionsAvailable && (
<>
@@ -301,103 +330,145 @@ export const WorkflowSceneHeader = (props: WorkflowSceneLogicProps = {}): JSX.El
</ScenePanel>
</>
)}
- {hasUnsavedChanges && (
- <LemonButton
- data-attr="discard-workflow-changes"
- type="secondary"
- onClick={() => discardChanges()}
- size="small"
- >
- Clear changes
- </LemonButton>
- )}
- {editTemplateId ? (
- <LemonButton
- type="primary"
- size="small"
- onClick={showSaveAsTemplateModal}
- loading={isWorkflowSubmitting}
- >
- Update template
- </LemonButton>
+ {todayRailNav ? (
+ <QuillWorkflowSaveActions
+ hasUnsavedChanges={hasUnsavedChanges}
+ hasStagedDraft={hasStagedDraft}
+ showDraftActions={showDraftActions}
+ editTemplateId={editTemplateId}
+ isWorkflowSubmitting={isWorkflowSubmitting}
+ draftActionPending={draftActionPending}
+ saveDisabledReason={
+ workflowHasErrors
+ ? 'Some fields still need work'
+ : isCreatedFromTemplate || isCreatedFromLink
+ ? undefined
+ : hasUnsavedChanges
+ ? undefined
+ : 'No changes to save'
+ }
+ publishDisabledReason={publishDisabledReason}
+ discardDisabledReason={discardDisabledReason}
+ saveLabel={
+ props.id === 'new'
+ ? 'Create as draft'
+ : workflow?.status === 'active'
+ ? 'Save draft'
+ : 'Save'
+ }
+ saveUserAccessLevel={
+ props.id === 'new' ? undefined : (workflowUserAccessLevel ?? undefined)
+ }
+ workflowUserAccessLevel={workflowUserAccessLevel ?? undefined}
+ onDiscardChanges={() => discardChanges()}
+ onUpdateTemplate={showSaveAsTemplateModal}
+ onSave={submitWorkflow}
+ onPublish={() => publishDraft()}
+ onDiscardDraft={() => discardDraft()}
+ />
) : (
- // Both buttons hold a fixed slot for the whole edit. Auto-save used to
- // swap this group between "Save draft" and "Publish" every few seconds,
- // which moved a different action under a pointer that had not left the
- // button.
<>
- <AccessControlAction
- resourceType={AccessControlResourceType.Workflow}
- minAccessLevel={AccessControlLevel.Editor}
- userAccessLevel={
- props.id === 'new' ? undefined : (workflowUserAccessLevel ?? undefined)
- }
- >
+ {hasUnsavedChanges && (
<LemonButton
- data-attr="workflow-save"
- type={hasStagedDraft && !hasUnsavedChanges ? 'secondary' : 'primary'}
+ data-attr="discard-workflow-changes"
+ type="secondary"
+ onClick={() => discardChanges()}
size="small"
- htmlType="submit"
- form="workflow"
- onClick={submitWorkflow}
- loading={isWorkflowSubmitting}
- disabledReason={
- workflowHasErrors
- ? 'Some fields still need work'
- : isCreatedFromTemplate || isCreatedFromLink
- ? undefined
- : hasUnsavedChanges
- ? undefined
- : 'No changes to save'
- }
>
- {props.id === 'new'
- ? 'Create as draft'
- : workflow?.status === 'active'
- ? 'Save draft'
- : 'Save'}
+ Clear changes
</LemonButton>
- </AccessControlAction>
- {showDraftActions && (
- <AccessControlAction
- resourceType={AccessControlResourceType.Workflow}
- minAccessLevel={AccessControlLevel.Editor}
- userAccessLevel={workflowUserAccessLevel ?? undefined}
+ )}
+ {editTemplateId ? (
+ <LemonButton
+ type="primary"
+ size="small"
+ onClick={showSaveAsTemplateModal}
+ loading={isWorkflowSubmitting}
>
- <LemonButton
- data-attr="workflow-publish"
- type={hasStagedDraft && !hasUnsavedChanges ? 'primary' : 'secondary'}
- size="small"
- onClick={() => publishDraft()}
- loading={draftActionPending === 'publish'}
- disabledReason={publishDisabledReason}
- // Discarding is rare and destructive, so it sits in the
- // menu rather than next to the button a person aims for.
- sideAction={{
- 'data-attr': 'workflow-draft-actions',
- 'aria-label': 'More draft actions',
- dropdown: {
- placement: 'bottom-end',
- overlay: (
- <LemonMenuOverlay
- items={[
- {
- label: 'Discard draft',
- icon: <IconTrash />,
- status: 'danger',
- onClick: () => discardDraft(),
- disabledReason: discardDisabledReason,
- 'data-attr': 'workflow-discard-draft',
- },
- ]}
- />
- ),
- },
- }}
+ Update template
+ </LemonButton>
+ ) : (
+ // Both buttons hold a fixed slot for the whole edit. Auto-save used to
+ // swap this group between "Save draft" and "Publish" every few seconds,
+ // which moved a different action under a pointer that had not left the
+ // button.
+ <>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Workflow}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={
+ props.id === 'new' ? undefined : (workflowUserAccessLevel ?? undefined)
+ }
>
- Publish
- </LemonButton>
- </AccessControlAction>
+ <LemonButton
+ data-attr="workflow-save"
+ type={hasStagedDraft && !hasUnsavedChanges ? 'secondary' : 'primary'}
+ size="small"
+ htmlType="submit"
+ form="workflow"
+ onClick={submitWorkflow}
+ loading={isWorkflowSubmitting}
+ disabledReason={
+ workflowHasErrors
+ ? 'Some fields still need work'
+ : isCreatedFromTemplate || isCreatedFromLink
+ ? undefined
+ : hasUnsavedChanges
+ ? undefined
+ : 'No changes to save'
+ }
+ >
+ {props.id === 'new'
+ ? 'Create as draft'
+ : workflow?.status === 'active'
+ ? 'Save draft'
+ : 'Save'}
+ </LemonButton>
+ </AccessControlAction>
+ {showDraftActions && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Workflow}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={workflowUserAccessLevel ?? undefined}
+ >
+ <LemonButton
+ data-attr="workflow-publish"
+ type={
+ hasStagedDraft && !hasUnsavedChanges ? 'primary' : 'secondary'
+ }
+ size="small"
+ onClick={() => publishDraft()}
+ loading={draftActionPending === 'publish'}
+ disabledReason={publishDisabledReason}
+ // Discarding is rare and destructive, so it sits in the
+ // menu rather than next to the button a person aims for.
+ sideAction={{
+ 'data-attr': 'workflow-draft-actions',
+ 'aria-label': 'More draft actions',
+ dropdown: {
+ placement: 'bottom-end',
+ overlay: (
+ <LemonMenuOverlay
+ items={[
+ {
+ label: 'Discard draft',
+ icon: <IconTrash />,
+ status: 'danger',
+ onClick: () => discardDraft(),
+ disabledReason: discardDisabledReason,
+ 'data-attr': 'workflow-discard-draft',
+ },
+ ]}
+ />
+ ),
+ },
+ }}
+ >
+ Publish
+ </LemonButton>
+ </AccessControlAction>
+ )}
+ </>
)}
</>
)}
diff --git a/products/workflows/frontend/Workflows/hogflows/HogFlowManualTriggerButton.tsx b/products/workflows/frontend/Workflows/hogflows/HogFlowManualTriggerButton.tsx
index b1725219fb12..57c341e8e66d 100644
--- a/products/workflows/frontend/Workflows/hogflows/HogFlowManualTriggerButton.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/HogFlowManualTriggerButton.tsx
@@ -3,7 +3,9 @@ import { useActions, useValues } from 'kea'
import { IconPlayFilled } from '@posthog/icons'
import { IconChevronDown } from '@posthog/icons'
import { LemonButton, LemonInput, Popover } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { humanFriendlyNumber } from 'lib/utils/numbers'
@@ -160,8 +162,26 @@ export const HogFlowManualTriggerButton = (props: WorkflowLogicProps = {}): JSX.
const { workflow, hasUnsavedChanges } = useValues(workflowLogic(props))
const { popoverVisible } = useValues(logic)
const { setPopoverVisible } = useActions(logic)
-
- const triggerButton = (
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+
+ const triggerDisabledReason =
+ workflow?.status !== 'active'
+ ? 'Must enable workflow to use trigger'
+ : hasUnsavedChanges
+ ? 'Save changes first'
+ : undefined
+
+ const triggerButton = todayRailNav ? (
+ <Button
+ variant="primary"
+ disabledReason={triggerDisabledReason}
+ tooltip="Triggers workflow immediately"
+ onClick={() => setPopoverVisible(!popoverVisible)}
+ >
+ Trigger
+ <IconChevronDown className={`transition-transform ${popoverVisible ? 'rotate-180' : ''}`} />
+ </Button>
+ ) : (
<LemonButton
type="primary"
size="small"
diff --git a/products/workflows/frontend/WorkflowsScene.tsx b/products/workflows/frontend/WorkflowsScene.tsx
index b1f1be94c822..e9f4a2b3040c 100644
--- a/products/workflows/frontend/WorkflowsScene.tsx
+++ b/products/workflows/frontend/WorkflowsScene.tsx
@@ -2,6 +2,7 @@ import { MakeLogicType, actions, kea, path, props, reducers, selectors, useActio
import { router, urlToAction } from 'kea-router'
import { LemonButton } from '@posthog/lemon-ui'
+import { Button } from '@posthog/quill'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
@@ -189,6 +190,7 @@ export function WorkflowsScene(props: WorkflowsSceneProps = {}): JSX.Element {
const { setTypeFilter } = useActions(workflowTemplatesLogic)
const { filters } = useValues(workflowsLogic)
const showCalendar = useFeatureFlag('WORKFLOWS_SEND_CALENDAR')
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const workflowsTab = {
label: 'Workflows',
@@ -197,6 +199,16 @@ export function WorkflowsScene(props: WorkflowsSceneProps = {}): JSX.Element {
link: urls.workflows(),
}
const showsNewWorkflowButton = currentTab === 'workflows' || currentTab === 'templates' || currentTab === 'calendar'
+ const onNewWorkflow = (): void => {
+ void addProductIntent({
+ product_type: ProductKey.WORKFLOWS,
+ intent_context: ProductIntentContext.WORKFLOW_CREATED,
+ })
+ // Open the template chooser on the type the list shows, so a person on the
+ // Messaging tab sees messaging templates first.
+ setTypeFilter(currentTab === 'workflows' ? templateTypeForListType(filters.type) : 'all')
+ startNewWorkflow()
+ }
if (currentTab === 'onboarding') {
return (
@@ -221,25 +233,20 @@ export function WorkflowsScene(props: WorkflowsSceneProps = {}): JSX.Element {
resourceType={AccessControlResourceType.Workflow}
minAccessLevel={AccessControlLevel.Editor}
>
- <LemonButton
- data-attr="new-workflow"
- onClick={() => {
- void addProductIntent({
- product_type: ProductKey.WORKFLOWS,
- intent_context: ProductIntentContext.WORKFLOW_CREATED,
- })
- // Open the template chooser on the type the list shows, so a person on the
- // Messaging tab sees messaging templates first.
- setTypeFilter(
- currentTab === 'workflows' ? templateTypeForListType(filters.type) : 'all'
- )
- startNewWorkflow()
- }}
- type="primary"
- size="small"
- >
- New workflow
- </LemonButton>
+ {todayRailNav ? (
+ <Button data-attr="new-workflow" onClick={onNewWorkflow} variant="primary">
+ New workflow
+ </Button>
+ ) : (
+ <LemonButton
+ data-attr="new-workflow"
+ onClick={onNewWorkflow}
+ type="primary"
+ size="small"
+ >
+ New workflow
+ </LemonButton>
+ )}
</AccessControlAction>
)}
{currentTab !== 'workflows' && currentTab !== 'templates' && currentTab !== 'calendar' && (
diff --git a/products/workflows/package.json b/products/workflows/package.json
index 3e76fa6fd78c..8338cf9fa482 100644
--- a/products/workflows/package.json
+++ b/products/workflows/package.json
@@ -5,6 +5,7 @@
"backend:contract-check": "echo 'Contract files unchanged'"
},
"dependencies": {
+ "@posthog/quill": "workspace:*",
"@posthog/quill-charts": "workspace:*",
"@posthog/quill-components": "workspace:*",
"@posthog/quill-primitives": "workspace:*",