: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(workflows): give broadcasts the same scene header as workflows (#107842)
Daniel Marchuk3edc5a45dcf5
diff --git a/products/workflows/frontend/Broadcasts/BroadcastSceneHeader.tsx b/products/workflows/frontend/Broadcasts/BroadcastSceneHeader.tsxnew file mode 100644index 000000000000..b994bc336e6c--- /dev/null+++ b/products/workflows/frontend/Broadcasts/BroadcastSceneHeader.tsx@@ -0,0 +1,34 @@+import { useActions, useValues } from 'kea'++import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'++import { broadcastWizardLogic } from './broadcastWizardLogic'++export interface BroadcastSceneHeaderProps {+ /** Only a draft is renamed in place; a live broadcast shows its name read-only. */+ canEdit?: boolean+ nameSuffix?: React.ReactNode+ actions?: JSX.Element+}++/** The broadcast wizard and summary header, shaped like the workflow editor's. */+export function BroadcastSceneHeader({ canEdit = false, nameSuffix, actions }: BroadcastSceneHeaderProps): JSX.Element {+ const { name, broadcast, broadcastLoading } = useValues(broadcastWizardLogic)+ const { setName } = useActions(broadcastWizardLogic)++ return (+ <SceneTitleSection+ name={name}+ description={null}+ resourceType={{ type: 'broadcasts' }}+ canEdit={canEdit}+ // Each keystroke lands in the wizard's state, which Continue saves. A blur-save would reach it a tick+ // after a click on Continue, so that save would carry the old name.+ onNameChange={setName}+ renameDebounceMs={0}+ isLoading={broadcastLoading && !broadcast}+ nameSuffix={nameSuffix}+ actions={actions}+ />+ )+}diff --git a/products/workflows/frontend/Broadcasts/BroadcastSummary.tsx b/products/workflows/frontend/Broadcasts/BroadcastSummary.tsxindex 084b89a8d0d9..22b8d6fa70bc 100644--- a/products/workflows/frontend/Broadcasts/BroadcastSummary.tsx+++ b/products/workflows/frontend/Broadcasts/BroadcastSummary.tsx@@ -1,7 +1,7 @@import { BindLogic, useActions, useValues } from 'kea'import { useEffect } from 'react'-import { IconArrowLeft, IconChevronDown, IconLetter } from '@posthog/icons'+import { IconChevronDown, IconLetter } from '@posthog/icons'import {LemonBanner,LemonButton,@@ -19,7 +19,8 @@ import { LemonTable, LemonTableColumns } from 'lib/lemon-ui/LemonTable'import { LemonTabs } from 'lib/lemon-ui/LemonTabs'import { humanFriendlyNumber } from 'lib/utils/numbers'import { capitalizeFirstLetter } from 'lib/utils/strings'-import { urls } from 'scenes/urls'++import { SceneContent } from '~/layout/scenes/components/SceneContent'import type { HogFlowBatchJobApi } from 'products/workflows/frontend/generated/api.schemas'@@ -27,6 +28,7 @@ import { EmailViewerModal } from '../Workflows/EmailViewerModal'import type { MessageAsset } from '../Workflows/messageAssetsApi'import { BroadcastEmailPreview } from './BroadcastEmailPreview'import { BroadcastPerformance } from './BroadcastPerformance'+import { BroadcastSceneHeader } from './BroadcastSceneHeader'import { broadcastSentLogic } from './broadcastSentLogic'import { BroadcastStatusTag } from './BroadcastStatusTag'import { broadcastWizardLogic } from './broadcastWizardLogic'@@ -254,7 +256,6 @@ export function BroadcastSummary(): JSX.Element {const {broadcast,broadcastId,- name,audienceProperties,email,scheduleSummary,@@ -310,50 +311,45 @@ export function BroadcastSummary(): JSX.Element {},]- return (- <div className="@container min-h-full w-full shrink-0 bg-bg-light">- <div className="mx-auto max-w-6xl space-y-4 px-6 py-6">- <LemonButton type="tertiary" size="small" icon={<IconArrowLeft />} to={urls.broadcasts()}>- Broadcasts+ const actionsMenu =+ canMoveToDraft || canEditContent ? (+ <LemonMenu+ items={[+ canMoveToDraft+ ? {+ label: 'Stop and edit',+ onClick: confirmMoveToDraft,+ 'data-attr': 'broadcast-move-to-draft',+ }+ : null,+ canEditContent+ ? {+ label: 'Send again as a new broadcast',+ onClick: duplicateBroadcast,+ 'data-attr': 'broadcast-send-again',+ }+ : null,+ ]}+ >+ <LemonButton+ type="secondary"+ size="small"+ sideIcon={<IconChevronDown />}+ loading={movingToDraft || duplicating}+ data-attr="broadcast-actions"+ >+ Actions</LemonButton>+ </LemonMenu>+ ) : null- <div className="flex flex-wrap items-center justify-between gap-2">- <div className="flex min-w-0 items-center gap-2">- <BroadcastStatusTag status={summaryStatus} />- <h1 className="m-0 truncate text-2xl font-semibold">{name}</h1>- </div>- {canMoveToDraft || canEditContent ? (- <LemonMenu- items={[- canMoveToDraft- ? {- label: 'Stop and edit',- onClick: confirmMoveToDraft,- 'data-attr': 'broadcast-move-to-draft',- }- : null,- canEditContent- ? {- label: 'Send again as a new broadcast',- onClick: duplicateBroadcast,- 'data-attr': 'broadcast-send-again',- }- : null,- ]}- >- <LemonButton- type="secondary"- size="small"- sideIcon={<IconChevronDown />}- loading={movingToDraft || duplicating}- data-attr="broadcast-actions"- >- Actions- </LemonButton>- </LemonMenu>- ) : null}- </div>-+ return (+ <SceneContent className="@container min-h-full w-full shrink-0" data-attr="broadcast-summary">+ <BroadcastSceneHeader+ nameSuffix={<BroadcastStatusTag status={summaryStatus} />}+ actions={actionsMenu ?? undefined}+ />+ <div className="mx-auto w-full max-w-6xl space-y-4">{summaryStatus === 'failed' && !latestBatchJob && !batchJobsLoading ? (<LemonBannertype="warning"@@ -454,7 +450,7 @@ export function BroadcastSummary(): JSX.Element {]}/></div>- </div>+ </SceneContent>)}diff --git a/products/workflows/frontend/Broadcasts/BroadcastWizard.tsx b/products/workflows/frontend/Broadcasts/BroadcastWizard.tsxindex 080594a4c997..554115c11938 100644--- a/products/workflows/frontend/Broadcasts/BroadcastWizard.tsx+++ b/products/workflows/frontend/Broadcasts/BroadcastWizard.tsx@@ -1,11 +1,10 @@import { useActions, useValues } from 'kea'-import { IconArrowLeft } from '@posthog/icons'import { LemonButton } from '@posthog/lemon-ui'-import { EditableField } from 'lib/components/EditableField/EditableField'-import { urls } from 'scenes/urls'+import { SceneContent } from '~/layout/scenes/components/SceneContent'+import { BroadcastSceneHeader } from './BroadcastSceneHeader'import { broadcastWizardLogic } from './broadcastWizardLogic'import { BroadcastWizardStepper } from './BroadcastWizardStepper'import { BroadcastContentStep } from './steps/BroadcastContentStep'@@ -15,36 +14,15 @@ import { BroadcastReviewStep } from './steps/BroadcastReviewStep'import { BroadcastScheduleStep } from './steps/BroadcastScheduleStep'export function BroadcastWizard(): JSX.Element {- const { currentStep, name, stepValidationErrors, currentStepHasErrors, saving, launching, scheduleMode } =+ const { currentStep, stepValidationErrors, currentStepHasErrors, saving, launching, scheduleMode } =useValues(broadcastWizardLogic)- const { setStep, prevStep, continueStep, launchBroadcast, setName } = useActions(broadcastWizardLogic)+ const { setStep, prevStep, continueStep, launchBroadcast } = useActions(broadcastWizardLogic)return (- <div className="min-h-full w-full shrink-0 bg-bg-light">- <div className="mx-auto max-w-4xl space-y-5 px-6 py-6">+ <SceneContent className="min-h-full w-full shrink-0" data-attr="broadcast-wizard">+ <BroadcastSceneHeader canEdit />+ <div className="mx-auto w-full max-w-4xl space-y-5"><div className="space-y-3">- <div className="flex items-center justify-between">- <LemonButton type="tertiary" size="small" icon={<IconArrowLeft />} to={urls.broadcasts()}>- Broadcasts- </LemonButton>- </div>- <div>- <label htmlFor="broadcast-name" className="text-xs font-medium text-muted">- Broadcast name- </label>- <EditableField- name="broadcast-name"- value={name}- onSave={(value) => setName(value)}- placeholder="Untitled broadcast"- saveOnBlur- clickToEdit- compactIcon- showEditIconOnHover- className="text-xl font-semibold"- editingIndication="underlined"- />- </div><div className="flex justify-center"><BroadcastWizardSteppercurrentStep={currentStep}@@ -101,6 +79,6 @@ export function BroadcastWizard(): JSX.Element {</div></div></div>- </div>+ </SceneContent>)}diff --git a/products/workflows/frontend/Broadcasts/broadcastWizardLogic.ts b/products/workflows/frontend/Broadcasts/broadcastWizardLogic.tsindex 08be6cbf6f15..73315d702b3e 100644--- a/products/workflows/frontend/Broadcasts/broadcastWizardLogic.ts+++ b/products/workflows/frontend/Broadcasts/broadcastWizardLogic.ts@@ -937,15 +937,15 @@ export const broadcastWizardLogic = kea<broadcastWizardLogicType>([(s) => [s.name],(name: string): Breadcrumb[] => [{- key: Scene.Workflows,+ key: Scene.Broadcasts,name: 'Broadcasts',path: urls.broadcasts(),- iconType: 'workflows',+ iconType: 'broadcasts',},{key: [Scene.Broadcast, name],name,- iconType: 'workflows',+ iconType: 'broadcasts',},],],