Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-warehouse): make "Coming soon" source tiles respond to a click (#108879)

Tom Owersbdc457e90e96
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/SourceCatalog.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/SourceCatalog.tsx
index 62872f1133a1..db5c4e8ea908 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/SourceCatalog.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/SourceCatalog.tsx
@@ -35,14 +35,17 @@ export interface SourceCatalogProps {
const SourceTile = memo(function SourceTile({
item,
accessDisabledReason,
+ interestRegistered,
onNotify,
onSelect,
}: {
item: CatalogItem
accessDisabledReason: string | null
+ interestRegistered: boolean
onNotify: (item: CatalogItem) => void
onSelect: (item: CatalogItem) => void
}): JSX.Element {
+ const comingSoon = item.status === 'coming_soon'
const content = (
<>
<div className="shrink-0">
@@ -50,18 +53,15 @@ const SourceTile = memo(function SourceTile({
</div>
<div className="flex flex-col items-start gap-2 min-w-0 text-left">
<div className="font-medium text-sm leading-tight line-clamp-2">{item.label}</div>
- {item.status === 'coming_soon' ? (
+ {comingSoon ? (
<>
<LemonTag type="warning">Coming soon</LemonTag>
- <LemonButton
- type="secondary"
- size="xsmall"
- icon={<IconMegaphone />}
- onClick={() => onNotify(item)}
- data-attr="catalog-notify-me"
+ <LemonTag
+ type={interestRegistered ? 'success' : 'primary'}
+ icon={interestRegistered ? undefined : <IconMegaphone />}
>
- Notify me
- </LemonButton>
+ {interestRegistered ? "We'll let you know" : 'Notify me'}
+ </LemonTag>
</>
) : (
<div className="flex flex-wrap items-center gap-1">
@@ -82,10 +82,26 @@ const SourceTile = memo(function SourceTile({
</>
)
- if (item.status === 'coming_soon') {
+ if (comingSoon) {
+ if (interestRegistered) {
+ return (
+ <Tooltip title="We'll let you know when this source launches.">
+ <div className={`${CATALOG_TILE_CLASS} cursor-default`}>{content}</div>
+ </Tooltip>
+ )
+ }
+ // A whole tile that only reacts on its small inner button reads as broken: people click
+ // the tile, nothing happens, and they move on without asking to be told about the source.
return (
- <Tooltip title="This source isn't available yet. Choose 'Notify me' and we'll let you know when it launches.">
- <div className={`${CATALOG_TILE_CLASS} cursor-default`}>{content}</div>
+ <Tooltip title="This source isn't available yet. Select it and we'll let you know when it launches.">
+ <button
+ type="button"
+ className={`${CATALOG_TILE_CLASS} hover:border-primary cursor-pointer`}
+ onClick={() => onNotify(item)}
+ data-attr="catalog-notify-me"
+ >
+ {content}
+ </button>
</Tooltip>
)
}
@@ -137,6 +153,7 @@ export function SourceCatalog({ allowedSources }: SourceCatalogProps): JSX.Eleme
search,
selectedCategory,
hasCrossCategoryMatches,
+ registeredInterestSources,
sourceRequestModalOpen,
sourceRequestText,
} = useValues(logic)
@@ -228,6 +245,7 @@ export function SourceCatalog({ allowedSources }: SourceCatalogProps): JSX.Eleme
key={item.name}
item={item}
accessDisabledReason={accessDisabledReason}
+ interestRegistered={registeredInterestSources.includes(item.name)}
onNotify={registerInterest}
onSelect={selectSourceType}
/>
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts
index c1a1bf5e4142..5e9d8387210b 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts
@@ -128,6 +128,7 @@ export interface sourceCatalogLogicValues {
categoriesWithCounts: CatalogCategory[]
filteredItems: CatalogItem[]
hasCrossCategoryMatches: boolean
+ registeredInterestSources: string[]
search: string
selectedCategory: SourceCategoryFilter
sourceRequestModalOpen: boolean
@@ -260,6 +261,14 @@ export const sourceCatalogLogic = kea<sourceCatalogLogicType>([
ALL_SOURCES_CATEGORY as SourceCategoryFilter,
{ setSelectedCategory: (_, { category }) => category },
],
+ // Which "Coming soon" tiles this visit already asked to be told about, so the tile can
+ // confirm it rather than offering the same action again.
+ registeredInterestSources: [
+ [] as string[],
+ {
+ registerInterest: (state, { item }) => (state.includes(item.name) ? state : [...state, item.name]),
+ },
+ ],
sourceRequestModalOpen: [
false,
{
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts
index 5ce7d22f4a8b..da03447aa0f7 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts
@@ -249,6 +249,18 @@ describe('sourceCatalogLogic', () => {
expect(byName.Mango.existingSource).toBeUndefined()
})
+ it('records which "Coming soon" sources the visit already asked about', () => {
+ const logic = sourceCatalogLogic()
+ const apple = logic.values.catalogItems.find((item) => item.name === 'Apple')!
+
+ logic.actions.registerInterest(apple)
+ logic.actions.registerInterest(apple)
+
+ // The tile swaps to a confirmation once it is in here, so a second entry would let the
+ // same source be registered twice.
+ expect(logic.values.registeredInterestSources).toEqual(['Apple'])
+ })
+
it('leaves the incoming webhook source out of a catalog restricted to warehouse sources', () => {
const logic = sourceCatalogLogic({ allowedSources: ['Stripe'] })
const unmountRestricted = logic.mount()