Skip to content

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

feat(today): add rail more menu and status signals (#121114)

Adam Leith919f0dbb2681
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 77aaf7a9162d..4cfc399acbb3 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -3125,9 +3125,9 @@ snapshots:
errortracking-exceptioncard--exception-card-header-widths--light:
hash: v1.k794b7964.96ab37bc32797721d97410925e8c89bf739322a340ff8ee62dbd014a139a7f59.HCV39CI_4XqbwUW8QD8DDxSw_CeL5cui9smBv0MDeY0
errortracking-exceptioncard--exception-card-header-widths-with-action--dark:
- hash: v1.k794b7964.bc431c91e3d2c75733228cba7ea49100187653303d32b80972691c1bd2ab6fac.5G8_BH_wEQ7-bX_fxoUS_bpIhFYn-ntOg1O0QogN5_Y
+ hash: v1.k794b7964.d60b6c30df11ea8db911048b683c95a94da56ba29ad36666c989f736b1f7fe6a.RKiAmA3gA8sexgf7JhLUULw5pA__0jaA_wVyK7tGxog
errortracking-exceptioncard--exception-card-header-widths-with-action--light:
- hash: v1.k794b7964.1598db8976260f58899c06bc626c642404efefabadcb1f72c58e8274f9c2cc59.j9p2UZEipMzh2BffOz6M5OTKCy23BGagkTdlx4uYnCQ
+ hash: v1.k794b7964.9650843b412303bbff2ef7d25286a94c807e66da1a4ffcda88ffac8b652cd93c.3DKcz_9YM_m7DtCsMq3mRc0j0cHvVz-peRZfQccDH3E
errortracking-exceptioncard--exception-card-logs--dark:
hash: v1.k794b7964.9596d891ecde70954b0f85f1c026c58e481a74a6cfcb60b8be94e0dd01f4668c.otNvVYs8nJqXLqJdsYqhJPhduawyKMyUJpdGxxxBkGU
errortracking-exceptioncard--exception-card-logs--light:
@@ -4629,9 +4629,9 @@ snapshots:
lemon-ui-icons2--shelf-o--light:
hash: v1.k794b7964.76c14e4e35bff1ff494a2cebc91cd8cc4baa12f5fc5c069dd94e886ac9beb474.AN6c7L9lXRqc2nN3SUxch3np2OcoZlVFPS28moHjmVU
lemon-ui-icons2--shelf-p--dark:
- hash: v1.k794b7964.06736fe539d74737a210c19b4e6cd26a271b59819af0bb64463fd31ce54d208a.V2n-b5E0nFYb8_EwOpKsPzLtJz-Nrj-GVKFk-JYOjBw
+ hash: v1.k794b7964.0c82144cf9614e64373cbc3b6e47e414d299e656f833714b8b2245293eaf4dbd.JxTuJSpVeMJuEXlwD52za5mQgflASwoi6-OAdHYUluA
lemon-ui-icons2--shelf-p--light:
- hash: v1.k794b7964.eb63ff48968cf1f7a60f957fa2007a0607a0d917f14efec6e48586933d6d94c8.DSctX2ym2EsiONbQjHVZyT6lLl-MfAWfyBwhrOOYFWs
+ hash: v1.k794b7964.18b4c7ec802cdf571f093889b20090627df7679f65b3f1eb5ad440bfeeed135a.gjT8UrHRGGz35AFbCN9lb4mxYrOx2wNTtSSIp67WgeA
lemon-ui-icons2--shelf-q--dark:
hash: v1.k794b7964.5a9d82b6aafe0fe15ba59213f33bcc9a55ece2fdd1055a09c16372aabcec884e.7_SflSd_yazp-C7g7cd-cU1HTwid_0XLpMMIqsM1glo
lemon-ui-icons2--shelf-q--light:
@@ -9503,13 +9503,13 @@ snapshots:
scenes-app-analytics--list--light:
hash: v1.k794b7964.cd6ea9e9f102b227c4bf2b3d150bd0fe6d22af9d29e9775c494e7c46f26e2033.6heOc9kHxm9FZY3IhuvlS8HRFVmKpb72u_FRZKVmclo
scenes-app-analytics--list-empty--dark:
- hash: v1.k794b7964.28bfd4490da721f0114a434a3f57449d651102cbb9cb56878bf3ef818aed50c9.gOr9xh896lxRQATwFQmmZ0kg4crOi9CFv_TKIzvOi3A
+ hash: v1.k794b7964.7c39061eb8737ec9ba5b858ad3ffa9167688f7bdf3c3e5be524c87fc81f7daf4.4pPWDF6HSXEhVN0CubKXJVzgVI0lMVaJVX49tqlmU0M
scenes-app-analytics--list-empty--light:
- hash: v1.k794b7964.22917f5e149de11bdf6f8f0f82373728894c87dcdf3db671fd49c3992cdd7272.a-c53IBAsU-rm6qoe8TA8gqT2TCescnnMtAQgFEwg6s
+ hash: v1.k794b7964.453e73c8cd947371468b8098ebc80d189bd5e9be4f31b087fcfb153e80867a16.657NRSidr9i3Sx3DNGgzi3nNC8HnXpKZ0EwHzBzAYvg
scenes-app-analytics--list-error--dark:
- hash: v1.k794b7964.14951fce1ce32516cf3d955062d89986b51d3ee5e2934419cbbb1bc3cdf29d5c.hC88FXyKSisqae_EVmA1xyi2BFE2XsxD3QeEXmvxYCw
+ hash: v1.k794b7964.f37e14a447a6020a180dc6cd227183bc87f95ed19b4494685cc0b57703a84e27.81OcLdqCVIdFsTfomp7sYUM4ysNcl0xC0adsx2uTLlQ
scenes-app-analytics--list-error--light:
- hash: v1.k794b7964.30cd8d3591cbb659e54f76b9b88c33960630c7a59b750e66f39f22cf9cc557fd.DxB0chOBYh82mwR2a3f49VmRfQ21l7rkLRbedM-X6-g
+ hash: v1.k794b7964.3b77e8cfcf643e336919da33b6a12bcc2e9943eda7bbaac535f875a62cd94b07.4wktcNBCgjAQ7oaVK18hX6ofrRkeFN6g08ZdBdF-SUc
scenes-app-analytics--list-filtered--dark:
hash: v1.k794b7964.3556d39092c9e2f527f670bd582b9e46752108e0951f1fa81b8f81064443a713.lQ75EGzjymQdU4nch8GI1SS5vlg1LHnMY69q0NBJR3k
scenes-app-analytics--list-filtered--light:
@@ -16342,6 +16342,26 @@ snapshots:
hash: v1.k794b7964.4c1cd99854b96691ddb9e08ec324cccac42c1f98ee451adc2cafc240845100df.AolTmj-cZB22E17CR-MrJLtErCR7ZFqQIKpdK_hCngs
scenes-web-analytics-calendarheatmap--with-hidden-row-aggregation--light:
hash: v1.k794b7964.afd498e7ebdeb0ae332637bc81c11e42462d4e849279096bc98b32e0cd80a516.a801UVBIEm5FXhf9KT5H6yJS0fMpnWS9Fv3lBzmSbqs
+ scratch-today-support-panel--new-ticket--dark:
+ hash: v1.k794b7964.d141b9553008e3304c4cf334ad3a433dd6935ad04ddddfaf4e8cfa9a196ce47d._8oZWD1W6lB_O2jK5f-GPAirvU5yoIpkbCe48TTegRo
+ scratch-today-support-panel--new-ticket--light:
+ hash: v1.k794b7964.4c4d16312beabbac24c019194f53a366327e76daccdacfd9068325a583c0601a.W3NjqKAte2WxZLATe3SXv73PW8NlYEQIGaeQr-aGkRI
+ scratch-today-support-panel--open-ticket--dark:
+ hash: v1.k794b7964.d813991633e3c6041824f862a5fb3ac1493eaa1bbdb250bd2a3f0e2dec3ea099.jZ2XY7Ytrl-cdGn61mxNJwwtpN4zhIUJ9RMYz7dIu30
+ scratch-today-support-panel--open-ticket--light:
+ hash: v1.k794b7964.9055b86a77b383081575afc002eddcd5b56a4e6a8fac800c3f244388fa0be33a.PuA6dtMzS1n_luAB-0d2jWG04iS6sB7ipbLKM_9jeMA
+ scratch-today-support-panel--restore-tickets--dark:
+ hash: v1.k794b7964.175fd1328d8a681884cb14f0f9ba790a3fbd07dfdb118018f7b41febc0cdcd2b.MgHOdUolOIyAggfqpNBUrydk7oqcEhtGqRtX9X8RjHk
+ scratch-today-support-panel--restore-tickets--light:
+ hash: v1.k794b7964.a64af95520a7ee721ea87a81558e3f8fdbccf83bca7e293429114d7f8fb4912a.JupKN-vl7CFfJTSuqtSFtIuimiCe3kerawKA7Zcy8fo
+ scratch-today-support-panel--support-chat-unavailable--dark:
+ hash: v1.k794b7964.33aa18a6c363214d0be092d050a67280d0f032f56bc42b2ec9682bb4cd07a972.Rfx_240mJg71YbDrcD-8a9yAuOU7V242V04A2BvdT5Q
+ scratch-today-support-panel--support-chat-unavailable--light:
+ hash: v1.k794b7964.4a64d9ac04ced063f0d82ccb92b7df977ecae68b147df1b4077fbcd781acfb29.-pJbyzTGyUjnDy6uP5_lvklzejRs4y0K-cZ1uqrhXEo
+ scratch-today-support-panel--ticket-list--dark:
+ hash: v1.k794b7964.51faf34fea5a237000be7188f5ca8e29d7aad21f4f227e7d05b4525a935f2549.46op9RGnxn3yf37ARfHUzgYmOaxc4WT0B0BW2Eu9bK8
+ scratch-today-support-panel--ticket-list--light:
+ hash: v1.k794b7964.43812fb5e70e090e782ba635bc65858d264c83dd9643cbbf98f0a2e85c5ab940.zOiksyglgpVOUMP2_Rmg-nTNGdIe1g-UKEkWaxD_oV4
surveys-outcome-bar--nps--dark:
hash: v1.k794b7964.5027828bc67c5da7300c82814d299e9a0ab56b6a4330be00e8df4ba148fb1338.5lKlEhKPFFcZaK1jAHWXytfI3M5J62-MTIbiHE7y86s
surveys-outcome-bar--nps--light:
diff --git a/frontend/src/design.md b/frontend/src/design.md
index 6ca5e198d795..b44cccf4c23c 100644
--- a/frontend/src/design.md
+++ b/frontend/src/design.md
@@ -184,6 +184,7 @@ Use via Tailwind utilities (`bg-primary text-primary-foreground`, `border-border
- In-flight action: `loading`, not a separate spinner
- 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
+ - Indicator dot (unread, pending tasks): the Button `indicator` prop (`"default"`, or `"warning"` / `"destructive"` for a problem), never a hand-placed `span`. It sits on the top-right corner, outside the icon. Off the app background, set `--quill-button-indicator-ring` to the surface behind the button. Say what the dot means in the `aria-label`
- 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
@@ -231,6 +232,7 @@ Use via Tailwind utilities (`bg-primary text-primary-foreground`, `border-border
- Tooltip:
- Short label for an icon/control; never the only source of essential info (not shown on touch, not the accessible name)
- On icon-only buttons: `<TooltipTrigger delay={0}>`
+ - Text is left-aligned, never centered. For several lines, pass one `flex flex-col` child; `flex-col` on `TooltipContent` itself centers each line
- Every surface needs a root `<TooltipProvider>` (Quill setup); it makes adjacent tooltips open instantly once one is visible
- Add a local `<TooltipProvider>` only to change `delay`/`timeout` for a group (e.g. a toolbar); don't nest one per tooltip
- Popover: non-modal, click-triggered, interactive content anchored to a trigger
@@ -254,6 +256,7 @@ Use via Tailwind utilities (`bg-primary text-primary-foreground`, `border-border
- Badge: status or count. On a button: button `relative`, Badge `absolute top-0 right-0`; counts need an accessible label
- Chip: removable/selectable value (with ChipClose)
- Dot: presence/state beside a text label; `pulse` only for live state
+ - Menu items never carry a Dot; show a status in a menu row with a Badge
- Disclosure:
- Collapsible: single section
- Accordion: set of sections
diff --git a/frontend/src/layout/navigation/projectNoticeLogic.tsx b/frontend/src/layout/navigation/projectNoticeLogic.tsx
index 1d3d615752bb..d1db7149f73d 100644
--- a/frontend/src/layout/navigation/projectNoticeLogic.tsx
+++ b/frontend/src/layout/navigation/projectNoticeLogic.tsx
@@ -7,7 +7,6 @@ import { IconGear, IconPlus } from '@posthog/icons'
import api, { ApiError } from 'lib/api'
import { getProductPushDisplay } from 'lib/components/NavPanelAdvertisement/navPanelProductPushDisplay'
import { reverseProxyCheckerLogic } from 'lib/components/ReverseProxyChecker/reverseProxyCheckerLogic'
-import { superpowersLogic } from 'lib/components/Superpowers/superpowersLogic'
import { FEATURE_FLAGS } from 'lib/constants'
import { LemonBannerProps } from 'lib/lemon-ui/LemonBanner/LemonBanner'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
@@ -222,11 +221,11 @@ function buildBillingAlertNotice(
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface projectNoticeLogicValues {
+ effectiveBillingAlert: BillingAlertConfig | null // billingLogic
memberCount: number // membersLogic
currentOrganizationId: string // organizationLogic
hasReverseProxy: boolean | null // reverseProxyCheckerLogic
user: UserType | null // userLogic
- effectiveBillingAlert: BillingAlertConfig | null
noticeDismissedThisSession: boolean
postHogNoticeVariant: ProjectNoticeVariant | null
projectNotice: ProjectNoticeBlueprint | null
@@ -276,10 +275,6 @@ export interface projectNoticeLogicActions {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface projectNoticeLogicMeta {
__keaTypeGenInternalSelectorTypes: {
- effectiveBillingAlert: (
- billingAlert: BillingAlertConfig | null,
- fakeBillingAlert: import('lib/components/Superpowers/superpowersLogic').FakeBillingAlert
- ) => BillingAlertConfig | null
postHogNoticeVariant: (
currentOrganization: null | import('~/types').OrganizationType,
currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
@@ -352,6 +347,8 @@ export const projectNoticeLogic = kea<projectNoticeLogicType>([
['currentOrganizationId'],
userLogic,
['user'],
+ billingLogic,
+ ['effectiveBillingAlert'],
// Connecting reverseProxyCheckerLogic mounts it and exposes hasReverseProxy reactively.
// A self-managed (DIY) reverse proxy never appears in proxy_records, but it does stamp
// $lib_custom_api_host on events, which the checker detects — this keeps the "set up a
@@ -399,22 +396,6 @@ export const projectNoticeLogic = kea<projectNoticeLogicType>([
noticeDismissedThisSession: [false, { dismissProjectNotice: () => true }],
}),
selectors({
- effectiveBillingAlert: [
- () => [billingLogic.selectors.billingAlert, superpowersLogic.selectors.fakeBillingAlert],
- (
- billingAlert: BillingAlertConfig | null,
- fakeBillingAlert: import('lib/components/Superpowers/superpowersLogic').FakeBillingAlert
- ): BillingAlertConfig | null => {
- if (fakeBillingAlert !== 'none') {
- return {
- status: fakeBillingAlert,
- title: `Fake ${fakeBillingAlert} billing alert`,
- message: 'This is a fake billing alert triggered via Superpowers for testing purposes.',
- }
- }
- return billingAlert
- },
- ],
postHogNoticeVariant: [
(s) => [
organizationLogic.selectors.currentOrganization,
diff --git a/frontend/src/layout/today/TodayAccountMenu.tsx b/frontend/src/layout/today/TodayAccountMenu.tsx
index aefbc930979c..95f5bc5b3e53 100644
--- a/frontend/src/layout/today/TodayAccountMenu.tsx
+++ b/frontend/src/layout/today/TodayAccountMenu.tsx
@@ -13,14 +13,11 @@ import {
} from '@posthog/quill'
import { newAccountMenuLogic } from 'lib/components/Account/newAccountMenuLogic'
-import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture/ProfilePicture'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
-const linkItem = (to: string, disableClientSideRouting?: boolean): JSX.Element => (
- <Button size="row" left render={<LinkPrimitive to={to} disableClientSideRouting={disableClientSideRouting} />} />
-)
+import { todayMenuLinkItem } from './todayMenuLinkItem'
export function TodayAccountMenu(): JSX.Element {
const { user } = useValues(userLogic)
@@ -44,7 +41,7 @@ export function TodayAccountMenu(): JSX.Element {
/>
<DropdownMenuContent side="right" align="end" className="w-64">
<DropdownMenuItem
- render={linkItem(urls.settings(user?.organization?.id ? 'user' : 'user-danger-zone'))}
+ render={todayMenuLinkItem(urls.settings(user?.organization?.id ? 'user' : 'user-danger-zone'))}
className="h-auto"
data-attr="today-rail-user-settings"
>
@@ -59,33 +56,36 @@ export function TodayAccountMenu(): JSX.Element {
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuLabel>Staff</DropdownMenuLabel>
- <DropdownMenuItem render={linkItem('/admin/', true)} data-attr="today-rail-django-admin">
+ <DropdownMenuItem
+ render={todayMenuLinkItem('/admin/', { disableClientSideRouting: true })}
+ data-attr="today-rail-django-admin"
+ >
<IconShieldLock />
Django admin
</DropdownMenuItem>
<DropdownMenuItem
- render={linkItem(urls.instanceStatus())}
+ render={todayMenuLinkItem(urls.instanceStatus())}
data-attr="today-rail-instance-panel"
>
<IconServer />
Instance panel
</DropdownMenuItem>
<DropdownMenuItem
- render={linkItem(urls.featureFlagsStaffTools())}
+ render={todayMenuLinkItem(urls.featureFlagsStaffTools())}
data-attr="today-rail-flags-staff-tools"
>
<IconToggle />
Flags staff tools
</DropdownMenuItem>
<DropdownMenuItem
- render={linkItem(urls.cohortsStaffTools())}
+ render={todayMenuLinkItem(urls.cohortsStaffTools())}
data-attr="today-rail-cohorts-staff-tools"
>
<IconPeople />
Cohorts staff tools
</DropdownMenuItem>
<DropdownMenuItem
- render={linkItem(urls.experimentsStaffTools())}
+ render={todayMenuLinkItem(urls.experimentsStaffTools())}
data-attr="today-rail-experiments-staff-tools"
>
<IconDatabase />
diff --git a/frontend/src/layout/today/TodayMoreMenu.tsx b/frontend/src/layout/today/TodayMoreMenu.tsx
new file mode 100644
index 000000000000..d84c0867bd53
--- /dev/null
+++ b/frontend/src/layout/today/TodayMoreMenu.tsx
@@ -0,0 +1,83 @@
+import { useActions, useValues } from 'kea'
+
+import { IconEllipsis, IconExternal, IconWarning } from '@posthog/icons'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from '@posthog/quill'
+
+import { helpMenuLogic } from 'lib/components/HelpMenu/helpMenuLogic'
+import { posthogStatusLogic } from 'lib/components/HelpMenu/posthogStatusLogic'
+import { urls } from 'scenes/urls'
+
+import { todayMenuLinkItem } from './todayMenuLinkItem'
+import { SEVERITY_TEXT_CLASS } from './todayRailSeverity'
+import { todayRailStatusLogic } from './todayRailStatusLogic'
+import { TodayRailTile } from './TodayRailTile'
+
+/**
+ * The rail's "More" menu. The help menu shortcut opens it too.
+ * Its `data-attr`s are pinned: they match the classic help menu, so autocapture data stays continuous.
+ */
+export function TodayMoreMenu(): JSX.Element {
+ const { isHelpMenuOpen } = useValues(helpMenuLogic)
+ const { setHelpMenuOpen } = useActions(helpMenuLogic)
+ const { statusPageUrl } = useValues(posthogStatusLogic)
+ const { statusSeverity, statusText, healthText, moreSeverity, moreLabel } = useValues(todayRailStatusLogic)
+
+ return (
+ <DropdownMenu open={isHelpMenuOpen} onOpenChange={setHelpMenuOpen}>
+ <DropdownMenuTrigger
+ render={
+ <TodayRailTile
+ label="More"
+ icon={
+ statusSeverity === 'ok' ? (
+ <IconEllipsis />
+ ) : (
+ <IconWarning className={SEVERITY_TEXT_CLASS[statusSeverity]} />
+ )
+ }
+ active={isHelpMenuOpen}
+ dataAttr="help-menu-button"
+ severity={moreSeverity}
+ aria-label={moreLabel}
+ />
+ }
+ />
+ <DropdownMenuContent side="right" align="end" className="w-56">
+ <DropdownMenuItem
+ render={todayMenuLinkItem(statusPageUrl, { external: true })}
+ description={
+ statusText && <span className={SEVERITY_TEXT_CLASS[statusSeverity]}>{statusText}</span>
+ }
+ data-attr="more-menu-status-button"
+ >
+ Status page
+ <IconExternal data-icon="inline-end" className="ms-auto" />
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ render={todayMenuLinkItem(urls.health())}
+ description={healthText}
+ data-attr="more-menu-health-button"
+ >
+ Health
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ render={todayMenuLinkItem('https://posthog.com/changelog', { external: true })}
+ data-attr="more-menu-changelog-button"
+ >
+ Changelog
+ <IconExternal data-icon="inline-end" className="ms-auto" />
+ </DropdownMenuItem>
+ <DropdownMenuItem render={todayMenuLinkItem(urls.exports())} data-attr="more-menu-exports-button">
+ Exports
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/frontend/src/layout/today/TodayOrgMenu.tsx b/frontend/src/layout/today/TodayOrgMenu.tsx
index 6f6aac5a8d5a..32ee6af41c3f 100644
--- a/frontend/src/layout/today/TodayOrgMenu.tsx
+++ b/frontend/src/layout/today/TodayOrgMenu.tsx
@@ -4,12 +4,14 @@ import { IconGear, IconPlusSmall, IconReceipt } from '@posthog/icons'
import { Button } from '@posthog/quill'
import { newAccountMenuLogic } from 'lib/components/Account/newAccountMenuLogic'
-import { pendingInvitesLogic } from 'lib/components/Account/pendingInvitesLogic'
import { PendingInviteDot } from 'lib/components/Account/ProjectMenu'
+import { IconPersonAdd } from 'lib/lemon-ui/icons'
import { organizationLogic } from 'scenes/organizationLogic'
import { TodayLogo } from './TodayLogo'
import { OrgMenuActionKey, todayOrgMenuLogic } from './todayOrgMenuLogic'
+import { SEVERITY_INDICATOR, SEVERITY_TEXT_CLASS } from './todayRailSeverity'
+import { todayRailStatusLogic } from './todayRailStatusLogic'
import { TodaySwitcherMenu, TodaySwitcherRow } from './TodaySwitcherMenu'
// Invite IDs and org IDs are both UUIDs, so the prefix keeps their row values apart in one list.
@@ -17,7 +19,7 @@ const INVITE_PREFIX = 'invite:'
// pinned: autocapture data-attrs, kept from when this menu sat on the rail.
const ACTION_ROWS: Record<OrgMenuActionKey, Pick<TodaySwitcherRow, 'label' | 'leading' | 'dataAttr'>> = {
- 'invite-members': { label: 'Invite members', leading: <IconPlusSmall />, dataAttr: 'today-rail-invite-members' },
+ 'invite-members': { label: 'Invite members', leading: <IconPersonAdd />, dataAttr: 'today-rail-invite-members' },
billing: { label: 'Billing & usage', leading: <IconReceipt />, dataAttr: 'today-rail-billing' },
'org-settings': { label: 'Organization settings', leading: <IconGear />, dataAttr: 'today-rail-org-settings' },
'new-org': { label: 'New organization', leading: <IconPlusSmall />, dataAttr: 'today-rail-new-org' },
@@ -26,7 +28,7 @@ const ACTION_ROWS: Record<OrgMenuActionKey, Pick<TodaySwitcherRow, 'label' | 'le
/** The org switcher shortcut opens this menu too. */
export function TodayOrgMenu(): JSX.Element {
const { currentOrganization } = useValues(organizationLogic)
- const { pendingInvites } = useValues(pendingInvitesLogic)
+ const { orgSeverity, orgProblems, billingSeverity, billingText } = useValues(todayRailStatusLogic)
const { isOrgSwitcherOpen } = useValues(newAccountMenuLogic)
const { openOrgSwitcher, closeOrgSwitcher } = useActions(newAccountMenuLogic)
const { organizations, invites, orgMenuActions, orgSearchValue, isSwitchingOrganization } =
@@ -39,8 +41,9 @@ export function TodayOrgMenu(): JSX.Element {
trigger={
<Button
size="icon"
- aria-label={name}
- className="relative size-10 rounded-md data-[popup-open]:bg-[var(--fill-selected)]"
+ indicator={SEVERITY_INDICATOR[orgSeverity]}
+ aria-label={[name, ...orgProblems].join(', ')}
+ className="relative size-10 rounded-md [--quill-button-indicator-ring:var(--chrome)] data-[popup-open]:bg-[var(--fill-selected)]"
data-attr="today-rail-org-menu"
>
<TodayLogo
@@ -49,7 +52,6 @@ export function TodayOrgMenu(): JSX.Element {
colorSeed={currentOrganization?.id ?? null}
size="tile"
/>
- {pendingInvites.length > 0 && <PendingInviteDot className="absolute top-1 right-1" />}
</Button>
}
triggerTooltip={name}
@@ -96,6 +98,10 @@ export function TodayOrgMenu(): JSX.Element {
actions={orgMenuActions.map((key) => ({
value: key,
...ACTION_ROWS[key],
+ description:
+ key === 'billing' && billingText ? (
+ <span className={SEVERITY_TEXT_CLASS[billingSeverity]}>{billingText}</span>
+ ) : undefined,
onSelect: () => runOrgMenuAction(key),
}))}
selectedValue={currentOrganization?.id ?? null}
diff --git a/frontend/src/layout/today/TodayProjectMenu.tsx b/frontend/src/layout/today/TodayProjectMenu.tsx
index 09fcc58883d5..0d54b7c856bd 100644
--- a/frontend/src/layout/today/TodayProjectMenu.tsx
+++ b/frontend/src/layout/today/TodayProjectMenu.tsx
@@ -1,6 +1,6 @@
import { useActions, useValues } from 'kea'
-import { IconChevronDown, IconGear, IconPlusSmall } from '@posthog/icons'
+import { IconGear, IconPlusSmall } from '@posthog/icons'
import { Button } from '@posthog/quill'
import { newAccountMenuLogic } from 'lib/components/Account/newAccountMenuLogic'
@@ -46,7 +46,6 @@ export function TodayProjectMenu(): JSX.Element {
/>
)}
<span className="max-w-48 min-w-0 truncate">{currentTeam?.name ?? 'Select project'}</span>
- <IconChevronDown className="size-3 shrink-0 text-muted-foreground" />
</Button>
}
open={isProjectSwitcherOpen}
diff --git a/frontend/src/layout/today/TodayRail.tsx b/frontend/src/layout/today/TodayRail.tsx
index ade49e99d7c2..271d3bf330ca 100644
--- a/frontend/src/layout/today/TodayRail.tsx
+++ b/frontend/src/layout/today/TodayRail.tsx
@@ -1,6 +1,7 @@
import { useActions, useValues } from 'kea'
import { TodayAccountMenu } from './TodayAccountMenu'
+import { TodayMoreMenu } from './TodayMoreMenu'
import { TODAY_PANES, TODAY_RAIL_FOOTER_PANES, TODAY_RAIL_PANES } from './todayRailItems'
import { TodayRailTile } from './TodayRailTile'
import { TODAY_RAIL_WIDTH, TodayRailPane, railPaneHref, todayShellLogic } from './todayShellLogic'
@@ -33,6 +34,7 @@ export function TodayRail(): JSX.Element {
>
{TODAY_RAIL_PANES.map(renderTile)}
<div className="mt-auto flex w-full flex-col items-center gap-3">
+ <TodayMoreMenu />
{TODAY_RAIL_FOOTER_PANES.map(renderTile)}
</div>
<TodayAccountMenu />
diff --git a/frontend/src/layout/today/TodayRailTile.tsx b/frontend/src/layout/today/TodayRailTile.tsx
index 4a07b4d9cc4d..26fbc64cc780 100644
--- a/frontend/src/layout/today/TodayRailTile.tsx
+++ b/frontend/src/layout/today/TodayRailTile.tsx
@@ -1,28 +1,51 @@
+import { forwardRef } from 'react'
+
import { cn } from '@posthog/quill'
import { LinkPrimitive } from 'lib/lemon-ui/Link'
-export interface TodayRailTileProps {
+import { SEVERITY_INDICATOR, TodayRailSeverity } from './todayRailSeverity'
+
+// The frontend's Tailwind has no quill status fills, so the dot reads the quill variables directly.
+const DOT_CLASS = {
+ default: 'bg-[var(--primary)]',
+ warning: 'bg-[var(--warning-foreground)]',
+ destructive: 'bg-[var(--destructive-foreground)]',
+} as const
+
+export interface TodayRailTileProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onClick'> {
label: string
icon: JSX.Element
active: boolean
- to: string | undefined
- onClick: () => void
+ /** Without a destination the tile renders a button, so it can trigger a menu. */
+ to?: string
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void
dataAttr: string
+ severity?: TodayRailSeverity
}
-export function TodayRailTile({ label, icon, active, to, onClick, dataAttr }: TodayRailTileProps): JSX.Element {
+export const TodayRailTile = forwardRef<HTMLElement, TodayRailTileProps>(function TodayRailTile(
+ { label, icon, active, to, onClick, dataAttr, severity = 'none', ...props },
+ ref
+): JSX.Element {
+ const indicator = SEVERITY_INDICATOR[severity]
return (
<LinkPrimitive
- to={to}
+ ref={ref}
aria-label={label}
- aria-current={active ? 'page' : undefined}
+ {...props}
+ to={to}
+ aria-current={to && active ? 'page' : undefined}
data-attr={dataAttr}
- onClick={(event) => {
- // Cmd/ctrl and middle clicks never reach here, so the browser still opens those in a new tab.
- event.preventDefault()
- onClick()
- }}
+ onClick={
+ to
+ ? (event) => {
+ // Cmd/ctrl and middle clicks never reach here, so the browser still opens those in a new tab.
+ event.preventDefault()
+ onClick?.(event)
+ }
+ : onClick
+ }
className={cn(
'group flex w-full shrink-0 cursor-pointer flex-col items-center gap-1 outline-none hover:text-foreground',
active ? 'text-foreground' : 'text-muted-foreground'
@@ -30,14 +53,23 @@ export function TodayRailTile({ label, icon, active, to, onClick, dataAttr }: To
>
<span
className={cn(
- 'flex size-10 items-center justify-center rounded-md [&_svg]:size-5',
+ 'relative flex size-10 items-center justify-center rounded-md [&_svg]:size-5',
'group-focus-visible:ring-2 group-focus-visible:ring-[var(--ring)]',
active ? 'bg-[var(--fill-selected)]' : 'group-hover:bg-[var(--fill-hover)]'
)}
>
{icon}
+ {indicator && (
+ <span
+ aria-hidden
+ className={cn(
+ 'absolute -top-0.5 -end-0.5 size-2 rounded-full ring-2 ring-[var(--chrome)]',
+ DOT_CLASS[indicator]
+ )}
+ />
+ )}
</span>
<span className="max-w-full truncate px-0.5 text-[10px] leading-3 font-medium">{label}</span>
</LinkPrimitive>
)
-}
+})
diff --git a/frontend/src/layout/today/TodaySupportPanel.stories.tsx b/frontend/src/layout/today/TodaySupportPanel.stories.tsx
new file mode 100644
index 000000000000..8c45f9273c7e
--- /dev/null
+++ b/frontend/src/layout/today/TodaySupportPanel.stories.tsx
@@ -0,0 +1,152 @@
+import { Meta, StoryObj } from '@storybook/react'
+import { useActions } from 'kea'
+import posthog from 'posthog-js'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
+
+import { mswDecorator } from '~/mocks/browser'
+import preflightJson from '~/mocks/fixtures/_preflight.json'
+
+import { sidepanelTicketsLogic } from 'products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic'
+import type { ConversationMessage, ConversationTicket, SidePanelViewState } from 'products/conversations/frontend/types'
+
+import { TodaySupportPanel } from './TodaySupportPanel'
+
+// SCRATCH: local preview of the quill ticket UI, not for commit.
+
+const TICKETS: ConversationTicket[] = [
+ {
+ id: 't-1',
+ ticket_number: 1042,
+ status: 'open',
+ last_message: 'Thanks, that fixed the funnel. One more question about breakdowns though.',
+ last_message_at: '2025-10-10T09:12:00Z',
+ message_count: 4,
+ created_at: '2025-10-09T15:00:00Z',
+ unread_count: 2,
+ },
+ {
+ id: 't-2',
+ ticket_number: 1037,
+ status: 'pending',
+ last_message: 'We are looking into why the session replay is missing network requests.',
+ last_message_at: '2025-10-08T11:30:00Z',
+ message_count: 3,
+ created_at: '2025-10-07T10:00:00Z',
+ unread_count: 0,
+ },
+ {
+ id: 't-3',
+ ticket_number: 1001,
+ status: 'resolved',
+ last_message: 'Glad that worked. Closing this one out.',
+ last_message_at: '2025-09-20T16:45:00Z',
+ message_count: 6,
+ created_at: '2025-09-18T08:00:00Z',
+ unread_count: 0,
+ },
+]
+
+const MESSAGES: ConversationMessage[] = [
+ {
+ id: 'm-1',
+ content: 'My funnel shows 0% conversion on step 2 since yesterday. Nothing changed on our side.',
+ author_type: 'customer',
+ author_name: 'You',
+ created_at: '2025-10-09T15:00:00Z',
+ is_private: false,
+ },
+ {
+ id: 'm-2',
+ content:
+ 'Thanks for the report. Step 2 filters on `$current_url` with an exact match, and your URLs now carry a trailing slash. Try "contains" instead.',
+ author_type: 'human',
+ author_name: 'Support engineer',
+ created_at: '2025-10-09T16:20:00Z',
+ is_private: false,
+ },
+ {
+ id: 'm-3',
+ content: 'Thanks, that fixed the funnel.',
+ author_type: 'customer',
+ author_name: 'You',
+ created_at: '2025-10-10T09:10:00Z',
+ is_private: false,
+ },
+ {
+ id: 'm-4',
+ content: 'One more question about breakdowns though: can I break down by a cohort?',
+ author_type: 'customer',
+ author_name: 'You',
+ created_at: '2025-10-10T09:12:00Z',
+ is_private: false,
+ },
+]
+
+const fakeConversations = {
+ isAvailable: () => true,
+ getTickets: async () => ({ results: TICKETS, has_more: false }),
+ getMessages: async () => ({ messages: MESSAGES, has_more: false }),
+ markAsRead: async () => undefined,
+ sendMessage: async () => null,
+ requestRestoreLink: async () => undefined,
+}
+
+function installFakeConversations(available: boolean): void {
+ Object.defineProperty(posthog, 'conversations', {
+ value: { ...fakeConversations, isAvailable: () => available },
+ configurable: true,
+ writable: true,
+ })
+}
+
+type StoryArgs = { view: SidePanelViewState; unavailable?: boolean }
+
+function Panel({ view }: Pick<StoryArgs, 'view'>): JSX.Element {
+ const { setView, setCurrentTicket, setStatusFilter } = useActions(sidepanelTicketsLogic)
+ useOnMountEffect(() => {
+ if (view === 'ticket') {
+ setCurrentTicket(TICKETS[0])
+ } else if (view === 'list') {
+ setStatusFilter('all')
+ } else {
+ setView(view)
+ }
+ })
+ return (
+ <div className="flex h-[900px] w-[420px] flex-col border border-border bg-surface-primary">
+ <TodaySupportPanel />
+ </div>
+ )
+}
+
+const meta: Meta<StoryArgs> = {
+ title: 'Scratch/Today support panel',
+ parameters: {
+ layout: 'padded',
+ mockDate: '2025-10-10T12:00:00Z',
+ featureFlags: [FEATURE_FLAGS.TODAY_RAIL_NAV],
+ },
+ render: (args) => <Panel {...args} />,
+ decorators: [
+ (Story, { args }) => {
+ installFakeConversations(!args.unavailable)
+ return <Story />
+ },
+ mswDecorator({
+ get: {
+ '/_preflight': { ...preflightJson, cloud: true, realm: 'cloud' },
+ },
+ }),
+ ],
+}
+export default meta
+
+type Story = StoryObj<StoryArgs>
+
+export const TicketList: Story = { args: { view: 'list' } }
+export const OpenTicket: Story = { args: { view: 'ticket' } }
+export const NewTicket: Story = { args: { view: 'new' } }
+export const RestoreTickets: Story = { args: { view: 'restore' } }
+export const SupportChatUnavailable: Story = { args: { view: 'list', unavailable: true } }
diff --git a/frontend/src/layout/today/TodaySwitcherMenu.tsx b/frontend/src/layout/today/TodaySwitcherMenu.tsx
index 34eb6d1a34c9..5d7b6a635f26 100644
--- a/frontend/src/layout/today/TodaySwitcherMenu.tsx
+++ b/frontend/src/layout/today/TodaySwitcherMenu.tsx
@@ -29,6 +29,8 @@ export interface TodaySwitcherRow {
label: string
leading?: React.ReactNode
trailing?: React.ReactNode
+ /** A muted second line under the label. */
+ description?: React.ReactNode
dataAttr: string
/** Disables the row and says why. */
disabledReason?: string | null
@@ -170,6 +172,7 @@ export function TodaySwitcherMenu({
value={value}
action={group.value === null}
disabledReason={row.disabledReason}
+ description={row.description}
data-attr={row.dataAttr}
>
{row.leading}
diff --git a/frontend/src/layout/today/TodayTopBar.tsx b/frontend/src/layout/today/TodayTopBar.tsx
index 3036c4d77dae..099816257752 100644
--- a/frontend/src/layout/today/TodayTopBar.tsx
+++ b/frontend/src/layout/today/TodayTopBar.tsx
@@ -17,17 +17,15 @@ export function TodayTopBar(): JSX.Element {
<div className="flex translate-y-1 justify-center">
<TodayOrgMenu />
</div>
- <div className="flex min-w-0 items-center">
+ <div className="flex min-w-0 items-center gap-0.5">
<TodayProjectMenu />
+ <TodayTopBarQuickStartButton />
</div>
<div className="mx-2 min-w-0">
<TodayTopBarSearch />
</div>
- <div className="flex min-w-0 items-center gap-2">
- <TodayTopBarQuickStartButton />
- <div className="ms-auto">
- <TodayTopBarPanelTabs />
- </div>
+ <div className="flex min-w-0 items-center justify-end">
+ <TodayTopBarPanelTabs />
</div>
</header>
)
diff --git a/frontend/src/layout/today/TodayTopBarQuickStartButton.tsx b/frontend/src/layout/today/TodayTopBarQuickStartButton.tsx
index 9cfdddf3bb99..77ee1c40aa6d 100644
--- a/frontend/src/layout/today/TodayTopBarQuickStartButton.tsx
+++ b/frontend/src/layout/today/TodayTopBarQuickStartButton.tsx
@@ -1,5 +1,5 @@
import { IconTarget } from '@posthog/icons'
-import { Badge, Button } from '@posthog/quill'
+import { Button } from '@posthog/quill'
import { ProductSetupPopover } from 'lib/components/ProductSetup'
import { useProductSetupButton } from 'lib/components/ProductSetup/useProductSetupButton'
@@ -11,7 +11,6 @@ export function TodayTopBarQuickStartButton(): JSX.Element | null {
isOpen,
isDismissed,
remainingCount,
- shouldShowSetup,
toggle,
close,
setSelectedProduct,
@@ -21,9 +20,8 @@ export function TodayTopBarQuickStartButton(): JSX.Element | null {
return null
}
- const minimized = isDismissed && !isOpen
- // The count stays while the guide is open, so the trigger does not change shape under the pointer.
- const showCount = (shouldShowSetup || minimized) && remainingCount > 0
+ const hasTasksLeft = remainingCount > 0
+ const tasksLeft = `${remainingCount} ${remainingCount === 1 ? 'task' : 'tasks'} left`
return (
<ProductSetupPopover
@@ -34,21 +32,28 @@ export function TodayTopBarQuickStartButton(): JSX.Element | null {
>
<Button
variant="outline"
- size={minimized ? 'icon' : 'default'}
- aria-label={minimized ? 'Quick start' : undefined}
+ size="icon"
+ indicator={hasTasksLeft ? 'default' : undefined}
+ aria-label={hasTasksLeft ? `Quick start, ${tasksLeft}` : 'Quick start'}
aria-pressed={isOpen}
- className="shrink-0 aria-pressed:bg-[var(--fill-selected)]"
+ // The menu covers the tooltip, so the tooltip stays off while the menu is open.
+ tooltip={
+ isOpen ? null : (
+ <div className="flex flex-col gap-0.5">
+ <span className="font-medium">Quick start</span>
+ <span>A checklist of tasks to set up PostHog.</span>
+ {hasTasksLeft && <span>{tasksLeft}</span>}
+ </div>
+ )
+ }
+ className="shrink-0 [--quill-button-indicator-ring:var(--chrome)] aria-pressed:bg-[var(--fill-selected)]"
onClick={toggle}
// pinned: autocapture data-attr shared with the title-row trigger
- data-attr={minimized ? 'global-product-setup-button-minimized' : 'global-product-setup-button'}
+ data-attr={
+ isDismissed && !isOpen ? 'global-product-setup-button-minimized' : 'global-product-setup-button'
+ }
>
<IconTarget />
- {!minimized && 'Quick start'}
- {showCount && (
- <Badge variant="warning" translate="no">
- {remainingCount}
- </Badge>
- )}
</Button>
</ProductSetupPopover>
)
diff --git a/frontend/src/layout/today/todayMenuLinkItem.tsx b/frontend/src/layout/today/todayMenuLinkItem.tsx
new file mode 100644
index 000000000000..b39043d3a402
--- /dev/null
+++ b/frontend/src/layout/today/todayMenuLinkItem.tsx
@@ -0,0 +1,25 @@
+import { Button } from '@posthog/quill'
+
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+
+export interface TodayMenuLinkItemOptions {
+ external?: boolean
+ /** Loads the page fresh, for routes outside the app router such as Django admin. */
+ disableClientSideRouting?: boolean
+}
+
+export function todayMenuLinkItem(to: string, options: TodayMenuLinkItemOptions = {}): JSX.Element {
+ return (
+ <Button
+ size="row"
+ left
+ render={
+ <LinkPrimitive
+ to={to}
+ target={options.external ? '_blank' : undefined}
+ disableClientSideRouting={options.disableClientSideRouting}
+ />
+ }
+ />
+ )
+}
diff --git a/frontend/src/layout/today/todayRailSeverity.test.ts b/frontend/src/layout/today/todayRailSeverity.test.ts
new file mode 100644
index 000000000000..186f712168db
--- /dev/null
+++ b/frontend/src/layout/today/todayRailSeverity.test.ts
@@ -0,0 +1,23 @@
+import type { BillingAlertConfig } from 'scenes/billing/billingLogic'
+
+import { TodayRailSeverity, severityFromBillingAlert, worstSeverity } from './todayRailSeverity'
+
+describe('todayRailSeverity', () => {
+ test.each<[string, BillingAlertConfig | null, TodayRailSeverity]>([
+ ['no alert', null, 'none'],
+ ['usage limit reached', { kind: 'usage_limit', status: 'error', title: '' }, 'critical'],
+ ['organization suspended', { kind: 'deactivated', status: 'error', title: '' }, 'critical'],
+ ['usage limit approaching', { kind: 'usage_limit', status: 'info', title: '' }, 'warning'],
+ ['trial ending', { kind: 'trial', status: 'info', title: '' }, 'none'],
+ ])('rates a billing alert for %s', (_name, alert, expected) => {
+ expect(severityFromBillingAlert(alert)).toEqual(expected)
+ })
+
+ test.each<[TodayRailSeverity[], TodayRailSeverity]>([
+ [['ok', 'warning'], 'warning'],
+ [['critical', 'notice'], 'critical'],
+ [['none', 'notice'], 'notice'],
+ ])('picks the worst of %j', (severities, expected) => {
+ expect(worstSeverity(...severities)).toEqual(expected)
+ })
+})
diff --git a/frontend/src/layout/today/todayRailSeverity.ts b/frontend/src/layout/today/todayRailSeverity.ts
new file mode 100644
index 000000000000..5df2e0964dd8
--- /dev/null
+++ b/frontend/src/layout/today/todayRailSeverity.ts
@@ -0,0 +1,49 @@
+import type { BillingAlertConfig } from 'scenes/billing/billingLogic'
+
+/**
+ * How much a rail signal needs attention. `ok` is a healthy reading worth showing in green,
+ * `none` is nothing to show, and `notice` is news rather than a problem.
+ */
+export type TodayRailSeverity = 'none' | 'ok' | 'notice' | 'warning' | 'critical'
+
+export type TodayBadgeStatus = 'success' | 'warning' | 'danger'
+
+const RANK: Record<TodayRailSeverity, number> = { none: 0, ok: 0, notice: 1, warning: 2, critical: 3 }
+
+export const SEVERITY_TEXT_CLASS: Record<TodayRailSeverity, string> = {
+ none: 'text-muted-foreground',
+ ok: 'text-success-foreground',
+ notice: 'text-muted-foreground',
+ warning: 'text-warning-foreground',
+ critical: 'text-destructive-foreground',
+}
+
+export const SEVERITY_INDICATOR: Record<TodayRailSeverity, 'default' | 'warning' | 'destructive' | undefined> = {
+ none: undefined,
+ ok: undefined,
+ notice: 'default',
+ warning: 'warning',
+ critical: 'destructive',
+}
+
+export function worstSeverity(...severities: TodayRailSeverity[]): TodayRailSeverity {
+ return severities.reduce((worst, severity) => (RANK[severity] > RANK[worst] ? severity : worst), 'none')
+}
+
+export function severityFromBadgeStatus(status: TodayBadgeStatus): TodayRailSeverity {
+ return status === 'danger' ? 'critical' : status === 'warning' ? 'warning' : 'ok'
+}
+
+export function severityFromBillingAlert(alert: BillingAlertConfig | null): TodayRailSeverity {
+ if (!alert) {
+ return 'none'
+ }
+ if (alert.status === 'error') {
+ return 'critical'
+ }
+ // The banner shows an approaching usage limit as info, but only acting before the cap prevents dropped data.
+ if (alert.status === 'warning' || alert.kind === 'usage_limit') {
+ return 'warning'
+ }
+ return 'none'
+}
diff --git a/frontend/src/layout/today/todayRailStatusLogic.ts b/frontend/src/layout/today/todayRailStatusLogic.ts
new file mode 100644
index 000000000000..f266ac3e6d2b
--- /dev/null
+++ b/frontend/src/layout/today/todayRailStatusLogic.ts
@@ -0,0 +1,161 @@
+import { MakeLogicType, connect, kea, path, selectors } from 'kea'
+
+import { pendingInvitesLogic } from 'lib/components/Account/pendingInvitesLogic'
+import { healthSummaryLabel } from 'lib/components/HelpMenu/healthSummaryLabel'
+import { healthSummaryLogic } from 'lib/components/HelpMenu/healthSummaryLogic'
+import { helpMenuLogic } from 'lib/components/HelpMenu/helpMenuLogic'
+import { posthogStatusLogic } from 'lib/components/HelpMenu/posthogStatusLogic'
+import { preflightLogic } from 'lib/logic/preflightLogic'
+import { BillingAlertConfig, billingLogic } from 'scenes/billing/billingLogic'
+
+import type { HelpBadgeStatus } from '../../lib/components/HelpMenu/helpMenuLogic'
+import type { PostHogStatusBadgeStatus } from '../../lib/components/HelpMenu/posthogStatusLogic'
+import type { HealthIssueSummary } from '../../scenes/health/types'
+import type { PreflightStatus } from '../../types'
+import {
+ TodayRailSeverity,
+ severityFromBadgeStatus,
+ severityFromBillingAlert,
+ worstSeverity,
+} from './todayRailSeverity'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface todayRailStatusLogicValues {
+ effectiveBillingAlert: BillingAlertConfig | null // billingLogic
+ healthSummary: HealthIssueSummary | null // healthSummaryLogic
+ snoozedCount: number // healthSummaryLogic
+ unsnoozedCount: number // healthSummaryLogic
+ triggerBadgeStatus: HelpBadgeStatus // helpMenuLogic
+ pendingInvitesLabel: string | null // pendingInvitesLogic
+ postHogStatusBadgeStatus: PostHogStatusBadgeStatus // posthogStatusLogic
+ postHogStatusTooltip: string | null // posthogStatusLogic
+ preflight: PreflightStatus | null // preflightLogic
+ billingSeverity: TodayRailSeverity
+ billingText: string | null
+ healthSeverity: TodayRailSeverity
+ healthText: string | null
+ moreLabel: string
+ moreSeverity: TodayRailSeverity
+ orgProblems: string[]
+ orgSeverity: TodayRailSeverity
+ statusSeverity: TodayRailSeverity
+ statusText: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface todayRailStatusLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ statusSeverity: (postHogStatusBadgeStatus: PostHogStatusBadgeStatus) => TodayRailSeverity
+ statusText: (postHogStatusTooltip: string | null, preflight: PreflightStatus | null) => string | null
+ healthSeverity: (triggerBadgeStatus: HelpBadgeStatus) => TodayRailSeverity
+ healthText: (
+ healthSummary: HealthIssueSummary | null,
+ unsnoozedCount: number,
+ snoozedCount: number
+ ) => string | null
+ moreSeverity: (statusSeverity: TodayRailSeverity, healthSeverity: TodayRailSeverity) => TodayRailSeverity
+ moreLabel: (
+ statusSeverity: TodayRailSeverity,
+ statusText: string | null,
+ healthSeverity: TodayRailSeverity,
+ healthText: string | null
+ ) => string
+ billingSeverity: (effectiveBillingAlert: BillingAlertConfig | null) => TodayRailSeverity
+ billingText: (effectiveBillingAlert: BillingAlertConfig | null) => string | null
+ orgSeverity: (billingSeverity: TodayRailSeverity, pendingInvitesLabel: string | null) => TodayRailSeverity
+ orgProblems: (
+ billingSeverity: TodayRailSeverity,
+ billingText: string | null,
+ pendingInvitesLabel: string | null
+ ) => string[]
+ }
+}
+
+export type todayRailStatusLogicType = MakeLogicType<
+ todayRailStatusLogicValues,
+ {},
+ Record<string, any>,
+ todayRailStatusLogicMeta
+>
+
+export const todayRailStatusLogic = kea<todayRailStatusLogicType>([
+ path(['layout', 'today', 'todayRailStatusLogic']),
+ connect(() => ({
+ values: [
+ posthogStatusLogic,
+ ['postHogStatusTooltip', 'postHogStatusBadgeStatus'],
+ helpMenuLogic,
+ ['triggerBadgeStatus'],
+ healthSummaryLogic,
+ ['healthSummary', 'unsnoozedCount', 'snoozedCount'],
+ preflightLogic,
+ ['preflight'],
+ billingLogic,
+ ['effectiveBillingAlert'],
+ pendingInvitesLogic,
+ ['pendingInvitesLabel'],
+ ],
+ })),
+ selectors({
+ statusSeverity: [
+ (s) => [s.postHogStatusBadgeStatus],
+ (status: PostHogStatusBadgeStatus): TodayRailSeverity => severityFromBadgeStatus(status),
+ ],
+ statusText: [
+ (s) => [s.postHogStatusTooltip, s.preflight],
+ // Local dev never loads the status page summary, so it has no text to show.
+ (tooltip: string | null, preflight: PreflightStatus | null): string | null =>
+ tooltip ?? (preflight?.is_debug ? 'All systems operational' : null),
+ ],
+ healthSeverity: [
+ (s) => [s.triggerBadgeStatus],
+ (status: HelpBadgeStatus): TodayRailSeverity => severityFromBadgeStatus(status),
+ ],
+ healthText: [
+ (s) => [s.healthSummary, s.unsnoozedCount, s.snoozedCount],
+ (healthSummary: HealthIssueSummary | null, unsnoozedCount: number, snoozedCount: number): string | null =>
+ healthSummary ? healthSummaryLabel(unsnoozedCount, snoozedCount) : null,
+ ],
+ moreSeverity: [
+ (s) => [s.statusSeverity, s.healthSeverity],
+ (statusSeverity: TodayRailSeverity, healthSeverity: TodayRailSeverity): TodayRailSeverity =>
+ worstSeverity(statusSeverity, healthSeverity),
+ ],
+ moreLabel: [
+ (s) => [s.statusSeverity, s.statusText, s.healthSeverity, s.healthText],
+ (
+ statusSeverity: TodayRailSeverity,
+ statusText: string | null,
+ healthSeverity: TodayRailSeverity,
+ healthText: string | null
+ ): string =>
+ ['More', statusSeverity !== 'ok' && statusText, healthSeverity !== 'ok' && healthText]
+ .filter(Boolean)
+ .join(', '),
+ ],
+ billingSeverity: [
+ (s) => [s.effectiveBillingAlert],
+ (alert: BillingAlertConfig | null): TodayRailSeverity => severityFromBillingAlert(alert),
+ ],
+ billingText: [
+ (s) => [s.effectiveBillingAlert],
+ (alert: BillingAlertConfig | null): string | null => alert?.title ?? null,
+ ],
+ orgSeverity: [
+ (s) => [s.billingSeverity, s.pendingInvitesLabel],
+ (billingSeverity: TodayRailSeverity, pendingInvitesLabel: string | null): TodayRailSeverity =>
+ worstSeverity(billingSeverity, pendingInvitesLabel ? 'notice' : 'none'),
+ ],
+ orgProblems: [
+ (s) => [s.billingSeverity, s.billingText, s.pendingInvitesLabel],
+ (
+ billingSeverity: TodayRailSeverity,
+ billingText: string | null,
+ pendingInvitesLabel: string | null
+ ): string[] =>
+ [billingSeverity !== 'none' && billingText, pendingInvitesLabel].filter(
+ (problem): problem is string => !!problem
+ ),
+ ],
+ }),
+])
diff --git a/frontend/src/lib/components/Account/ProjectMenu.tsx b/frontend/src/lib/components/Account/ProjectMenu.tsx
index 090769c9047e..520ab2a2e812 100644
--- a/frontend/src/lib/components/Account/ProjectMenu.tsx
+++ b/frontend/src/lib/components/Account/ProjectMenu.tsx
@@ -30,15 +30,10 @@ export function ProjectName({ team, className }: { team: TeamBasicType; classNam
}
export function PendingInviteDot({ className }: { className?: string }): JSX.Element {
- const { pendingInvites } = useValues(pendingInvitesLogic)
- const organizationNames = pendingInvites.map((invite) => invite.organization_name)
- const title =
- organizationNames.length === 1
- ? `You have a pending invite to join ${organizationNames[0]}.`
- : `You have pending invites to join ${organizationNames.length} organizations.`
+ const { pendingInvitesLabel } = useValues(pendingInvitesLogic)
return (
- <Tooltip title={title} placement="right">
+ <Tooltip title={pendingInvitesLabel} placement="right">
<span
aria-label="Pending invite"
className={cn('relative flex items-center justify-center size-3 shrink-0', className)}
diff --git a/frontend/src/lib/components/Account/pendingInvitesLogic.ts b/frontend/src/lib/components/Account/pendingInvitesLogic.ts
index 77b7b8d6203a..4743cb5bb10c 100644
--- a/frontend/src/lib/components/Account/pendingInvitesLogic.ts
+++ b/frontend/src/lib/components/Account/pendingInvitesLogic.ts
@@ -12,12 +12,14 @@ export type { PendingInviteForCurrentUser }
export interface pendingInvitesLogicValues {
user: UserType | null // userLogic
pendingInvites: PendingInviteForCurrentUser[]
+ pendingInvitesLabel: string | null
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface pendingInvitesLogicMeta {
__keaTypeGenInternalSelectorTypes: {
pendingInvites: (user: UserType | null) => PendingInviteForCurrentUser[]
+ pendingInvitesLabel: (pendingInvites: PendingInviteForCurrentUser[]) => string | null
}
}
@@ -38,5 +40,16 @@ export const pendingInvitesLogic = kea<pendingInvitesLogicType>([
(s) => [s.user],
(user: null | import('~/types').UserType): PendingInviteForCurrentUser[] => user?.pending_invites ?? [],
],
+ pendingInvitesLabel: [
+ (s) => [s.pendingInvites],
+ (pendingInvites: PendingInviteForCurrentUser[]): string | null => {
+ if (pendingInvites.length === 0) {
+ return null
+ }
+ return pendingInvites.length === 1
+ ? `You have a pending invite to join ${pendingInvites[0].organization_name}.`
+ : `You have pending invites to join ${pendingInvites.length} organizations.`
+ },
+ ],
}),
])
diff --git a/frontend/src/lib/components/HelpMenu/HelpMenu.tsx b/frontend/src/lib/components/HelpMenu/HelpMenu.tsx
index 143d978256f0..c385cf055127 100644
--- a/frontend/src/lib/components/HelpMenu/HelpMenu.tsx
+++ b/frontend/src/lib/components/HelpMenu/HelpMenu.tsx
@@ -25,20 +25,11 @@ import { ScrollableShadows } from '../ScrollableShadows/ScrollableShadows'
import { RenderKeybind } from '../Shortcuts/ShortcutMenu'
import { keyBinds } from '../Shortcuts/shortcuts'
import { openCHQueriesDebugModal } from '../Shortcuts/utils/DebugCHQueries'
+import { healthSummaryLabel } from './healthSummaryLabel'
import { healthSummaryLogic } from './healthSummaryLogic'
import { helpMenuLogic } from './helpMenuLogic'
import { posthogStatusLogic } from './posthogStatusLogic'
-function healthTooltip(unsnoozedCount: number, snoozedCount: number): string {
- if (unsnoozedCount > 0) {
- return `${unsnoozedCount} health issue${unsnoozedCount === 1 ? '' : 's'}`
- }
- if (snoozedCount > 0) {
- return `${snoozedCount} snoozed health issue${snoozedCount === 1 ? '' : 's'}`
- }
- return 'All systems healthy'
-}
-
export function HelpMenu({ iconOnly = false }: { iconOnly?: boolean }): JSX.Element {
const { openSidePanel } = useActions(sidePanelStateLogic)
const { isHelpMenuOpen, triggerBadgeContent, triggerBadgeStatus } = useValues(helpMenuLogic)
@@ -184,7 +175,9 @@ export function HelpMenu({ iconOnly = false }: { iconOnly?: boolean }): JSX.Elem
to={urls.health()}
buttonProps={{ menuItem: true }}
tooltip={
- healthSummary ? healthTooltip(unsnoozedCount, snoozedCount) : undefined
+ healthSummary
+ ? healthSummaryLabel(unsnoozedCount, snoozedCount)
+ : undefined
}
tooltipPlacement="right"
tooltipCloseDelayMs={0}
diff --git a/frontend/src/lib/components/HelpMenu/healthSummaryLabel.ts b/frontend/src/lib/components/HelpMenu/healthSummaryLabel.ts
new file mode 100644
index 000000000000..a2c6fd1aa64b
--- /dev/null
+++ b/frontend/src/lib/components/HelpMenu/healthSummaryLabel.ts
@@ -0,0 +1,9 @@
+export function healthSummaryLabel(unsnoozedCount: number, snoozedCount: number): string {
+ if (unsnoozedCount > 0) {
+ return `${unsnoozedCount} health issue${unsnoozedCount === 1 ? '' : 's'}`
+ }
+ if (snoozedCount > 0) {
+ return `${snoozedCount} snoozed health issue${snoozedCount === 1 ? '' : 's'}`
+ }
+ return 'All systems healthy'
+}
diff --git a/frontend/src/lib/components/Superpowers/Superpowers.tsx b/frontend/src/lib/components/Superpowers/Superpowers.tsx
index 1b2755ca7d57..9612557ed441 100644
--- a/frontend/src/lib/components/Superpowers/Superpowers.tsx
+++ b/frontend/src/lib/components/Superpowers/Superpowers.tsx
@@ -44,9 +44,10 @@ const STATUS_OPTIONS: { value: FakeStatusOverride; label: string }[] = [
const BILLING_ALERT_OPTIONS: { value: FakeBillingAlert; label: string }[] = [
{ value: 'none', label: 'None (use real alerts)' },
- { value: 'info', label: 'Info' },
- { value: 'warning', label: 'Warning' },
- { value: 'error', label: 'Error' },
+ { value: 'usage_limit_reached', label: 'Usage limit reached' },
+ { value: 'usage_limit_approaching', label: 'Usage limit approaching' },
+ { value: 'trial', label: 'Trial ending' },
+ { value: 'suspended', label: 'Organization suspended' },
]
function Section({
@@ -355,7 +356,7 @@ function SuperpowersContent(): JSX.Element {
/>
<SettingRow
title="Fake billing alert"
- description="Simulate a billing alert banner for testing"
+ description="Simulate a billing alert in the banner and the rail for testing"
control={
<LemonSelect
size="small"
diff --git a/frontend/src/lib/components/Superpowers/buildFakeBillingAlert.ts b/frontend/src/lib/components/Superpowers/buildFakeBillingAlert.ts
new file mode 100644
index 000000000000..6e105537d27b
--- /dev/null
+++ b/frontend/src/lib/components/Superpowers/buildFakeBillingAlert.ts
@@ -0,0 +1,43 @@
+import { buildUsageLimitApproachingMessage, buildUsageLimitReachedMessage } from 'scenes/billing/billing-utils'
+import type { BillingAlertConfig } from 'scenes/billing/billingLogic'
+
+import type { FakeBillingAlert } from './superpowersLogic'
+
+/** Mirrors the alerts billingLogic raises, built with the same message helpers so the text matches. */
+export function buildFakeBillingAlert(fake: FakeBillingAlert): BillingAlertConfig | null {
+ switch (fake) {
+ case 'usage_limit_reached':
+ return {
+ kind: 'usage_limit',
+ status: 'error',
+ ...buildUsageLimitReachedMessage([
+ { type: 'product_analytics', name: 'Product analytics', subscribed: true },
+ ]),
+ }
+ case 'usage_limit_approaching':
+ return {
+ kind: 'usage_limit',
+ status: 'info',
+ ...buildUsageLimitApproachingMessage([
+ { type: 'session_replay', name: 'Session replay', percentage_usage: 0.85 },
+ ]),
+ }
+ case 'trial':
+ return {
+ kind: 'trial',
+ status: 'info',
+ title: "Your free trial for the Teams plan ends in 3 days. Your service will continue without interruption, and you'll be charged for the Teams plan.",
+ message: 'Questions? Reach out to sales at [email protected].',
+ }
+ case 'suspended':
+ return {
+ kind: 'deactivated',
+ status: 'error',
+ title: 'Your organization has been temporarily suspended.',
+ message: 'Please contact support to reactivate it.',
+ contactSupport: true,
+ }
+ case 'none':
+ return null
+ }
+}
diff --git a/frontend/src/lib/components/Superpowers/superpowersLogic.ts b/frontend/src/lib/components/Superpowers/superpowersLogic.ts
index 4275dfdb5e61..69a06f3d0ad3 100644
--- a/frontend/src/lib/components/Superpowers/superpowersLogic.ts
+++ b/frontend/src/lib/components/Superpowers/superpowersLogic.ts
@@ -11,7 +11,7 @@ import { userLogic } from 'scenes/userLogic'
import type { PreflightStatus, UserType } from '../../../types'
export type FakeStatusOverride = 'none' | 'operational' | 'degraded_performance' | 'partial_outage' | 'major_outage'
-export type FakeBillingAlert = 'none' | 'info' | 'warning' | 'error'
+export type FakeBillingAlert = 'none' | 'usage_limit_reached' | 'usage_limit_approaching' | 'trial' | 'suspended'
// The PostHog Team cohort in PostHog's own project excludes people with this person property set to true.
export const EXCLUDED_FROM_POSTHOG_TEAM_COHORT_PROPERTY = 'excluded_from_posthog_team_cohort'
diff --git a/frontend/src/lib/lemon-ui/icons/icons.tsx b/frontend/src/lib/lemon-ui/icons/icons.tsx
index 1d86666544be..c8d40d048c7a 100644
--- a/frontend/src/lib/lemon-ui/icons/icons.tsx
+++ b/frontend/src/lib/lemon-ui/icons/icons.tsx
@@ -144,6 +144,16 @@ export function IconAnalyticsBars(props: LemonIconProps): JSX.Element {
)
}
+export function IconPersonAdd(props: LemonIconProps): JSX.Element {
+ return (
+ <LemonIconBase stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" {...props}>
+ <path d="M15.75 6.5C15.75 8.57107 14.0711 10.25 12 10.25C9.92893 10.25 8.25 8.57107 8.25 6.5C8.25 4.42893 9.92893 2.75 12 2.75C14.0711 2.75 15.75 4.42893 15.75 6.5Z" />
+ <path d="M15.0011 13.838C14.1017 13.4592 13.0939 13.25 12.0011 13.25C8.60997 13.25 6.03711 15.2643 4.9836 18.1129C4.5748 19.2182 5.51944 20.25 6.69796 20.25H12.2511" />
+ <path d="M18.25 15.25V18.25M18.25 18.25V21.25M18.25 18.25H15.25M18.25 18.25H21.25" />
+ </LemonIconBase>
+ )
+}
+
// material design clipboard-edit-outline
export function IconClipboardEdit(props: LemonIconProps): JSX.Element {
return (
diff --git a/frontend/src/scenes/billing/billingLogic.tsx b/frontend/src/scenes/billing/billingLogic.tsx
index a995ce1dfaa9..c10a4e7766b2 100644
--- a/frontend/src/scenes/billing/billingLogic.tsx
+++ b/frontend/src/scenes/billing/billingLogic.tsx
@@ -8,6 +8,8 @@ import posthog from 'posthog-js'
import { LemonDialog, Link, lemonToast } from '@posthog/lemon-ui'
import api, { getJSONOrNull } from 'lib/api'
+import { buildFakeBillingAlert } from 'lib/components/Superpowers/buildFakeBillingAlert'
+import { FakeBillingAlert, superpowersLogic } from 'lib/components/Superpowers/superpowersLogic'
import { getSupportResponseTime } from 'lib/components/Support/supportResponseTime'
import { FEATURE_FLAGS, FeatureFlagKey, OrganizationMembershipLevel } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
@@ -191,6 +193,7 @@ export interface billingLogicValues {
currentOrganization: OrganizationType | null // organizationLogic
currentOrganizationId: string // organizationLogic
preflight: PreflightStatus | null // preflightLogic
+ fakeBillingAlert: FakeBillingAlert // superpowersLogic
accountOwner: {
email?: string
name?: string
@@ -269,6 +272,7 @@ export interface billingLogicValues {
}
creditOverviewLoading: boolean
currentPlatformAddon: BillingProductV2AddonType | null
+ effectiveBillingAlert: BillingAlertConfig | null
estimatedMonthlyCreditAmountUsd: number | null
hasSupportAddonPlan: boolean
isActivateLicenseSubmitting: boolean
@@ -633,6 +637,10 @@ export interface billingLogicActions {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface billingLogicMeta {
__keaTypeGenInternalSelectorTypes: {
+ effectiveBillingAlert: (
+ billingAlert: BillingAlertConfig | null,
+ fakeBillingAlert: FakeBillingAlert
+ ) => BillingAlertConfig | null
minimumBillingAccessLevel: (featureFlags: FeatureFlagsSet) => OrganizationMembershipLevel
canAccessBilling: (currentOrganization: OrganizationType | null, featureFlags: FeatureFlagsSet) => boolean
minimumUsageSpendReadAccessLevel: (featureFlags: FeatureFlagsSet) => OrganizationMembershipLevel
@@ -769,6 +777,8 @@ export const billingLogic = kea<billingLogicType>([
['preflight'],
organizationLogic,
['currentOrganization', 'currentOrganizationId'],
+ superpowersLogic,
+ ['fakeBillingAlert'],
],
actions: [
userLogic,
@@ -1115,6 +1125,12 @@ export const billingLogic = kea<billingLogicType>([
],
})),
selectors({
+ /** The alert to show: a Superpowers fake while one is picked, the real alert otherwise. */
+ effectiveBillingAlert: [
+ (s) => [s.billingAlert, s.fakeBillingAlert],
+ (billingAlert: BillingAlertConfig | null, fakeBillingAlert: FakeBillingAlert): BillingAlertConfig | null =>
+ buildFakeBillingAlert(fakeBillingAlert) ?? billingAlert,
+ ],
minimumBillingAccessLevel: [
(s) => [s.featureFlags],
(featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): OrganizationMembershipLevel =>
diff --git a/packages/quill/packages/primitives/AGENTS.md b/packages/quill/packages/primitives/AGENTS.md
index c0138e1b2473..b82538b4f6f9 100644
--- a/packages/quill/packages/primitives/AGENTS.md
+++ b/packages/quill/packages/primitives/AGENTS.md
@@ -135,22 +135,22 @@ Don't hand-roll `<p className="text-xs text-muted-foreground">` when `<Text size
## Component Catalog
-| Component | Variants | Sizes | Notes |
-| ------------ | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Button | default, primary, secondary, outline, destructive, destructive-outline, link, link-muted | default, xs, sm, lg, icon, icon-xs, icon-sm, icon-lg, row, inline | `loading` overlays a centered spinner and disables the button (width stays stable). `row` is the full-width, regular-weight list row that menu, combobox and autocomplete items render. `inline` is a link inside a sentence: no height or padding, and it inherits the sentence's font size and line height. `elevated` adds heavy CTA chrome — see Elevated button. `tooltip` adds a hover and focus tooltip. `disabledReason` disables the button and shows the reason in that tooltip. A `render` that carries a link destination (`to`, `href`) or is a non-button element turns off `nativeButton` by itself; a disabled button drops that destination. |
-| Badge | default, info, destructive, warning, success, completed | — | Semantic status |
-| Toggle | default, outline | default, sm, lg, icon | |
-| Chip | outline | sm | Use with ChipClose |
-| Separator | — | — | orientation: horizontal/vertical |
-| Spinner | — | — | SVG, accepts svg props |
-| Skeleton | — | — | Pulsing placeholder div |
-| SkeletonText | — | — | lines, minWidth, maxWidth |
-| Progress | — | — | value: 0-100 |
-| Slider | — | — | value, min, max |
-| Avatar | — | lg, default, sm, xs | Compose `Avatar > AvatarImage + AvatarFallback`; image errors fall back to initials/icon |
-| ChatGlobe | — | — | Sweeping globe for "browsing the web"; sizes from its container. Still globe under reduced motion |
-| AvatarGroup | — | default, sm, xs | Row of Avatars; `stacked` overlaps + spreads on hover (no reflow), `reverse` spreads left; `size` forwards to children |
-| IconStack | — | — | Fanned colored icon tiles (`IconStackItem`, `color` per product, grey default); spreads on hover. The Empty icon, or a trailing set of items after text |
+| Component | Variants | Sizes | Notes |
+| ------------ | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| Button | default, primary, secondary, outline, destructive, destructive-outline, link, link-muted | default, xs, sm, lg, icon, icon-xs, icon-sm, icon-lg, row, inline | `loading` overlays a centered spinner and disables the button (width stays stable). `row` is the full-width, regular-weight list row that menu, combobox and autocomplete items render. `inline` is a link inside a sentence: no height or padding, and it inherits the sentence's font size and line height. `elevated` adds heavy CTA chrome — see Elevated button. `tooltip` adds a hover and focus tooltip. `indicator="default"` puts a dot on the top-right corner for something waiting behind the button (`"warning"` or `"destructive"` for a problem); say what it means in the `aria-label`, and set `--quill-button-indicator-ring` when the button sits off the app background. `disabledReason` disables the button and shows the reason in that tooltip. A `render` that carries a link destination (`to`, `href`) or is a non-button element turns off `nativeButton` by itself; a disabled button drops that destination. |
+| Badge | default, info, destructive, warning, success, completed | — | Semantic status |
+| Toggle | default, outline | default, sm, lg, icon | |
+| Chip | outline | sm | Use with ChipClose |
+| Separator | — | — | orientation: horizontal/vertical |
+| Spinner | — | — | SVG, accepts svg props |
+| Skeleton | — | — | Pulsing placeholder div |
+| SkeletonText | — | — | lines, minWidth, maxWidth |
+| Progress | — | — | value: 0-100 |
+| Slider | — | — | value, min, max |
+| Avatar | — | lg, default, sm, xs | Compose `Avatar > AvatarImage + AvatarFallback`; image errors fall back to initials/icon |
+| ChatGlobe | — | — | Sweeping globe for "browsing the web"; sizes from its container. Still globe under reduced motion |
+| AvatarGroup | — | default, sm, xs | Row of Avatars; `stacked` overlaps + spreads on hover (no reflow), `reverse` spreads left; `size` forwards to children |
+| IconStack | — | — | Fanned colored icon tiles (`IconStackItem`, `color` per product, grey default); spreads on hover. The Empty icon, or a trailing set of items after text |
---
@@ -386,7 +386,7 @@ Attached panel outside the popup: pass `popupSibling` on `SelectContent` — ren
Something attached to the popup's edge, such as a resize handle: pass `popupSibling` on `ComboboxContent`, as on `SelectContent`. It renders in the positioner beside the popup, outside the popup's overflow, so it can sit across the edge. Position it absolute so it never resizes the popup.
-A highlighted Combobox or Autocomplete item paints its content in the foreground color. Put `data-keep-color` on a child that must keep its own color, such as a colored product icon.
+A `ComboboxItem` takes `description` for a muted second line, laid out like a described `DropdownMenuItem`. A highlighted Combobox or Autocomplete item paints its content in the foreground color. Put `data-keep-color` on a child that must keep its own color, such as a colored product icon.
Multi-select with chips:
@@ -520,7 +520,7 @@ Same shell as Dialog (shared `quill-dialog__*` styles) but `role="alertdialog"`,
Destructive items (`variant="destructive"` on DropdownMenuItem/ContextMenuItem/MenubarItem) forward straight to Button's `destructive` variant, so a delete row in a menu reads exactly like a standalone destructive Button: a red fill at rest, brighter on hover or keyboard highlight. The item owns that mapping — don't pass a Button variant through `render` to restyle a menu item.
-A row with a second line takes `description`; the row grows to fit, and the description lines up past a leading icon. Any item, sub trigger, checkbox or radio item takes `tooltip` and `disabledReason`; both open beside the row, and `disabledReason` also disables it. A disabled row ignores the pointer, so don't hand-wrap it in a Tooltip yourself.
+A row with a second line takes `description`; the row grows to fit, and the description lines up past a leading icon. Mark a trailing icon with `data-icon="inline-end"`, or the description indents as if the icon led the row. Any item, sub trigger, checkbox or radio item takes `tooltip` and `disabledReason`; both open beside the row, and `disabledReason` also disables it. A disabled row ignores the pointer, so don't hand-wrap it in a Tooltip yourself.
```tsx
<DropdownMenuItem description="Start from an empty folder">
diff --git a/packages/quill/packages/primitives/src/button.css b/packages/quill/packages/primitives/src/button.css
index 375644651723..52df43844288 100644
--- a/packages/quill/packages/primitives/src/button.css
+++ b/packages/quill/packages/primitives/src/button.css
@@ -546,6 +546,37 @@
background-color: transparent;
}
+ /* =========================================================================
+ Indicator
+ ========================================================================= */
+
+ /* The dot sits on the corner, outside the icon. The ring cuts it out of the
+ button border, so it defaults to the app background; set
+ `--quill-button-indicator-ring` when the button sits on another surface. */
+ .quill-button[data-indicator] {
+ position: relative;
+ }
+
+ .quill-button__indicator {
+ position: absolute;
+ inset-inline-end: -0.125rem;
+ top: -0.125rem;
+ width: 0.5rem;
+ height: 0.5rem;
+ pointer-events: none;
+ background-color: var(--primary);
+ border-radius: 9999px;
+ box-shadow: 0 0 0 2px var(--quill-button-indicator-ring, var(--background));
+ }
+
+ .quill-button__indicator[data-variant='warning'] {
+ background-color: var(--warning-foreground);
+ }
+
+ .quill-button__indicator[data-variant='destructive'] {
+ background-color: var(--destructive-foreground);
+ }
+
/* =========================================================================
Loading
========================================================================= */
diff --git a/packages/quill/packages/primitives/src/button.stories.tsx b/packages/quill/packages/primitives/src/button.stories.tsx
index 1c1e96311afe..2b87bb0c223f 100644
--- a/packages/quill/packages/primitives/src/button.stories.tsx
+++ b/packages/quill/packages/primitives/src/button.stories.tsx
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react'
-import { TrashIcon } from 'lucide-react'
+import { BellIcon, TrashIcon } from 'lucide-react'
import { useState } from 'react'
import { Button } from './button'
@@ -157,6 +157,29 @@ export const IconOnly = {
),
} satisfies Story
+export const WithIndicator = {
+ render: () => (
+ <div className="flex flex-wrap gap-2">
+ <Button size="icon" indicator="default" aria-label="Notifications, 3 unread">
+ <BellIcon />
+ </Button>
+ <Button variant="outline" size="icon" indicator="default" aria-label="Notifications, 3 unread">
+ <BellIcon />
+ </Button>
+ <Button variant="outline" indicator="default">
+ <BellIcon />
+ Inbox
+ </Button>
+ <Button variant="outline" size="icon" indicator="warning" aria-label="Billing, usage limit close">
+ <BellIcon />
+ </Button>
+ <Button variant="outline" size="icon" indicator="destructive" aria-label="Billing, payment failed">
+ <BellIcon />
+ </Button>
+ </div>
+ ),
+} satisfies Story
+
export const InteractionStates = {
parameters: {
pseudo: {
diff --git a/packages/quill/packages/primitives/src/button.tsx b/packages/quill/packages/primitives/src/button.tsx
index 2527bf241470..5d69b0526ccf 100644
--- a/packages/quill/packages/primitives/src/button.tsx
+++ b/packages/quill/packages/primitives/src/button.tsx
@@ -67,6 +67,13 @@ export type ButtonProps = ButtonPrimitive.Props &
* Use with `primary` or `outline`. At most two in a row; any further button is a flat `default`. See AGENTS.md.
*/
elevated?: boolean
+ /**
+ * A dot on the top-right corner that flags something waiting behind the button, such as unread
+ * items. Say what it means in the `aria-label`. Off the app background, set
+ * `--quill-button-indicator-ring` to the surface behind the button. `warning` and `destructive`
+ * color the dot for a problem rather than news.
+ */
+ indicator?: 'default' | 'warning' | 'destructive'
/** Text shown on hover and focus. Icon-only buttons need one, matching their `aria-label`. */
tooltip?: React.ReactNode
/**
@@ -124,6 +131,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
left = false,
elevated = false,
loading = false,
+ indicator,
disabled,
tooltip,
disabledReason,
@@ -144,6 +152,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
data-slot="button"
data-size={size}
data-loading={loading || undefined}
+ data-indicator={indicator || undefined}
aria-busy={loading || undefined}
disabled={isDisabled}
nativeButton={nativeButton ?? !rendersNonButton(renderTarget)}
@@ -160,6 +169,14 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
{...props}
>
{children}
+ {indicator && (
+ <span
+ aria-hidden
+ data-slot="button-indicator"
+ data-variant={indicator}
+ className="quill-button__indicator"
+ />
+ )}
{loading && <Spinner className="quill-button__spinner" />}
</ButtonPrimitive>
)
diff --git a/packages/quill/packages/primitives/src/combobox.tsx b/packages/quill/packages/primitives/src/combobox.tsx
index 78e048157743..bf922870add0 100644
--- a/packages/quill/packages/primitives/src/combobox.tsx
+++ b/packages/quill/packages/primitives/src/combobox.tsx
@@ -9,6 +9,7 @@ import { Chip, ChipClose } from './chip'
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group'
import { cn } from './lib/utils'
import { MenuEmpty } from './menu-empty'
+import { MenuItemBody } from './menu-item-body'
import { MenuLabel } from './menu-label'
import { hasTooltipContent, withTooltip } from './with-tooltip'
@@ -179,9 +180,15 @@ const ComboboxItem = React.forwardRef<
disabledReason?: React.ReactNode
/** An action row, such as "New project". It is never selected, so it leaves out the check mark's gutter. */
action?: boolean
+ /** A muted second line under the label. The row grows to fit it, and its text lines up past a leading icon. */
+ description?: React.ReactNode
}
->(function ComboboxItem({ className, children, title, tooltip, disabledReason, disabled, action, ...props }, ref) {
+>(function ComboboxItem(
+ { className, children, title, tooltip, disabledReason, disabled, action, description, ...props },
+ ref
+) {
const hasReason = hasTooltipContent(disabledReason)
+ const described = hasTooltipContent(description)
// A disabled item ignores the pointer, so the tooltip listens on a wrapper and opens beside the row.
return withTooltip(
<ComboboxPrimitive.Item
@@ -189,7 +196,7 @@ const ComboboxItem = React.forwardRef<
data-slot="combobox-item"
data-action={action ? '' : undefined}
disabled={disabled || hasReason}
- className={cn('quill-combobox__item', className)}
+ className={cn('quill-combobox__item', described && 'quill-menu-item--described', className)}
title={title ?? (typeof children === 'string' ? children : undefined)}
// The default render is a real <button>; only declare nativeButton when the
// caller hasn't overridden render (their element may not be a button).
@@ -197,7 +204,9 @@ const ComboboxItem = React.forwardRef<
render={<Button size="row" left className="min-w-0 aria-selected:bg-fill-selected" />}
{...props}
>
- <span className="quill-combobox__item-content flex items-center min-w-0 truncate">{children}</span>
+ <span className="quill-combobox__item-content flex items-center min-w-0 truncate">
+ {described ? <MenuItemBody description={description}>{children}</MenuItemBody> : children}
+ </span>
<ComboboxPrimitive.ItemIndicator
render={<span className="pointer-events-none absolute start-2 flex items-center justify-center" />}
>
diff --git a/packages/quill/packages/primitives/src/dropdown-menu.tsx b/packages/quill/packages/primitives/src/dropdown-menu.tsx
index 5749c24f0099..48b013db2314 100644
--- a/packages/quill/packages/primitives/src/dropdown-menu.tsx
+++ b/packages/quill/packages/primitives/src/dropdown-menu.tsx
@@ -8,6 +8,7 @@ import { Button } from './button'
import { Checkbox } from './checkbox'
import { Kbd } from './kbd'
import { cn } from './lib/utils'
+import { MenuItemBody } from './menu-item-body'
import { MenuLabel } from './menu-label'
import { RadioIndicator } from './radio-group'
import { hasTooltipContent, withTooltip } from './with-tooltip'
@@ -33,14 +34,6 @@ function withItemTooltip(
return withTooltip(item, content, { target: 'block', side: 'inline-end' })
}
-function MenuItemBody({ children, description }: { children: React.ReactNode; description: React.ReactNode }): React.ReactElement {
- return (
- <span className="quill-menu-item__body">
- <span className="quill-menu-item__title">{children}</span>
- <span className="quill-menu-item__description">{description}</span>
- </span>
- )
-}
function DropdownMenu({ ...props }: MenuPrimitive.Root.Props): React.ReactElement {
diff --git a/packages/quill/packages/primitives/src/menu-item-body.tsx b/packages/quill/packages/primitives/src/menu-item-body.tsx
new file mode 100644
index 000000000000..10ddc9cc5d6e
--- /dev/null
+++ b/packages/quill/packages/primitives/src/menu-item-body.tsx
@@ -0,0 +1,19 @@
+import './menu.css'
+
+import * as React from 'react'
+
+/** The label and muted second line of a described menu row. Internal to the menu and combobox items. */
+export function MenuItemBody({
+ children,
+ description,
+}: {
+ children: React.ReactNode
+ description: React.ReactNode
+}): React.ReactElement {
+ return (
+ <span className="quill-menu-item__body">
+ <span className="quill-menu-item__title">{children}</span>
+ <span className="quill-menu-item__description">{description}</span>
+ </span>
+ )
+}
diff --git a/packages/quill/packages/primitives/src/menu.css b/packages/quill/packages/primitives/src/menu.css
index f7eafd5e1242..a4a9c5992574 100644
--- a/packages/quill/packages/primitives/src/menu.css
+++ b/packages/quill/packages/primitives/src/menu.css
@@ -137,8 +137,10 @@
font-size: 0.5rem;
}
- /* Line the description up with the label, past the leading icon or avatar (0.875rem + the 0.5rem gap). */
- .quill-menu-item__title:has(> svg:first-child, > [data-slot='avatar']:first-child) + .quill-menu-item__description {
+ /* Line the description up with the label, past the leading icon or avatar (0.875rem + the 0.5rem gap).
+ CSS skips text nodes, so a trailing icon after a bare label is the first child too; `data-icon='inline-end'` marks it. */
+ .quill-menu-item__title:has(> svg:first-child:not([data-icon='inline-end']), > [data-slot='avatar']:first-child)
+ + .quill-menu-item__description {
padding-inline-start: 1.375rem;
}