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(inbox): move triage mode to the header and fit filters on one row (#126769)

posthog[bot]dd924bd84419
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 4541b217141b..8013e8f0ce44 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -12499,25 +12499,25 @@ snapshots:
scenes-app-inbox-reportsourcesuggestion--logs--light:
hash: v1.k794b7964.d5d1040cc778c947be775229c9b6158b5f836a533ed705da42df816071be1cdb.BhUT6qPcyyC9BegwxP3rKg3OcahAzfe1WffSJEOcd-s
scenes-app-inbox-scene--empty--dark:
- hash: v1.k794b7964.fded9097d3e099bf6e86fcf360238d1363919389631880b8affc13c5e04c0e89.QP7E0u21YBfciOIAZABsp7BavUezL4XPTG6QBI0Q_e4
+ hash: v1.k794b7964.3ef6f84750b49ab965f38446a85f41944f32d2f1f72553e033a1f96276b8bc12.cTXCXUNSb6QQg9ln9I_4m0hLJyUFIesu3i4jrFTxKIQ
scenes-app-inbox-scene--empty--light:
- hash: v1.k794b7964.7f7ed546b5109366a4d0682df167f929eae747aaaf91cc7c2e734ea461903085.qK6mjdn6wzbIGiVz0DOc8snh3VnrWaO4_e-JS6O2CJA
+ hash: v1.k794b7964.c068f924a547071bf8ac5f2c96a585b755fb518818a2d4bc72f7f4a92f60d189.H7ihGO2Nyvh29P1DziTtSYX6NB_WI4gyQssn-EqCaos
scenes-app-inbox-scene--empty-with-many-scouts--dark:
- hash: v1.k794b7964.579bcc0e90bf409f71ead99910efbfa277f1197a5979a2893bb7d97818910655.r0jZhZTBwtQdzMHsQrTftEVwoI1KugogKRosQwO6an4
+ hash: v1.k794b7964.2690912ad936f842014696af2970d9042fec68fd99181b67bb56ab5d3a67ef38.2A-ywutAlYFfXUv0k4rb-D68jakztZ669a2Y3nWR5rQ
scenes-app-inbox-scene--empty-with-many-scouts--light:
- hash: v1.k794b7964.87922040826b927dae5d729020606fee2eb1b5e29c5b7e4b0e7c54881aa848f3.pjah0UU2pIMWKFsGjP0WBB5gXl0Vm27l9YPhas5KBxo
+ hash: v1.k794b7964.49f146b6f7d911ede15b4132858c7fadee216ba3356602fbbaf22435bc617c61.8uW9y03sO0KCYQr6pAkIkBJuqAnnvIylezQVOXg8oOI
scenes-app-inbox-scene--guided-onboarding-complete--dark:
- hash: v1.k794b7964.e6ecff68e551584f79fb2c0d24eaebdcc275f767663926734615d2301b57573b.ALsNaySutBbqP12IB12j3QWRIV3sQMLFxydymlSn40U
+ hash: v1.k794b7964.80a3d8bbd386091f6c17d3de0178ac2bb00c9368a54550ab6d845a37f2417bc3.-LKfuV7PTEBcFCmmHUnfL-Y_IIsCOhofsFlnFzqLUdU
scenes-app-inbox-scene--guided-onboarding-complete--light:
- hash: v1.k794b7964.cf9af6b650777d2eac80e08944a56e9a6ebe07b95fd8f29a981716b7667e9b70.kBDMvUHgQMWITfNkYu4K4l_H993uB_c69gKx6pRH_ag
+ hash: v1.k794b7964.476742f0f8472b32d45e3a47a6bca5aed126a66ae353ec3c145eab216e073817.41OeGZz6vcpdt_7YNw3GaQbLWKG4CBSSxOF-plQ6NPw
scenes-app-inbox-scene--inbox--dark:
- hash: v1.k794b7964.abe11ff632d5e709904a9a2763d954a7a3f0f21be1935477c085b0b6f9d12da2.kdyoAJiC_PnfT99ivG6f4tUIJzLeQfwmJo3hXkPgOtg
+ hash: v1.k794b7964.20a12c4fb2c623d2f393d883f0a6f2313fe02e628dacae11f07d8bf261d485d7.2_h_OhXXlUh-PRzAfR73B2CC9-lWJEvC8CazFui-OUE
scenes-app-inbox-scene--inbox--light:
- hash: v1.k794b7964.25ac950e084b3d231a8ec6ae9d89491baca2860753e59d74d9b078ce4d4caf11.JaYduWCTJmivbyBkTEdjUHghZItkcw4G_Zf6HhTyyxM
+ hash: v1.k794b7964.ac90d148508d247d2ae17c5487ff013c4e40b00eab688237641402bbb4b1f7b6.x4pedqoEQOX7MVMR9n3LRXRXqJFCQXTOjVVhH3d0CYk
scenes-app-inbox-scene--installing-self-driving--dark:
- hash: v1.k794b7964.87993d57d709740d7f2d07aab031d9d421a2ac681304304df9e9aa7255db1d0d.1m4cewpnnNSjXa2oQklmImshZCzSyXNBSqeSSYypEvA
+ hash: v1.k794b7964.14709655eca7051b8b75552501e606315317ca917bc308c113f184b2e04c73b5.6_dNVe1Wmq2kk-lsqTng3JBbqIG9BWkd9-CcABUDvIY
scenes-app-inbox-scene--installing-self-driving--light:
- hash: v1.k794b7964.2f358bdbbf369097bae081b8bc5074763022565c93eb5068ee8c888fe489fed8.ayg_LGB-jgj29UyNem5VJZcujteNYY1R7Y-BWGMFBJc
+ hash: v1.k794b7964.210aa02f090b14972638f537dc9963f1c3084ab0da4aee6081eff9c2095d6820.px0spHyEFZPWte0oVgw5xWNoDP9oTF_JnV0dURw9SpI
scenes-app-inbox-scene--report-with-many-evidence-items--dark:
hash: v1.k794b7964.87b4023d1181af0c9f5d86706035c57b717b85fe9cefaa264eccbc7d63937c2a.Fc7NrUn6tbhkkGPOhgnqH55HuLQgVJfyEQjfMR_hWSk
scenes-app-inbox-scene--report-with-many-evidence-items--light:
@@ -12539,9 +12539,9 @@ snapshots:
scenes-app-inbox-scene--self-driving-onboarding--light:
hash: v1.k794b7964.00654ee8a6e5d5adcc4f8dc7bfab6c9cc3ec0f2b1bf1e614296c21c98072e557.WD-qryxem5186Q051dordQcOM7DWlMGAJBJPHKRUqzY
scenes-app-inbox-scene--self-driving-paused--dark:
- hash: v1.k794b7964.15224ee7cad725c27f31c284573082e9f13f178239f8711a2b3e615fac4e0a82.cfmWQ90A0Fu0kd2yvTgbgFopzig5-i5lMJku5HA9P9w
+ hash: v1.k794b7964.bb25e7f22fc074017f325a401bbd3c30ba68d4e6bcae3493d99ae1190e91e4ed.4fKAYETFswNQheK2ZzR099KHo31rTgb238rSOVJRoic
scenes-app-inbox-scene--self-driving-paused--light:
- hash: v1.k794b7964.cf45f88d25f3577edc084be5235813311af66c0c9a6efad19672964dc2260cbf.CPqeo68jcHJsVk0Wr02sBtNFd0415w9qknQNTfG_NTY
+ hash: v1.k794b7964.3c6954f24f0dcbb958d9f3f6d41cb0464046f318f2ab2c728bab0660bc27cdd5.Otg0k9lmEyDouClNdBf8YMxYnhe5FKT__UUUEpZ_86M
scenes-app-inbox-scene--self-driving-verdict-pending--dark:
hash: v1.k794b7964.6070171adce8ba72d73e5ef46ddc59a6ebd25afbb16d2c4ae0837fa9af66e0fd.crmCZN0uPyF4FXAVize9Qi7juxKUap5RRLyfRbpmo9Q
scenes-app-inbox-scene--self-driving-verdict-pending--light:
@@ -12555,9 +12555,9 @@ snapshots:
scenes-app-inbox-scene--triage--light:
hash: v1.k794b7964.ea1f0a1a3cd9c029a33e39277a276be15a04555ba2addee17df2aacb108316dc.CFYN_7EjRWTlSCsBQMuZ6Bq_ViTyRy7_RqqtqKfg05w
scenes-app-inbox-scene--with-value-summary--dark:
- hash: v1.k794b7964.399a821e860545a030b7f47022b3c0faa572ecf409d8022dd9905b00078a39bd.GlILUAixFzYNC0btxJtI9HSKqmfjbb2GGqNvDtHlcj0
+ hash: v1.k794b7964.9d96b4ff72d13046c1aca606a0f28768d61d488fb1b78e37885b6cf5d15e0cb8.rckpgrfllAqb3r8B-t2EJWihOOMAgfXdl4HMnOcHiGc
scenes-app-inbox-scene--with-value-summary--light:
- hash: v1.k794b7964.4353239eca2bbe548d09870ae49ff279585e2b6f3f4fd7540c36f1191e11df2a.ny1JGEyx56c611q3Rb8T_e_d7wspsAns3P92SHvFFh8
+ hash: v1.k794b7964.12745b8679c070e218c04e8149a45570eee43afbce49213780382a7014fc427e.xMyiCV6NNVJcdyCgJnvwS1fZsxYhSbKDnBhR7msFjbQ
scenes-app-inbox-scout-comparison-report--completed--dark:
hash: v1.k794b7964.179dd1ea74dfa1727c501df365f491d5bb9246bfc731ac4821594687795197b1.Za7jkz_YuKW0eyjzp928-Hv652aROII5i6Da4dNfiuk
scenes-app-inbox-scout-comparison-report--completed--light:
@@ -13223,13 +13223,13 @@ snapshots:
scenes-app-inbox-tabs--reports--light:
hash: v1.k794b7964.09631597a035ed2189054412354d31cd22be3eec9bb0f561418068ea3ef9c214.EXw1pHmTZK_RjVclsYo_Kxb0JqyvHrvFgvkQAzayXcM
scenes-app-inbox-tabs--reports-claimed-by-you--dark:
- hash: v1.k794b7964.15ddc87e6cc609a0cad930a7bca2f97cf16226b304c0167e222aaa53e273b6d0.d2mpa26hDIfftwQJLcTnVPkA6_8pWrC63v5tQuQezeY
+ hash: v1.k794b7964.d4fb926d141308d38a3d5843ba27b7bac0e6a8290fc7bf61c50d9c351ba90cce.EEbW8e0I9pyMhC_r_cuOke7EMeicL2tgeQDKgvOzNOg
scenes-app-inbox-tabs--reports-claimed-by-you--light:
- hash: v1.k794b7964.aea97c395bca30f3a5d93137ef0121bb5d43ef23a2900a2f6a58b2891e217817.8DWXonv-t_Zys4by2MVzwT0pLCrt3woF62OkCM7OQG0
+ hash: v1.k794b7964.c5380934c22357e1213abab8d0756ca5f0657131e43d532d11c713e481139d95.QSTjlpA-umJpskeiKhrcxU4Prs_PaBxgODGnpOC52sE
scenes-app-inbox-tabs--reports-empty--dark:
- hash: v1.k794b7964.dc29c2f2e427a085e6638ef993c88dcc03a504fdb24167b483fff97553bd46ed.ty7BrQvUhYyHSMZKZjwRJamVmkH7NNaUMDBbB-wLDIg
+ hash: v1.k794b7964.a2cf6c5f80fa815659dc9c4903a219d9cdbd5cd800c31412b63380ff99907a87.nwCSYpD_uI1uGEF3FoFKcUBfiQ6AEaXp4egtpI0E3kc
scenes-app-inbox-tabs--reports-empty--light:
- hash: v1.k794b7964.de36cd16144fd835268ab3f6c3aa5894d7b60ff2b9ff2c6b416369070fb1f24d.20awEOZWTST7v9gjqIv9fHfT4w80_baLe7_Mw5Bk8Qs
+ hash: v1.k794b7964.ad6409662cdb4f8c6454ff3482339512cafb733a53ed1346b577d43b947bba8c.qj9HtJQc73BTt72pa0vU33rF3gz2Nk0lzqekA7UeCUc
scenes-app-inbox-tabs--reports-state-filtered--dark:
hash: v1.k794b7964.3fb8c913ffd39b5d3bae77edd876fc3c9144dc8b8cd80363e708281c3e47c28f.s9jTcGmmoNhxUImcnqeU7qdByt-u2bBfz5k132LP3n0
scenes-app-inbox-tabs--reports-state-filtered--light:
diff --git a/products/signals/frontend/inbox/InboxScene.tsx b/products/signals/frontend/inbox/InboxScene.tsx
index 7f21ce65b115..441fc6a32d5b 100644
--- a/products/signals/frontend/inbox/InboxScene.tsx
+++ b/products/signals/frontend/inbox/InboxScene.tsx
@@ -22,6 +22,7 @@ import { InboxOnboardingBanner } from './components/onboarding/InboxOnboardingBa
import { InboxOnboardingEntry } from './components/onboarding/InboxOnboardingEntry'
import { ScratchpadPanel } from './components/scratchpad/ScratchpadPanel'
import { InboxTabBar } from './components/shell/InboxTabBar'
+import { InboxTriageButton } from './components/shell/InboxTriageButton'
import { InboxValueSummary } from './components/shell/InboxValueSummary'
import { ReportsTab } from './components/tabs/ReportsTab'
import { RunsTab } from './components/tabs/RunsTab'
@@ -253,6 +254,16 @@ export function InboxScene(): JSX.Element {
}
}, [isScratchpadOpen])
+ // Each tab's primary action sits in the scene header rather than inside the tab: one predictable
+ // place, and it stays reachable when filters narrow the tab down to nothing. Not while onboarding
+ // has the tab locked (or is still deciding): the tab isn't reachable then.
+ const tabUnlocked = onboardingMode !== 'takeover' && onboardingMode !== 'pending'
+ const headerActions = !tabUnlocked ? undefined : activeTab === 'scouts' ? (
+ <ScoutsRosterActions />
+ ) : activeTab === 'reports' ? (
+ <InboxTriageButton />
+ ) : undefined
+
return (
<SceneContent className="gap-y-0 border-b-0 flex-1 min-h-0">
<div className={showDetail ? 'hidden' : 'flex flex-col gap-y-4 flex-1 min-h-0'}>
@@ -268,15 +279,7 @@ export function InboxScene(): JSX.Element {
: INBOX_TAB_DESCRIPTION[activeTab]
}
resourceType={{ type: 'inbox' }}
- // Creating a scout is the Scouts tab's primary action, so it sits in the scene
- // header rather than inside the roster — one predictable place, and it stays
- // reachable when the roster is filtered down to nothing. Not while onboarding
- // has the tab locked (or is still deciding): the roster isn't reachable then.
- actions={
- activeTab === 'scouts' && onboardingMode !== 'takeover' && onboardingMode !== 'pending' ? (
- <ScoutsRosterActions />
- ) : undefined
- }
+ actions={headerActions}
/>
<div className="flex flex-col -mx-4 -mt-4 flex-1 min-h-0">
diff --git a/products/signals/frontend/inbox/components/shell/InboxReportFilters.tsx b/products/signals/frontend/inbox/components/shell/InboxReportFilters.tsx
index 425bcaca3ac0..319991e39247 100644
--- a/products/signals/frontend/inbox/components/shell/InboxReportFilters.tsx
+++ b/products/signals/frontend/inbox/components/shell/InboxReportFilters.tsx
@@ -1,16 +1,13 @@
import { useActions, useValues } from 'kea'
+import { IconCalendar } from '@posthog/icons'
import { LemonSelect } from '@posthog/lemon-ui'
import {
INBOX_CREATED_WINDOW_OPTIONS,
- INBOX_MODEL_SORT_OPTIONS,
INBOX_PRIORITY_OPTIONS,
- INBOX_SORT_OPTIONS,
inboxPriorityFilterLabel,
- inboxSortOptionKey,
PRIORITY_ACCENT,
- InboxSortOption,
PRIORITY_MEANING,
} from '../../filterOptions'
import { InboxCreatedWindow, inboxFiltersLogic } from '../../logics/inboxFiltersLogic'
@@ -35,48 +32,29 @@ const PRIORITY_SELECT_OPTIONS = [
})),
]
-// No icons: the trigger reads out the active option, and an icon there would crowd the label the
-// order is already stated in.
-const toSortSelectOption = (option: InboxSortOption): { value: string; label: string; tooltip?: string } => ({
- value: inboxSortOptionKey(option.field, option.direction),
- label: option.label,
- tooltip: option.description,
-})
-const SORT_SELECT_OPTIONS = INBOX_SORT_OPTIONS.map(toSortSelectOption)
-const SORT_SELECT_SECTIONS_WITH_MODEL = [
- { options: SORT_SELECT_OPTIONS },
- { title: 'Model scores', options: INBOX_MODEL_SORT_OPTIONS.map(toSortSelectOption) },
-]
-const ALL_SORT_OPTIONS = [...INBOX_SORT_OPTIONS, ...INBOX_MODEL_SORT_OPTIONS]
-
const ANY_TIME = null
const CREATED_WINDOW_SELECT_OPTIONS: { value: InboxCreatedWindow | null; label: string }[] = [
{ value: ANY_TIME, label: 'Any time' },
...INBOX_CREATED_WINDOW_OPTIONS.map(({ value, label }) => ({ value, label })),
]
+function createdWindowLabel(window: InboxCreatedWindow | null): string {
+ return CREATED_WINDOW_SELECT_OPTIONS.find((option) => option.value === window)?.label ?? 'Any time'
+}
+
/**
- * What narrows the report list: report state, then priority, then sort order, then the created-in window, then source.
+ * What narrows the report list: report state, then priority, then the created-in window, then source.
* Filter state is persisted via `inboxFiltersLogic`, and the list reloads on change.
*
* Source goes last because its label grows with the selected scout name. Anywhere earlier, a long name
* pushes the controls after it to the right.
*
- * Reviewer scope is deliberately not here. It sits with triage mode on the other side of the row,
- * because it picks whose inbox this is rather than narrowing the one you are looking at.
+ * Sort and reviewer scope are deliberately not here. Sort orders the list rather than narrowing it,
+ * and scope picks whose inbox this is, so both sit after a divider at the end of the row.
*/
export function InboxReportFilters(): JSX.Element {
- const {
- activeSortField,
- activeSortDirection,
- priorityFilter,
- modelSortAvailable,
- timeWindowAvailable,
- createdWindow,
- sourceFilterAvailable,
- } = useValues(inboxFiltersLogic)
- const { setSort, setPriorityFilter, setCreatedWindow } = useActions(inboxFiltersLogic)
- const sortOptions = modelSortAvailable ? ALL_SORT_OPTIONS : INBOX_SORT_OPTIONS
+ const { priorityFilter, timeWindowAvailable, createdWindow, sourceFilterAvailable } = useValues(inboxFiltersLogic)
+ const { setPriorityFilter, setCreatedWindow } = useActions(inboxFiltersLogic)
return (
<div className="flex flex-wrap items-center gap-2">
@@ -91,26 +69,21 @@ export function InboxReportFilters(): JSX.Element {
renderButtonContent={() => inboxPriorityFilterLabel(priorityFilter)}
data-attr="inbox-filter-priority"
/>
- <LemonSelect
- size="small"
- value={inboxSortOptionKey(activeSortField, activeSortDirection)}
- onChange={(key) => {
- const option = sortOptions.find((o) => inboxSortOptionKey(o.field, o.direction) === key)
- if (option) {
- setSort(option.field, option.direction)
- }
- }}
- options={modelSortAvailable ? SORT_SELECT_SECTIONS_WITH_MODEL : SORT_SELECT_OPTIONS}
- renderButtonContent={(leaf) => `Sort: ${leaf?.label ?? ''}`}
- data-attr="inbox-sort"
- />
{timeWindowAvailable && (
<LemonSelect
size="small"
value={createdWindow}
onChange={(window) => setCreatedWindow(window)}
options={CREATED_WINDOW_SELECT_OPTIONS}
- renderButtonContent={(leaf) => `Created: ${leaf?.label ?? 'Any time'}`}
+ icon={<IconCalendar />}
+ tooltip={`Created: ${createdWindowLabel(createdWindow)}`}
+ // The window value ("7d") doubles as the short label in a narrow container.
+ renderButtonContent={(leaf) => (
+ <>
+ <span className="@2xl:hidden">{leaf?.value ?? 'Any time'}</span>
+ <span className="hidden @2xl:inline">{leaf?.label ?? 'Any time'}</span>
+ </>
+ )}
data-attr="inbox-filter-created-window"
/>
)}
diff --git a/products/signals/frontend/inbox/components/shell/InboxSortSelect.tsx b/products/signals/frontend/inbox/components/shell/InboxSortSelect.tsx
new file mode 100644
index 000000000000..9894ccd21fc1
--- /dev/null
+++ b/products/signals/frontend/inbox/components/shell/InboxSortSelect.tsx
@@ -0,0 +1,51 @@
+import { useActions, useValues } from 'kea'
+
+import { IconSort } from '@posthog/icons'
+import { LemonSelect } from '@posthog/lemon-ui'
+
+import { INBOX_MODEL_SORT_OPTIONS, INBOX_SORT_OPTIONS, inboxSortOptionKey, InboxSortOption } from '../../filterOptions'
+import { inboxFiltersLogic } from '../../logics/inboxFiltersLogic'
+
+// No per-option icons: the trigger always shows the sort icon, and a second icon would crowd the
+// label the order is already stated in.
+const toSortSelectOption = (option: InboxSortOption): { value: string; label: string; tooltip?: string } => ({
+ value: inboxSortOptionKey(option.field, option.direction),
+ label: option.label,
+ tooltip: option.description,
+})
+const SORT_SELECT_OPTIONS = INBOX_SORT_OPTIONS.map(toSortSelectOption)
+const SORT_SELECT_SECTIONS_WITH_MODEL = [
+ { options: SORT_SELECT_OPTIONS },
+ { title: 'Model scores', options: INBOX_MODEL_SORT_OPTIONS.map(toSortSelectOption) },
+]
+const ALL_SORT_OPTIONS = [...INBOX_SORT_OPTIONS, ...INBOX_MODEL_SORT_OPTIONS]
+
+/**
+ * The report list's sort order. It orders the list rather than narrowing it, so it sits after the
+ * filters. In a narrow container the trigger shows only the icon, and the tooltip names the order.
+ */
+export function InboxSortSelect(): JSX.Element {
+ const { activeSortField, activeSortDirection, modelSortAvailable } = useValues(inboxFiltersLogic)
+ const { setSort } = useActions(inboxFiltersLogic)
+ const sortOptions = modelSortAvailable ? ALL_SORT_OPTIONS : INBOX_SORT_OPTIONS
+ const activeKey = inboxSortOptionKey(activeSortField, activeSortDirection)
+ const activeLabel = sortOptions.find((o) => inboxSortOptionKey(o.field, o.direction) === activeKey)?.label ?? ''
+
+ return (
+ <LemonSelect
+ size="small"
+ value={activeKey}
+ onChange={(key) => {
+ const option = sortOptions.find((o) => inboxSortOptionKey(o.field, o.direction) === key)
+ if (option) {
+ setSort(option.field, option.direction)
+ }
+ }}
+ options={modelSortAvailable ? SORT_SELECT_SECTIONS_WITH_MODEL : SORT_SELECT_OPTIONS}
+ icon={<IconSort />}
+ tooltip={`Sort: ${activeLabel}`}
+ renderButtonContent={(leaf) => <span className="hidden @2xl:inline">{leaf?.label ?? ''}</span>}
+ data-attr="inbox-sort"
+ />
+ )
+}
diff --git a/products/signals/frontend/inbox/components/shell/InboxTriageButton.tsx b/products/signals/frontend/inbox/components/shell/InboxTriageButton.tsx
new file mode 100644
index 000000000000..53767e8cc631
--- /dev/null
+++ b/products/signals/frontend/inbox/components/shell/InboxTriageButton.tsx
@@ -0,0 +1,65 @@
+import { useValues } from 'kea'
+
+import { LemonButton } from '@posthog/lemon-ui'
+import { Button, Kbd } from '@posthog/quill'
+
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { KeyboardShortcut } from 'lib/lemon-ui/KeyboardShortcut/KeyboardShortcut'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { humanFriendlyNumber } from 'lib/utils/numbers'
+import { urls } from 'scenes/urls'
+
+import { reportListLogic, sectionListLogicProps } from '../../logics/reportListLogic'
+import { INBOX_PRIMARY_REPORT_SECTION_KEY } from '../../types'
+
+const TRIAGE_TOOLTIP = 'Go through the reports that need a pull request one at a time'
+const NOTHING_TO_TRIAGE = 'No reports in this view need a pull request'
+// pinned: autocapture selector. Triage usage insights filter clicks on this data-attr.
+const TRIAGE_DATA_ATTR = 'inbox-triage-mode'
+
+function triageLabel(count: number | null): string {
+ if (count === null) {
+ return 'Triage mode'
+ }
+ return `Triage ${humanFriendlyNumber(count)} ${count === 1 ? 'report' : 'reports'}`
+}
+
+/**
+ * Opens triage mode from the scene header. It is an action, not a filter, so it sits apart from the
+ * filter row. Triage walks the primary section with the Reports tab's filters and scope, so the
+ * count comes from that same section and matches what triage will show.
+ */
+export function InboxTriageButton(): JSX.Element {
+ const { count } = useValues(reportListLogic(sectionListLogicProps(INBOX_PRIMARY_REPORT_SECTION_KEY)))
+ const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
+ const disabledReason = count === 0 ? NOTHING_TO_TRIAGE : undefined
+ const label = triageLabel(count)
+
+ if (todayRailNav) {
+ return (
+ <Button
+ variant="primary"
+ render={<LinkPrimitive to={urls.inboxTriage()} />}
+ tooltip={TRIAGE_TOOLTIP}
+ disabledReason={disabledReason}
+ data-attr={TRIAGE_DATA_ATTR}
+ >
+ {label}
+ <Kbd>T</Kbd>
+ </Button>
+ )
+ }
+ return (
+ <LemonButton
+ type="primary"
+ size="small"
+ to={urls.inboxTriage()}
+ sideIcon={<KeyboardShortcut t />}
+ tooltip={TRIAGE_TOOLTIP}
+ disabledReason={disabledReason}
+ data-attr={TRIAGE_DATA_ATTR}
+ >
+ {label}
+ </LemonButton>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx b/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx
index a0f9bee53fcf..3d61402639fe 100644
--- a/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx
+++ b/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx
@@ -3,9 +3,6 @@ import { Fragment, JSX, memo, useCallback, useEffect, useRef } from 'react'
import { LemonButton, LemonDivider } from '@posthog/lemon-ui'
-import { KeyboardShortcut } from 'lib/lemon-ui/KeyboardShortcut/KeyboardShortcut'
-import { urls } from 'scenes/urls'
-
import { isRankingSortField } from '../../filterOptions'
import { captureInboxViewed } from '../../inboxAnalytics'
import { inboxSceneLogic } from '../../inboxSceneLogic'
@@ -35,6 +32,7 @@ import { InboxActivationPanel } from '../onboarding/InboxActivationPanel'
import { InboxBulkSelectionBar } from '../shell/InboxBulkSelectionBar'
import { InboxReportFilters } from '../shell/InboxReportFilters'
import { InboxScopeFilter } from '../shell/InboxScopeFilter'
+import { InboxSortSelect } from '../shell/InboxSortSelect'
import { useReportImpressions } from '../useReportImpressions'
import { useSelectableReportList } from '../useSelectableReportList'
@@ -355,20 +353,20 @@ export function ReportsTab(): JSX.Element {
return (
<div className="mx-auto flex w-full max-w-4xl flex-col gap-4 px-6 py-3">
- <div className="flex flex-wrap items-center gap-x-3 gap-y-2">
- <InboxReportFilters />
- <div className="ml-auto flex shrink-0 items-center gap-2">
- <LemonButton
- type="primary"
- size="small"
- to={urls.inboxTriage()}
- sideIcon={<KeyboardShortcut t />}
- tooltip="Go through the reports that need a pull request one at a time"
- data-attr="inbox-triage-mode"
- >
- Triage mode
- </LemonButton>
- <InboxScopeFilter />
+ {/* When the row runs out of room it wraps at the divider: filters on one line, sort and
+ scope on the next. The divider sits in the gap left of the sort group, so on a wrapped
+ line it falls outside the clipped edge instead of leading the line. The sort group
+ grows so scope always ends the row. */}
+ <div className="@container -mx-1 overflow-x-clip px-1">
+ <div className="flex flex-wrap items-center gap-2">
+ <InboxReportFilters />
+ <div className="relative flex flex-1 items-center gap-2">
+ <LemonDivider vertical className="absolute inset-y-1 -left-[5px] m-0" />
+ <InboxSortSelect />
+ <div className="ml-auto shrink-0">
+ <InboxScopeFilter />
+ </div>
+ </div>
</div>
</div>
<InboxBulkSelectionBar reports={rows.map(({ report }) => report)} />