:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(analytics): move the view all page onto quill's table and filters (#127865)
Adam Leithc4b51b3df866
diff --git a/frontend/package.json b/frontend/package.jsonindex 487b7f11e9c4..618f4472ea98 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -188,6 +188,7 @@"@simplewebauthn/browser": "^13.2.2","@stripe/react-stripe-js": "^2.8.0","@stripe/stripe-js": "^4.5.0",+ "@tanstack/react-table": "^8.21.3","@tanstack/react-virtual": "^3.14.3","@testing-library/dom": ">=9.3.4","@tiptap/core": "3.20.6",diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex a55c2f29e074..d45bf22b9015 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -10183,45 +10183,45 @@ snapshots:scenes-app-ai-observability-trace-view-trace-view-switch--on-old-view--light:hash: v1.k794b7964.de72868c75c31f3ba3d9813b5f86064d7dbf37bc1a896b8f13032dc102758876.Xpri2jtS8YkCfKQmwMkmtGGWN8oTE_vfUOaiXtOwJK0scenes-app-analytics--list--dark:- hash: v1.k794b7964.e2b3df655260624d8df50a1bbb9a18eaad654d12da3ef512a592072aa5c2382e.Aht2-rzvHA_nth4ZO2tbqY1JHHa8WvMlFqu9OdQT2cA+ hash: v1.k794b7964.e692f466abc16179add1bb5dc8a717feeaf04a5b13523b0f716d6b4bb8811679.LQEOSA8cElMG8UsjhfDN9J_IgtUg02T1wq8RClGnENIscenes-app-analytics--list--light:- hash: v1.k794b7964.93c2da87f3755d44ff76151998d316d8bbfe331338d6b0926f807c3f62736a0f.A2fR-fWKVFojN-VZneH3-6ql3IbWtygSKCAtL8RBHBI+ hash: v1.k794b7964.cfc4cafc34799e7e4afa5b0447fc6d4a5ee8d4d5f356b6f663684da23000511f.ckEaNMYDpKRELv-OeQMaoyOCX0dyEO4h1g8ThvMhXUsscenes-app-analytics--list-empty--dark:- hash: v1.k794b7964.7c39061eb8737ec9ba5b858ad3ffa9167688f7bdf3c3e5be524c87fc81f7daf4.4pPWDF6HSXEhVN0CubKXJVzgVI0lMVaJVX49tqlmU0M+ hash: v1.k794b7964.afef18e8ff3928baa023aa38cd55c9ca22a2ab3619496369dadb4bebf07915cf.nWOkQRFn1glwnJrZPUld8yifo-TLr7bLXgU9jf6NPF0scenes-app-analytics--list-empty--light:- hash: v1.k794b7964.453e73c8cd947371468b8098ebc80d189bd5e9be4f31b087fcfb153e80867a16.657NRSidr9i3Sx3DNGgzi3nNC8HnXpKZ0EwHzBzAYvg+ hash: v1.k794b7964.266f9116ed755293ebd904a782462013fcf6dc501343a5cf34baf77a7a49badd.dbZ5stdvTljrUnXImsToYvIOMmrsctAyfh-2WfLG7RAscenes-app-analytics--list-error--dark:- hash: v1.k794b7964.f37e14a447a6020a180dc6cd227183bc87f95ed19b4494685cc0b57703a84e27.81OcLdqCVIdFsTfomp7sYUM4ysNcl0xC0adsx2uTLlQ+ hash: v1.k794b7964.2b140e33595866ae16438a1cc907268179c2173a65621e1c0c841a377a2bb8f7.BHBb0udBzHF1sX3WkbeauIHXbf3uEawCKydwPHc-CyIscenes-app-analytics--list-error--light:- hash: v1.k794b7964.3b77e8cfcf643e336919da33b6a12bcc2e9943eda7bbaac535f875a62cd94b07.4wktcNBCgjAQ7oaVK18hX6ofrRkeFN6g08ZdBdF-SUc+ hash: v1.k794b7964.4cce0c1817aa569a4acedc0dea4d7576258cf261835b3b89493219d9ae9de45d.2FQcopLiv5Ok4q0necr9EENHFjhT8hjQ_OvLBrP1Df0scenes-app-analytics--list-filtered--dark:- hash: v1.k794b7964.4d17b600e47c392b1260f8ebdcc642430c4495cdf0b7f548ff0c192d073da754.-f7FCa_tpsGq8KDl-Mj3QTG_PvrL1gAMS9uPIMymcko+ hash: v1.k794b7964.46ac5832f4bc74b4d05361de09a5da14a70b7d05107ae0e79c21f4d516f3bf20.TpvvIcoIDSmS0tRAeMqDNmn74Y1HQsCmZ5-J0wUq8G8scenes-app-analytics--list-filtered--light:- hash: v1.k794b7964.113ef44c356f429d8607b4b19759d158dd43e83aeed955ce051191d4802ddc58.bZ_OygxLLs_MXpKYOOGw_gsaDGBeKE2tuthP-BYISU0+ hash: v1.k794b7964.4c48c45d6c8008aac2eb30c36c64e9ec9e4d44cb185f823ffd27a9449c03c64f.QbGVGX4woZ8mezfBoXnl1pBM0FCL74VQDiDqemDSbfAscenes-app-analytics--list-new-insight-dialog--dark:- hash: v1.k794b7964.7351c67a99aaca7572b229a18e3a012e646fe186dcdf519c8cdbb941a64d22cc.ZGEpI7Yj8iTpzQW8hWyA6b3kWackb6oecz3stYXmd7k+ hash: v1.k794b7964.cffd2f5c8cdc6fb70679052aeb1ffedadbd4e9527476091a79c23f090f4a9b76.tEppGrPgtsR6utovmkCannSdGI2Ch9zPngqt-9_2KkEscenes-app-analytics--list-new-insight-dialog--light:- hash: v1.k794b7964.fd968168e3a45e796d6ab780973d0cc2f00d9d4df8c928e72929ed0c5c43329e.tEYr0M-xJVRnN3y60n79st-JCzaN2Xui2MagB24bA4s+ hash: v1.k794b7964.fc56f76aec640e1f0acea89c3893dc0f48abaabc6550c707a537e2f4e41c22e7.91c5PxweWpKxFDQEpx9pRIbIhz9_7yxbHNLJWWos5-Ascenes-app-analytics--list-no-matches--dark:- hash: v1.k794b7964.d59de941410f1403ad53f475891cab5abf0f108b1d28d3cd214b8d1434a8074e.FVmKqWG1tDJlFyuCYKiYmHYjaOmVqxFw7e1yntqlahM+ hash: v1.k794b7964.a70673d68182ff6fd3a22558e415b0455cac357362222b96ed4c6bf569760671.bEoOJIvoBTlL64mgRN7wyafErow55hqveNmClOd4q1Escenes-app-analytics--list-no-matches--light:- hash: v1.k794b7964.57a666ae9920becaf7fea2a5aa5b148f025a8fdd1929f80959334ab94f872cee.6il2qKsu7TdRenfqTvosPOh0vdYz04wGRtdsFsCsXpY+ hash: v1.k794b7964.bd8b6c57129cc71d80c05c6b67e0c259dbba1c588531d82e488af5cd8d98fc90.6NfBZ95wYFq5MIJEUjfs14-oJNJpUaB_t3E54vb5nq0scenes-app-analytics--list-share-dialog--dark:hash: v1.k794b7964.5d73b355d980270198e7ce6c2f8df4ad6231f74517b815e3ec48db433a612b41.qG99vq4HpkVoboXGFkQHI0RTQxHCzHbH8BIBcSJiG54scenes-app-analytics--list-share-dialog--light:hash: v1.k794b7964.d1e4f3264ce1ce3cc926bd0fd7ca481116962c956da863d14f55a18eab5ab03c.3sPci23BXnf6Gj2PoDh1z6PhFaXePUVwibiEkKVsJjAscenes-app-analytics--list-space--dark:- hash: v1.k794b7964.690ac92a7e0541239bf9f34af2afb37190d8bc9ff05ff4295988db3240e871c1.yp5BZHegpEJknJt6C5j2FOvmQuAXmZskWMnql__T3pY+ hash: v1.k794b7964.5b5512afeeca64aa23042dd9c37193df6e5e734fc79a058fe7ddc0f8ba914902.uBtoekT_7whVi7mtg6dly1Npr1ZGzUNANcPy23rJZ-oscenes-app-analytics--list-space--light:- hash: v1.k794b7964.b0b3d3663806b923eb1da41c84dfd4e230f2f8197e70eb4ef6c27b5901df58e0.y2y2wdLWEbyQnIJDZCior34SZD5NQq3Swz4iziJLA1w+ hash: v1.k794b7964.9895099030383e485a4b6e930fa563b162729c1c6c7d29b9d13821967b02ae12.qa1tp8L4G2W5X4T74iJEYWEeff52ep6qV3I6OeRuQG4scenes-app-analytics--mine--dark:- hash: v1.k794b7964.9dc8cb3ff02d9d3e02053feeee8b7d601946628556f69ba82cb10b9a873a9d8b.uFod9Cu6f-58SYwGLFveqOnezwgUePJD8FLatb46Fmw+ hash: v1.k794b7964.936d73397946b9cb8e24946f976f51ad4b5237bd6a4d95eb3f56249a2a9e17e4.FOz5cIDZwPT_oyz6sl4vdvl-2krBEM0xVrD641boc4Mscenes-app-analytics--mine--light:- hash: v1.k794b7964.9e10193fe52e3b6ac811b27aa21a70e06a52c74faa3a36c754c27e8df2d1565a.UCOaf7E2z1dOuP2cHWSLXiIe1MdRrDad2gfnDCu-dKE+ hash: v1.k794b7964.693dc8e2ba1a76baafdd474f55052cc9f9a7cb35c0c7d78cbe8a3e55e1151161.8n0mavfqakwMvYQEvxlvZeL5vxqPzBR782tZqe9y8IAscenes-app-analytics--spaces--dark:- hash: v1.k794b7964.83d713490aa8c83bb30d3e7ad6b22a77fe043313d8b28d8006d758bd0d2e8853.m8_tPhCdyW6UkHKwcyVy7ealY2OscaIJBFpPTWvzrZY+ hash: v1.k794b7964.52ed0a9a6baa86be856facd93bf6357da89252dfa633f504179c989ee38e7573.UK0vuxIqnUWDYeAqjQV08Mm2ZrlM5L5JAmaA0GMTNB0scenes-app-analytics--spaces--light:- hash: v1.k794b7964.ba7d6366ac4c9a8396d50b4179c48b78e0b909e06be3bfc57531677ffd771a02.p9n5hEHhSfnpjHOOApRU0PCcNfvzZS3m-WJNHp4f9uc+ hash: v1.k794b7964.abde1664b1047570d9848215001a0c3415b04e80d7bc78a770332054172a3aa8.5JFqQPKrigKgffi-n02FCxUESUZk0tIs3Ntw00C-o0gscenes-app-annotations--annotations--dark:hash: v1.k794b7964.651aae7146d31971a314f627499eafdaa3d35933cde8dd0ad47abc6eab722148.H9u02T71vFBWS4vd-5sVVqacwrqXc9xeeOHs7b4qnL4scenes-app-annotations--annotations--light:diff --git a/frontend/src/design.md b/frontend/src/design.mdindex 5af09b2f7b25..0b97849ad704 100644--- a/frontend/src/design.md+++ b/frontend/src/design.md@@ -206,16 +206,20 @@ Use via Tailwind utilities (`bg-primary text-primary-foreground`, `border-border- A menu sizes to its longest row, never narrower than its trigger. Don't set a width on `DropdownMenuContent` unless the content needs a fixed one- A row with a second line takes `description` on `DropdownMenuItem` or `DropdownMenuSubTrigger`. Never stack the text yourself: the row has a fixed height until `description` tells it to grow- A menu item that navigates calls the router in `onClick`. Never pass a Link through the item's `render`: the item already uses `render` for its row styling+ - Every list of choices shows what is chosen, in the same place: a radio dot for one choice, a check for several, in a gutter before the label. A chosen row is never told apart by color or a trailing mark alone+ - That gutter comes from Quill, so use the item as it is (`DropdownMenuRadioItem`, `DropdownMenuCheckboxItem`, `SelectItem`, `ComboboxItem`, `ItemRadio`, `ItemCheckbox`), and never add a check by hand. An option's label lines up with the other options, whether it is chosen or not. If the mark touches the label, fix the item in Quill, not at the call site+ - Before handoff, open every list you touched with a value chosen and look at it. A list with nothing chosen hides this bug- Icon-only menu trigger: `aria-label` and a tooltip with the same string, as for any icon-only button- A list of clickable rows (tickets, programs, recent items) → `CardGroup` of `Card size="sm"`, each holding one full-width `<button>` or `<a>`. Item has no clickable variant. `Item tone` is for callouts only, such as a warning or an incident notice- Switching views: Tabs (sections of one page; `variant="line"` for page-level) | ToggleGroup (2–4 display modes) | Select (many views, low priority)-- Filtering a list in a compact area (a sidebar pane, a side panel, a picker inside a menu):- - A search field (`InputGroup size="sm"`) and, beside it, one icon-only funnel button (`TodayFilterMenuTrigger`). Never a row of selects: it does not fit, and it hides which filters exist- - The funnel opens a DropdownMenu with one row per filter: the label on the left and the choice in force on the right, opening a submenu of the options (`TodayRecentRadioSubmenu`). One choice → radio items; several → checkbox items. The default comes first ("Any user", "All")- - While any filter differs from its default, the funnel shows a dot and reads "Filters on", and that row's value takes the primary color- - "Clear filters" is the last row, after a separator, `variant="destructive"`, and only shows while a filter is on+- Filtering a list, anywhere (a scene, a sidebar pane, a side panel, a picker inside a menu):+ - A search field and, beside it, one `FilterMenuTrigger`, Quill's funnel button. Never a row of selects or filter buttons, even when there is room: it wraps on a narrow scene, and it differs from every other list. In a compact area the search field is `InputGroup size="sm"`+ - Everything that shapes the list lives in that one menu, built from Quill's `Filter*` parts, in this order, with a separator between the groups: group and sort, the filters, display choices, then `FilterClearItem`. No separate Sort or Display button beside it. Group, sort and display choices are not filters, so they never light the dot+ - Each filter is one row: the label on the left and the choice in force on the right, opening a submenu of the options. One choice → `FilterRadioSubMenu`. Several from a short list → `FilterCheckboxSubMenu`. Several from a long list, such as people or tags → `FilterSearchSubMenu`. The default comes first ("Any user", "All")+ - While any filter differs from its default, the funnel shows a dot at its top right and reads "Filters on", and that row's value takes the primary color. The search text is not a filter, so it never lights the dot+ - "Clear filters" is the last row of that menu, and only shows while a filter is on. It is the only way to clear from the toolbar: no "Clear selection" row in a submenu, and no "Clear filters" button beside the funnel. The no-matches empty state may still offer one- Inside another menu (a picker), give the outer `DropdownMenu` `modal={false}`, or it blocks the filter menu's popup- - Precedent: `layout/today/TodayViewsFilterMenu`+ - Precedent: `scenes/analytics/AnalyticsFilterMenu`. A phone sheet, as in `layout/today/TodayRecentFilterMenu`, wraps the same rows- Text and numbers:- Input: single-line text. Beside default-size buttons, such as a search field next to a filter button, use `size="sm"` on `Input` or `InputGroup` so the heights match- Textarea: multi-line or long free text@@ -228,6 +232,7 @@ Use via Tailwind utilities (`bg-primary text-primary-foreground`, `border-border- Cards may contain an `ItemGroup`; never nest cards; never wrap a whole page section in a card- Table vs Item list:- Table: rows share columns users compare, sort, or scan vertically (DataTable when sorting/filtering/selection is needed)+ - A link in a table cell is a small link Button, never a bare Link: `<Button variant="link-foreground" size="sm" nativeButton={false} render={<LinkPrimitive to={url} />}>`. It keeps the foreground color and, on hover, shows the normal button fill, because a whole column of `primary` links is too loud. Use `link-muted` for a secondary link. The table keeps its text in line with the column header. See the Table `WithLinks` story- Item rows: heterogeneous entries (primary/secondary text + actions)- Overlays:- Tooltip:diff --git a/frontend/src/layout/scenes/components/QuillSceneStaticName.tsx b/frontend/src/layout/scenes/components/QuillSceneStaticName.tsxindex f216efbcd2bf..182839a4d57d 100644--- a/frontend/src/layout/scenes/components/QuillSceneStaticName.tsx+++ b/frontend/src/layout/scenes/components/QuillSceneStaticName.tsx@@ -72,10 +72,10 @@ export function QuillSceneStaticName({ name, icon, description, className }: Qui{copied ? (<div role="status">Copied</div>) : (- <>+ <div className="flex flex-col gap-0.5">{description && <div>{description}</div>}{copyableName && <div className="text-muted-foreground">Click to copy</div>}- </>+ </div>)}</TooltipContent></Tooltip>diff --git a/frontend/src/layout/today/TodayFilterMenuTrigger.tsx b/frontend/src/layout/today/TodayFilterMenuTrigger.tsxdeleted file mode 100644index 9397843a209e..000000000000--- a/frontend/src/layout/today/TodayFilterMenuTrigger.tsx+++ /dev/null@@ -1,33 +0,0 @@-import { IconFilter } from '@posthog/icons'-import { Button, DropdownMenuTrigger, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill'--/** The funnel button that opens a list's filter menu. A dot says a filter narrows the list. */-export function TodayFilterMenuTrigger({ active, dataAttr }: { active: boolean; dataAttr: string }): JSX.Element {- const label = active ? 'Filters on' : 'Filter'- return (- <Tooltip>- <TooltipTrigger- delay={0}- render={- <DropdownMenuTrigger- render={- <Button- size="icon"- aria-label={label}- className={cn(- 'relative text-muted-foreground',- active && 'bg-fill-selected text-foreground'- )}- data-attr={dataAttr}- />- }- />- }- >- <IconFilter />- {active && <span aria-hidden className="absolute top-0 right-0 size-1.5 rounded-full bg-primary" />}- </TooltipTrigger>- <TooltipContent>{label}</TooltipContent>- </Tooltip>- )-}diff --git a/frontend/src/layout/today/TodayRecentFilterMenu.tsx b/frontend/src/layout/today/TodayRecentFilterMenu.tsxindex fba6937ec85e..442b8f6763a0 100644--- a/frontend/src/layout/today/TodayRecentFilterMenu.tsx+++ b/frontend/src/layout/today/TodayRecentFilterMenu.tsx@@ -2,9 +2,17 @@ import { useActions, useValues } from 'kea'import { useState } from 'react'import { IconFilter } from '@posthog/icons'-import { Button, DropdownMenu, DropdownMenuContent, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill'+import {+ Button,+ DropdownMenu,+ DropdownMenuContent,+ FilterMenuTrigger,+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ cn,+} from '@posthog/quill'-import { TodayFilterMenuTrigger } from './TodayFilterMenuTrigger'import { todayListAppearanceLogic } from './todayListAppearanceLogic'import { DROPDOWN_PARTS, SHEET_PARTS } from './todayMenuParts'import {@@ -128,10 +136,8 @@ export function TodayRecentFilterMenu(): JSX.Element {<Buttonsize="icon-lg"aria-label={label}- className={cn(- 'relative text-muted-foreground',- active && 'bg-fill-selected text-foreground'- )}+ indicator={active ? 'default' : undefined}+ className={cn('text-muted-foreground', active && 'bg-fill-selected text-foreground')}onClick={() => {setSheetOpen(true)touchMenuOpened('filter')@@ -141,9 +147,6 @@ export function TodayRecentFilterMenu(): JSX.Element {}><IconFilter />- {active && (- <span aria-hidden className="absolute top-1 right-1 size-1.5 rounded-full bg-primary" />- )}</TooltipTrigger><TooltipContent>{label}</TooltipContent></Tooltip>@@ -156,7 +159,7 @@ export function TodayRecentFilterMenu(): JSX.Element {return (<DropdownMenu>- <TodayFilterMenuTrigger active={active} dataAttr="today-recent-filter" />+ <FilterMenuTrigger active={active} dataAttr="today-recent-filter" /><DropdownMenuContent align="end" className="min-w-56">{items}</DropdownMenuContent>diff --git a/frontend/src/layout/today/TodayRecentFilterSubmenu.tsx b/frontend/src/layout/today/TodayRecentFilterSubmenu.tsxindex f20ac142115b..59fd22c03d6d 100644--- a/frontend/src/layout/today/TodayRecentFilterSubmenu.tsx+++ b/frontend/src/layout/today/TodayRecentFilterSubmenu.tsx@@ -1,6 +1,6 @@import { ReactNode } from 'react'-import { DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, cn } from '@posthog/quill'+import { FilterSubMenu } from '@posthog/quill'import { useTodaySheetMenu } from './todaySheetMenuContext'import { TodaySheetSub } from './TodaySheetSub'@@ -29,19 +29,8 @@ export function TodayRecentFilterSubmenu({)}return (- <DropdownMenuSub>- <DropdownMenuSubTrigger>- <span>{label}</span>- <span- className={cn(- 'flex-1 truncate pl-4 text-right',- narrowed ? 'text-primary' : 'text-muted-foreground'- )}- >- {value}- </span>- </DropdownMenuSubTrigger>- <DropdownMenuSubContent>{children}</DropdownMenuSubContent>- </DropdownMenuSub>+ <FilterSubMenu label={label} value={value} active={narrowed}>+ {children}+ </FilterSubMenu>)}diff --git a/frontend/src/layout/today/TodayRecentSourceSubmenu.tsx b/frontend/src/layout/today/TodayRecentSourceSubmenu.tsxindex bdf5d9901cfc..b00b1af2bc25 100644--- a/frontend/src/layout/today/TodayRecentSourceSubmenu.tsx+++ b/frontend/src/layout/today/TodayRecentSourceSubmenu.tsx@@ -1,4 +1,4 @@-import { DropdownMenuCheckboxItem, DropdownMenuSeparator, ItemCheckbox } from '@posthog/quill'+import { DropdownMenuCheckboxItem, DropdownMenuSeparator, ItemCheckbox, filterSummary } from '@posthog/quill'import { recentSourceLabel } from './todayRecentFilters'import { TodayRecentFilterSubmenu } from './TodayRecentFilterSubmenu'@@ -14,10 +14,7 @@ interface TodayRecentSourceSubmenuProps {}function sourcesLabel(sources: string[]): string {- if (!sources.length) {- return 'Any source'- }- return sources.length > 2 ? `${sources.length} sources` : sources.map(recentSourceLabel).join(', ')+ return filterSummary(sources.map(recentSourceLabel), 'Any source', 'sources')}export function TodayRecentSourceSubmenu({diff --git a/frontend/src/layout/today/TodayShell.scss b/frontend/src/layout/today/TodayShell.scssindex fcc769801fff..5d58efd2746f 100644--- a/frontend/src/layout/today/TodayShell.scss+++ b/frontend/src/layout/today/TodayShell.scss@@ -240,7 +240,9 @@ body {}}-body.has-today-phone-layout :is(input, textarea, select) {+// Inputs are 16px on a phone, because iOS Safari zooms the page when an input under 16px gets focus. `data-compact` is+// for a field that must match the small rows it sits with, such as a search in a filter submenu. It takes that zoom.+body.has-today-phone-layout :is(input, textarea, select):not([data-compact]) {font-size: 1rem;}diff --git a/frontend/src/layout/today/TodayShell.tsx b/frontend/src/layout/today/TodayShell.tsxindex 32311a4bf4c6..37f0939ea5e5 100644--- a/frontend/src/layout/today/TodayShell.tsx+++ b/frontend/src/layout/today/TodayShell.tsx@@ -113,7 +113,8 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {className="group/header border-b-transparent"back={<TodaySidebarCollapseButton />}title={- <div className="flex min-w-0 items-center gap-1">+ // The header gap puts the title 2px to the right of the pane row labels. Pull it back so they line up.+ <div className="-ms-0.5 flex min-w-0 items-center gap-1"><h2 className="m-0 min-w-0 truncate text-base font-bold text-foreground">{paneTitle}</h2><TodaySidebarPinButton /></div>diff --git a/frontend/src/scenes/analytics/AnalyticsDisplayMenu.tsx b/frontend/src/scenes/analytics/AnalyticsDisplayMenu.tsxdeleted file mode 100644index 6d10509e9375..000000000000--- a/frontend/src/scenes/analytics/AnalyticsDisplayMenu.tsx+++ /dev/null@@ -1,70 +0,0 @@-import { useActions, useValues } from 'kea'--import {- Button,- DropdownMenu,- DropdownMenuCheckboxItem,- DropdownMenuContent,- DropdownMenuGroup,- DropdownMenuLabel,- DropdownMenuRadioGroup,- DropdownMenuRadioItem,- DropdownMenuSeparator,- DropdownMenuTrigger,-} from '@posthog/quill'--import { AnalyticsListDisplayConfiguration } from '~/queries/schema/schema-general'--import { analyticsListLogic } from './analyticsListLogic'--type AnalyticsSort = NonNullable<AnalyticsListDisplayConfiguration['default_sort']>--const SORT_OPTIONS: { value: AnalyticsSort; label: string }[] = [- { value: '-last_viewed_at', label: 'Last viewed' },- { value: '-created_at', label: 'Created' },-]--/** The person's own choices for every Analytics list, saved on their user. */-export function AnalyticsDisplayMenu(): JSX.Element {- const { insightsHidden, defaultSort } = useValues(analyticsListLogic)- const { setInsightsHidden, setDefaultSort } = useActions(analyticsListLogic)-- return (- <DropdownMenu>- <DropdownMenuTrigger- render={<Button variant="outline" size="sm" className="h-8" data-attr="analytics-list-display" />}- >- Display- </DropdownMenuTrigger>- <DropdownMenuContent align="end" className="min-w-48">- <DropdownMenuCheckboxItem- checked={insightsHidden}- closeOnClick={false}- onCheckedChange={(checked) => setInsightsHidden(checked)}- data-attr="analytics-list-hide-insights"- >- Hide insights- </DropdownMenuCheckboxItem>- <DropdownMenuSeparator />- <DropdownMenuGroup>- <DropdownMenuLabel>Default sort</DropdownMenuLabel>- <DropdownMenuRadioGroup- value={defaultSort}- onValueChange={(value) => setDefaultSort(value as AnalyticsSort)}- >- {SORT_OPTIONS.map((option) => (- <DropdownMenuRadioItem- key={option.value}- value={option.value}- closeOnClick={false}- data-attr="analytics-list-default-sort"- >- {option.label}- </DropdownMenuRadioItem>- ))}- </DropdownMenuRadioGroup>- </DropdownMenuGroup>- </DropdownMenuContent>- </DropdownMenu>- )-}diff --git a/frontend/src/scenes/analytics/AnalyticsDraggableRow.tsx b/frontend/src/scenes/analytics/AnalyticsDraggableRow.tsxindex 5f8e2284222a..7d7ac7b4212c 100644--- a/frontend/src/scenes/analytics/AnalyticsDraggableRow.tsx+++ b/frontend/src/scenes/analytics/AnalyticsDraggableRow.tsx@@ -49,7 +49,7 @@ export function AnalyticsDraggableRow({event.stopPropagation()}}}- className={cn('flex min-w-0 flex-1 items-center gap-2 overflow-hidden', isDragging && 'opacity-50')}+ className={cn('flex min-w-0 flex-1 items-center', isDragging && 'opacity-50')}>{children}</span>diff --git a/frontend/src/scenes/analytics/AnalyticsFilterMenu.tsx b/frontend/src/scenes/analytics/AnalyticsFilterMenu.tsxnew file mode 100644index 000000000000..f85db8d8abed--- /dev/null+++ b/frontend/src/scenes/analytics/AnalyticsFilterMenu.tsx@@ -0,0 +1,162 @@+import { useActions, useValues } from 'kea'++import { IconTrends } from '@posthog/icons'+import {+ DropdownMenu,+ DropdownMenuCheckboxItem,+ DropdownMenuContent,+ DropdownMenuSeparator,+ FilterCheckboxSubMenu,+ FilterClearItem,+ FilterMenuTrigger,+ FilterOption,+ FilterRadioSubMenu,+ FilterSearchSubMenu,+} from '@posthog/quill'++import { fullName } from 'lib/utils/strings'+import { userLogic } from 'scenes/userLogic'++import { membersLogic } from '~/models/membersLogic'+import { tagsModel } from '~/models/tagsModel'+import { AnalyticsListDisplayConfiguration } from '~/queries/schema/schema-general'++import { AnalyticsOrderBy } from './analyticsFeed'+import { analyticsListLogic } from './analyticsListLogic'+import { AnalyticsOwnerAvatar } from './AnalyticsOwner'+import { AnalyticsTypeIcon } from './AnalyticsTypeIcon'+import { ANALYTICS_TYPES, AnalyticsType } from './analyticsUtils'++type AnalyticsSort = NonNullable<AnalyticsListDisplayConfiguration['default_sort']>++const SORT_OPTIONS: FilterOption<AnalyticsOrderBy>[] = [+ { value: '-last_viewed_at', label: 'Last viewed' },+ { value: '-created_at', label: 'Created' },+]++// Only a header click or a link reaches these orders, so each shows as a row only while it is in force.+const OLDEST_FIRST_OPTIONS: Partial<Record<AnalyticsOrderBy, FilterOption<AnalyticsOrderBy>>> = {+ last_viewed_at: { value: 'last_viewed_at', label: 'Last viewed, oldest first' },+ created_at: { value: 'created_at', label: 'Created, oldest first' },+}++function isAnalyticsSort(orderBy: AnalyticsOrderBy): orderBy is AnalyticsSort {+ return orderBy === '-last_viewed_at' || orderBy === '-created_at'+}++const TYPE_OPTIONS: FilterOption<AnalyticsType>[] = ANALYTICS_TYPES.map((info) => ({+ value: info.type,+ label: info.pluralLabel,+ icon: (+ // eslint-disable-next-line react/forbid-dom-props+ <span className="flex items-center" style={{ color: info.color }}>+ <AnalyticsTypeIcon type={info.type} />+ </span>+ ),+}))++/**+ * The list's controls in one menu, laid out like the nav rail's: sort, then a row per filter, then display choices, then+ * Clear filters. The sort and display choices are saved on the person, so they never count as a filter.+ */+export function AnalyticsFilterMenu(): JSX.Element {+ const { filters, scope, insightsHidden, defaultSort, narrowingFiltersActive } = useValues(analyticsListLogic)+ const { setFilters, setInsightsHidden, setDefaultSort, clearNarrowingFilters } = useActions(analyticsListLogic)+ const { tags: allTags, tagsLoading } = useValues(tagsModel)+ const { loadTagsIfNeeded } = useActions(tagsModel)+ const { meFirstMembers, membersLoading } = useValues(membersLogic)+ const { ensureAllMembersLoaded } = useActions(membersLogic)+ const { user } = useValues(userLogic)+ const sort = filters.orderBy ?? defaultSort+ const oldestFirstOption = OLDEST_FIRST_OPTIONS[sort]++ return (+ <DropdownMenu+ onOpenChange={(open) => {+ // The Created by row names the people picked, so it needs them as soon as the menu shows.+ if (open && scope === 'all' && filters.createdBy.length > 0) {+ ensureAllMembersLoaded()+ }+ }}+ >+ <FilterMenuTrigger active={narrowingFiltersActive} dataAttr="analytics-list-filter" />+ <DropdownMenuContent align="start" className="min-w-64">+ <FilterRadioSubMenu+ label="Sort by"+ options={oldestFirstOption ? [...SORT_OPTIONS, oldestFirstOption] : SORT_OPTIONS}+ value={sort}+ onChange={(next) => {+ if (isAnalyticsSort(next)) {+ setDefaultSort(next)+ }+ }}+ optionDataAttr="analytics-list-default-sort"+ />+ <DropdownMenuSeparator />+ <FilterCheckboxSubMenu+ label="Type"+ allLabel="All types"+ allIcon={<IconTrends />}+ pluralNoun="types"+ // A link can still open the insight type, so its option stays while it is picked.+ options={TYPE_OPTIONS.filter(+ ({ value }) => !insightsHidden || value !== 'insight' || filters.types.includes('insight')+ )}+ selected={filters.types}+ onChange={(types) => setFilters({ types })}+ dataAttr="analytics-list-type-picker"+ optionDataAttr="analytics-list-type-filter"+ />+ {scope === 'all' && (+ <FilterSearchSubMenu+ label="Created by"+ allLabel="Any user"+ pluralNoun="people"+ options={meFirstMembers.map((member) => ({+ value: member.user.uuid,+ label: fullName(member.user) || member.user.email,+ icon: <AnalyticsOwnerAvatar owner={member.user} />,+ hint: member.user.uuid === user?.uuid ? '(you)' : undefined,+ }))}+ selected={filters.createdBy}+ onChange={(createdBy) => setFilters({ createdBy })}+ loading={membersLoading}+ searchPlaceholder="Search people"+ emptyText="No one matches"+ onOpen={ensureAllMembersLoaded}+ dataAttr="analytics-list-created-by"+ optionDataAttr="analytics-list-created-by-option"+ />+ )}+ <FilterSearchSubMenu+ label="Tags"+ allLabel="Any tag"+ pluralNoun="tags"+ options={allTags.map((tag) => ({ value: tag, label: tag }))}+ selected={filters.tags}+ onChange={(tags) => setFilters({ tags })}+ loading={tagsLoading}+ searchPlaceholder="Search tags"+ emptyText="No tag matches"+ onOpen={loadTagsIfNeeded}+ dataAttr="analytics-list-tags"+ optionDataAttr="analytics-list-tags-option"+ />+ <DropdownMenuSeparator />+ <DropdownMenuCheckboxItem+ checked={insightsHidden}+ closeOnClick={false}+ onCheckedChange={(checked) => setInsightsHidden(checked)}+ data-attr="analytics-list-hide-insights"+ >+ Hide insights+ </DropdownMenuCheckboxItem>+ <FilterClearItem+ active={narrowingFiltersActive}+ onClear={clearNarrowingFilters}+ dataAttr="analytics-list-clear"+ />+ </DropdownMenuContent>+ </DropdownMenu>+ )+}diff --git a/frontend/src/scenes/analytics/AnalyticsFilterPicker.tsx b/frontend/src/scenes/analytics/AnalyticsFilterPicker.tsxdeleted file mode 100644index 0430c7c47032..000000000000--- a/frontend/src/scenes/analytics/AnalyticsFilterPicker.tsx+++ /dev/null@@ -1,130 +0,0 @@-import { ReactNode, useRef, useState } from 'react'--import {- Button,- Combobox,- ComboboxContent,- ComboboxEmpty,- ComboboxInput,- ComboboxItem,- ComboboxList,- Spinner,- Text,-} from '@posthog/quill'--export interface AnalyticsFilterOption {- value: string- label: string- media?: ReactNode- /** A muted note after the label, such as "(you)". */- hint?: string-}--interface AnalyticsFilterPickerProps {- label: string- value: string[]- onChange: (value: string[]) => void- options: AnalyticsFilterOption[]- loading?: boolean- onOpen?: () => void- searchPlaceholder: string- emptyText: string- dataAttr: string-}--/** A filter that is a dropdown and a search at once: a button opens a searchable list to tick values in. */-export function AnalyticsFilterPicker({- label,- value,- onChange,- options,- loading,- onOpen,- searchPlaceholder,- emptyText,- dataAttr,-}: AnalyticsFilterPickerProps): JSX.Element {- const [open, setOpen] = useState(false)- const triggerRef = useRef<HTMLButtonElement>(null)- // The trigger opens the popup itself, so the list loads from here as well as from the combobox's own opens.- const toggle = (next: boolean): void => {- setOpen(next)- if (next) {- onOpen?.()- }- }- const selected = options.filter((option) => value.includes(option.value))- // Values the options do not know yet (a tag from the URL before the list loads) still count as picked.- const unknown = value.filter((item) => !options.some((option) => option.value === item))- const picked = [...selected, ...unknown.map((item) => ({ value: item, label: item }))]- return (- <Combobox- multiple- items={[...options, ...unknown.map((item) => ({ value: item, label: item }))]}- itemToStringValue={(option: AnalyticsFilterOption) => option.label}- isItemEqualToValue={(option: AnalyticsFilterOption, other: AnalyticsFilterOption) =>- option.value === other.value- }- value={picked}- onValueChange={(next: AnalyticsFilterOption[]) => onChange(next.map((option) => option.value))}- open={open}- onOpenChange={toggle}- >- <Button- ref={triggerRef}- variant="outline"- size="sm"- className="h-8"- aria-haspopup="listbox"- aria-expanded={open}- onClick={() => toggle(!open)}- data-attr={dataAttr}- >- {label}- {value.length > 0 && (- <Text size="xs" variant="muted" render={<span />}>- {value.length}- </Text>- )}- </Button>- <ComboboxContent anchor={triggerRef} className="min-w-64">- <ComboboxInput placeholder={searchPlaceholder} showTrigger={false} />- {value.length > 0 && (- <div className="px-1 pt-1">- <Button- variant="link-muted"- size="xs"- onClick={() => onChange([])}- data-attr={`${dataAttr}-clear`}- >- Clear selection- </Button>- </div>- )}- <ComboboxEmpty>- {loading ? (- <span className="flex items-center gap-2">- <Spinner />- Loading…- </span>- ) : (- emptyText- )}- </ComboboxEmpty>- <ComboboxList>- {(option: AnalyticsFilterOption) => (- <ComboboxItem key={option.value} value={option} title={option.label}>- {option.media}- <span className="truncate">{option.label}</span>- {option.hint && (- <Text size="xs" variant="muted" render={<span />} className="ml-auto">- {option.hint}- </Text>- )}- </ComboboxItem>- )}- </ComboboxList>- </ComboboxContent>- </Combobox>- )-}diff --git a/frontend/src/scenes/analytics/AnalyticsList.tsx b/frontend/src/scenes/analytics/AnalyticsList.tsxindex 5fcfc0746690..0ed37e92c943 100644--- a/frontend/src/scenes/analytics/AnalyticsList.tsx+++ b/frontend/src/scenes/analytics/AnalyticsList.tsx@@ -1,18 +1,20 @@import { useActions, useValues } from 'kea'-import { useEffect, useMemo } from 'react'+import { ReactNode, useEffect, useMemo, useState } from 'react'import { useInView } from 'react-intersection-observer'import {IconChevronDown,IconFolder,IconFolderPlus,+ IconList,+ IconPerson,IconPlus,IconSearch,IconTrash,- IconTrends,} from '@posthog/icons'import {Button,+ Card,DataTable,DropdownMenu,DropdownMenuContent,@@ -31,6 +33,7 @@ import {import { NotFound } from 'lib/components/NotFound'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { LinkPrimitive } from 'lib/lemon-ui/Link'+import { cn } from 'lib/utils/css-classes'import { SceneExport } from 'scenes/sceneTypes'import { urls } from 'scenes/urls'@@ -42,6 +45,7 @@ import { TodayAnalyticsNewFolderDialog } from '~/layout/today/TodayAnalyticsNewFimport { FileSystemEntry } from '~/queries/schema/schema-general'import { AnalyticsCreateModals } from './AnalyticsCreateModals'+import { analyticsOrderByOfColumn, parseAnalyticsOrderBy } from './analyticsFeed'import { AnalyticsFolderBreadcrumbs } from './AnalyticsFolderBreadcrumbs'import { AnalyticsListRow, analyticsListColumns } from './AnalyticsListColumns'import { AnalyticsListFilters } from './AnalyticsListFilters'@@ -54,6 +58,7 @@ import { NewAnalyticsMenu } from './NewAnalyticsMenu'import { ShareToSpaceDialog } from './ShareToSpaceDialog'const SCROLL_PREFETCH_MARGIN = '1200px 0px'+const EMPTY_COLLECTION: ReactNode = <Text size="sm">Nothing in this collection.</Text>export const scene: SceneExport = {component: AnalyticsList,@@ -85,22 +90,25 @@ function AnalyticsListContent(): JSX.Element {const { clearFilters, loadList, loadMore, setFilters } = useActions(analyticsListLogic)const { setNewFolderDialogOpen } = useActions(todayAnalyticsLogic)const { deleteItem } = useActions(projectTreeDataLogic)- const { ref: endRef, inView: endInView } = useInView({- root: document.getElementById('main-content'),+ const [tableViewport, setTableViewport] = useState<HTMLDivElement | null>(null)+ const { ref: tableEndRef, inView: tableEndInView } = useInView({+ root: tableViewport,rootMargin: SCROLL_PREFETCH_MARGIN,+ skip: !tableViewport,})+ // With no table on screen, a filter may have left out every row so far, so the next page may hold the first.+ const nearEnd = !tableViewport || tableEndInView// An opened page sends the person back to this exact list, filters included.const backUrl =scope === 'mine'? urls.analyticsMine(analyticsListUrlParams(filters)): urls.analyticsList(analyticsListUrlParams(filters))- const columns = analyticsListColumns({- backUrl,- showSpace: mode === 'feed',- showOwner: scope !== 'mine',- orderBy: feedQuery.orderBy,- onOrderByChange: (orderBy) => setFilters({ orderBy }),- })+ const showSpace = mode === 'feed'+ const showOwner = scope !== 'mine'+ const columns = useMemo(+ () => analyticsListColumns({ backUrl, showSpace, showOwner }),+ [backUrl, showSpace, showOwner]+ )const rows = useMemo<AnalyticsListRow[]>(() => [...subfolders.map((folder) => ({ kind: 'folder' as const, folder })),@@ -114,13 +122,13 @@ function AnalyticsListContent(): JSX.Element {const isSpaceRoot = !!topLevelSpace && topLevelSpace !== USERS_FOLDER && folderBreadcrumbs.length === 1useEffect(() => {- if (endInView && hasMore) {+ if (nearEnd && hasMore) {loadMore()}- }, [endInView, hasMore, loadedCount, loadMore])+ }, [nearEnd, hasMore, loadedCount, loadMore])const newButton = (- <NewAnalyticsMenu source="list" trigger={<Button variant="primary" size="sm" data-attr="analytics-list-new" />}>+ <NewAnalyticsMenu source="list" trigger={<Button variant="primary" data-attr="analytics-list-new" />}><IconPlus />New</NewAnalyticsMenu>@@ -137,6 +145,7 @@ function AnalyticsListContent(): JSX.Element {<EmptyContent><Buttonvariant="outline"+ size="sm"loading={loading}onClick={() => loadList()}data-attr="analytics-list-retry"@@ -148,7 +157,11 @@ function AnalyticsListContent(): JSX.Element {)}if (listState === 'loading') {- return <AnalyticsListSkeleton columns={columns} />+ return (+ <Card size="sm" flush className="pt-0">+ <AnalyticsListSkeleton columns={columns} />+ </Card>+ )}if (listState === 'no-matches') {return (@@ -163,6 +176,7 @@ function AnalyticsListContent(): JSX.Element {<EmptyContent><Buttonvariant="outline"+ size="sm"onClick={() => clearFilters()}data-attr="analytics-list-clear-filters">@@ -200,6 +214,7 @@ function AnalyticsListContent(): JSX.Element {) : (<Buttonvariant="outline"+ size="sm"nativeButton={false}render={<LinkPrimitive to={urls.analyticsSpaces()} />}data-attr="analytics-list-browse-all"@@ -213,19 +228,33 @@ function AnalyticsListContent(): JSX.Element {}return (<div- className={feedStale ? 'opacity-60 transition-opacity' : 'transition-opacity'}+ className={cn('flex min-h-0 flex-col transition-opacity', feedStale && 'opacity-60')}aria-busy={feedStale || hasMore}>{rows.length > 0 && (- <DataTable- columns={columns}- data={rows}- fullWidth- size="sm"- stickyHeader- className="w-full min-w-0 **:data-expand:min-w-64 **:data-expand:max-w-0 **:data-[slot=table]:min-w-208"- empty={<Text size="sm">Nothing in this collection.</Text>}- />+ <Card size="sm" flush className="min-h-0 pt-0">+ <DataTable+ columns={columns}+ data={rows}+ fullWidth+ size="sm"+ stickyHeader+ resizableColumns+ viewportRef={setTableViewport}+ viewportEndRef={tableEndRef}+ sorting={+ mode === 'feed' && feedQuery.orderBy ? [parseAnalyticsOrderBy(feedQuery.orderBy)] : []+ }+ onSortingChange={([sort]) => {+ const orderBy = sort && analyticsOrderByOfColumn(sort)+ if (orderBy) {+ setFilters({ orderBy })+ }+ }}+ className="flex min-h-0 flex-col [--quill-table-sticky-bg:var(--card)]"+ empty={EMPTY_COLLECTION}+ />+ </Card>)}{hasMore && (<div className="flex items-center justify-center gap-2 py-3" aria-busy>@@ -240,9 +269,9 @@ function AnalyticsListContent(): JSX.Element {}return (- <SceneContent>+ <SceneContent className="min-h-0 flex-1 pb-4"><SceneTitleSection- name={spaceName ?? (scope === 'mine' ? 'My work' : 'Analytics')}+ name={spaceName ?? (scope === 'mine' ? 'My work' : 'View all')}description={mode === 'folder'? null@@ -252,7 +281,13 @@ function AnalyticsListContent(): JSX.Element {}resourceType={{type: 'analytics',- forceIcon: spaceName ? <AnalyticsSpaceGlyph name={spaceName} /> : <IconTrends />,+ forceIcon: spaceName ? (+ <AnalyticsSpaceGlyph name={spaceName} />+ ) : scope === 'mine' ? (+ <IconPerson />+ ) : (+ <IconList />+ ),}}actions={<div data-quill className="flex items-center gap-2">@@ -304,7 +339,7 @@ function AnalyticsListContent(): JSX.Element {</div>}/>- <div data-quill className="@container/analytics flex flex-col gap-3">+ <div data-quill className="flex min-h-0 flex-1 flex-col gap-3">{mode === 'folder' && <AnalyticsFolderBreadcrumbs crumbs={folderBreadcrumbs} />}<AnalyticsListFilters />{listState === 'ready' && failedTypes.length > 0 && (@@ -326,7 +361,6 @@ function AnalyticsListContent(): JSX.Element {</div>)}{renderBody()}- <div ref={endRef} aria-hidden /></div><AnalyticsCreateModals /><ShareToSpaceDialog />diff --git a/frontend/src/scenes/analytics/AnalyticsListColumns.tsx b/frontend/src/scenes/analytics/AnalyticsListColumns.tsxindex e64f1ffd4299..cb0ba5320f6d 100644--- a/frontend/src/scenes/analytics/AnalyticsListColumns.tsx+++ b/frontend/src/scenes/analytics/AnalyticsListColumns.tsx@@ -1,3 +1,4 @@+import type { ColumnDef } from '@tanstack/react-table'import { useActions } from 'kea'import { router } from 'kea-router'@@ -7,7 +8,6 @@ import {IconFolder,IconFolderMove,IconFolderOpen,- IconShare,IconTrash,IconX,} from '@posthog/icons'@@ -24,7 +24,6 @@ import {TooltipContent,TooltipTrigger,} from '@posthog/quill'-import type { DataTableProps } from '@posthog/quill-components'import { TZLabel } from 'lib/components/TZLabel'import { LinkPrimitive } from 'lib/lemon-ui/Link'@@ -34,7 +33,6 @@ import { projectTreeDataLogic } from '~/layout/panel-layout/ProjectTree/projectTimport { escapePath } from '~/layout/panel-layout/ProjectTree/utils'import { AnalyticsDraggableRow } from './AnalyticsDraggableRow'-import type { AnalyticsFeedQuery } from './analyticsFeed'import { AnalyticsFolderDropTarget } from './AnalyticsFolderDropTarget'import type { FolderRow } from './analyticsListLogic'import { AnalyticsOwner } from './AnalyticsOwner'@@ -52,7 +50,7 @@ import {export type AnalyticsListRow = { kind: 'folder'; folder: FolderRow } | { kind: 'item'; item: AnalyticsItem }-export type AnalyticsListColumns = DataTableProps<AnalyticsListRow, unknown>['columns']+export type AnalyticsListColumns = ColumnDef<AnalyticsListRow>[]function EmptyCell(): JSX.Element {return (@@ -66,7 +64,11 @@ function TimeCell({ time }: { time: string | null }): JSX.Element {if (!time) {return <EmptyCell />}- return <TZLabel time={time} className="text-xs whitespace-nowrap text-muted-foreground" />+ return (+ <Text size="xs" variant="muted" render={<span />}>+ <TZLabel time={time} />+ </Text>+ )}// Two chips fit the fixed tags column; the rest fold into a count.@@ -104,39 +106,23 @@ function SpaceCell({ item }: { item: AnalyticsItem }): JSX.Element {const target = { type: item.type, ref: item.id, name: item.name }if (!item.spaceName) {return (- <Tooltip>- <TooltipTrigger- render={- <Button- variant="link-muted"- size="xs"- className="h-auto gap-1 px-0 text-xs"- onClick={() => openShareToSpace(target)}- data-attr="analytics-list-row-share"- />- }- >- None- <IconShare className="size-3" />- </TooltipTrigger>- <TooltipContent>Add to a collection</TooltipContent>- </Tooltip>+ <Button+ size="sm"+ tooltip="Add to a collection"+ onClick={() => openShareToSpace(target)}+ data-attr="analytics-list-row-share"+ >+ None+ <IconChevronDown />+ </Button>)}return (<DropdownMenu>- <DropdownMenuTrigger- render={- <Button- variant="link"- size="xs"- className="h-auto max-w-full gap-1.5 px-0 text-xs text-foreground"- data-attr="analytics-list-row-space"- />- }- >+ <DropdownMenuTrigger render={<Button size="sm" data-attr="analytics-list-row-space" />}><AnalyticsSpaceGlyph name={item.spaceName} />- <span className="truncate">{item.spaceName}</span>+ <span>{item.spaceName}</span>+ <IconChevronDown /></DropdownMenuTrigger><DropdownMenuContent align="start" className="min-w-60"><DropdownMenuItem@@ -146,7 +132,7 @@ function SpaceCell({ item }: { item: AnalyticsItem }): JSX.Element {data-attr="analytics-list-row-open-space"><IconFolderOpen />- {`Open "${item.spaceName}"`}+ <span>{`Open "${item.spaceName}"`}</span></DropdownMenuItem><DropdownMenuItem onClick={() => openShareToSpace(target)} data-attr="analytics-list-row-move"><IconFolderMove />@@ -249,17 +235,21 @@ function FolderTitle({ folder, draggable }: { folder: FolderRow; draggable: boolconst title = (<><IconFolder className="size-4 shrink-0 text-muted-foreground" aria-hidden />- <LinkPrimitive- to={urls.analyticsList({ folder: folder.path })}- className="truncate font-semibold text-foreground"+ <Button+ variant="link-foreground"+ size="sm"+ nativeButton={false}+ left+ render={<LinkPrimitive to={urls.analyticsList({ folder: folder.path })} />}+ className="min-w-0 shrink"data-attr="analytics-list-subfolder">- {folder.name}- </LinkPrimitive>+ <span className="truncate">{folder.name}</span>+ </Button></>)return (- <AnalyticsFolderDropTarget path={folder.path} className="flex min-w-48 items-center gap-2 overflow-hidden">+ <AnalyticsFolderDropTarget path={folder.path} className="flex items-center">{draggable && folder.entry ? (<AnalyticsDraggableRow entry={folder.entry}>{title}</AnalyticsDraggableRow>) : (@@ -294,17 +284,21 @@ function ItemTitle({</TooltipTrigger><TooltipContent>{ANALYTICS_TYPE_INFO[item.type].label}</TooltipContent></Tooltip>- <LinkPrimitive- to={analyticsOpenHref(item, backUrl)}- className="truncate font-semibold text-foreground"+ <Button+ variant="link-foreground"+ size="sm"+ nativeButton={false}+ left+ render={<LinkPrimitive to={analyticsOpenHref(item, backUrl)} />}+ className="min-w-0 shrink"data-attr={`analytics-list-row-${item.type}`}>- {item.name}- </LinkPrimitive>+ <span className="truncate">{item.name}</span>+ </Button></>)return (- <span className="flex min-w-48 items-center gap-2 overflow-hidden">+ <span className="flex items-center">{draggable && item.entry ? (<AnalyticsDraggableRow entry={item.entry}>{title}</AnalyticsDraggableRow>) : (@@ -314,27 +308,21 @@ function ItemTitle({)}-/**- * The list's columns. Every column but the title has a fixed width, so the title always gets the same- * remainder and the table does not resize as the rows change. The type shows as the title's icon.- */+/** The list's columns. The type shows as the title's icon. */export function analyticsListColumns({backUrl,showSpace,showOwner,- orderBy,- onOrderByChange,}: {backUrl: stringshowSpace: booleanshowOwner: boolean- orderBy: AnalyticsFeedQuery['orderBy']- onOrderByChange: (orderBy: NonNullable<AnalyticsFeedQuery['orderBy']>) => void}): AnalyticsListColumns {const draggable = !showSpacereturn [{id: 'name',+ minSize: 256,header: 'Title',meta: { expand: true },enableSorting: false,@@ -351,11 +339,8 @@ export function analyticsListColumns({id: 'space',header: 'Collection',enableSorting: false,- cell: ({ row }) => (- <div className="w-36">- {row.original.kind === 'item' ? <SpaceCell item={row.original.item} /> : <EmptyCell />}- </div>- ),+ cell: ({ row }) =>+ row.original.kind === 'item' ? <SpaceCell item={row.original.item} /> : <EmptyCell />,},] satisfies AnalyticsListColumns): []),@@ -363,11 +348,8 @@ export function analyticsListColumns({id: 'tags',header: 'Tags',enableSorting: false,- cell: ({ row }) => (- <div className="w-36">- {row.original.kind === 'item' ? <TagsCell tags={row.original.item.tags} /> : <EmptyCell />}- </div>- ),+ cell: ({ row }) =>+ row.original.kind === 'item' ? <TagsCell tags={row.original.item.tags} /> : <EmptyCell />,},...(showOwner? ([@@ -382,7 +364,6 @@ export function analyticsListColumns({? row.original.item.createdBy: (row.original.folder.createdBy ?? null)}- className="w-36"/>),},@@ -391,80 +372,38 @@ export function analyticsListColumns({...(showSpace? ([{- id: 'last_viewed',- header: () => (- <Button- variant="default"- size="xs"- className="px-0"- data-attr="analytics-list-sort-last-viewed"- onClick={() =>- onOrderByChange(orderBy === '-last_viewed_at' ? 'last_viewed_at' : '-last_viewed_at')- }- >- Last viewed- {orderBy === '-last_viewed_at' && <IconChevronDown />}- {orderBy === 'last_viewed_at' && <IconChevronDown className="rotate-180" />}- </Button>- ),- enableSorting: false,- cell: ({ row }) => (- <div className="w-24">- <TimeCell- time={- row.original.kind === 'item'- ? (row.original.item.entry?.last_viewed_at ?? null)- : null- }- />- </div>- ),+ id: 'last_viewed_at',+ header: 'Last viewed',+ accessorFn: (row) => (row.kind === 'item' ? (row.item.entry?.last_viewed_at ?? null) : null),+ sortDescFirst: true,+ enableMultiSort: false,+ meta: { sortDataAttr: 'analytics-list-sort-last-viewed' },+ cell: ({ getValue }) => <TimeCell time={getValue<string | null>()} />,},] satisfies AnalyticsListColumns): []),{- id: 'created',- header: () =>- showSpace ? (- <Button- variant="default"- size="xs"- className="px-0"- data-attr="analytics-list-sort-created"- onClick={() => onOrderByChange('-created_at')}- >- Created- {orderBy === '-created_at' && <IconChevronDown />}- </Button>- ) : (- 'Created'- ),- enableSorting: false,- cell: ({ row }) => (- <div className="w-24">- <TimeCell- time={- row.original.kind === 'item'- ? row.original.item.createdAt- : (row.original.folder.createdAt ?? null)- }- />- </div>- ),+ id: 'created_at',+ header: 'Created',+ accessorFn: (row) => (row.kind === 'item' ? row.item.createdAt : (row.folder.createdAt ?? null)),+ enableSorting: showSpace,+ sortDescFirst: true,+ enableMultiSort: false,+ meta: { sortDataAttr: 'analytics-list-sort-created' },+ cell: ({ getValue }) => <TimeCell time={getValue<string | null>()} />,},{id: 'actions',+ enableResizing: false,header: '',enableSorting: false,- cell: ({ row }) => (- <div className="flex w-8 justify-end">- {row.original.kind === 'item' ? (- <ItemMenuCell item={row.original.item} />- ) : (- <FolderMenuCell folder={row.original.folder} />- )}- </div>- ),+ meta: { align: 'right' },+ cell: ({ row }) =>+ row.original.kind === 'item' ? (+ <ItemMenuCell item={row.original.item} />+ ) : (+ <FolderMenuCell folder={row.original.folder} />+ ),},]}diff --git a/frontend/src/scenes/analytics/AnalyticsListFilters.tsx b/frontend/src/scenes/analytics/AnalyticsListFilters.tsxindex 29375b589cac..132f4dea97a0 100644--- a/frontend/src/scenes/analytics/AnalyticsListFilters.tsx+++ b/frontend/src/scenes/analytics/AnalyticsListFilters.tsx@@ -1,37 +1,13 @@import { useActions, useValues } from 'kea'-import { IconTrends } from '@posthog/icons'-import { Button, ToggleGroup, ToggleGroupItem } from '@posthog/quill'--import { fullName } from 'lib/utils/strings'-import { userLogic } from 'scenes/userLogic'--import { membersLogic } from '~/models/membersLogic'-import { tagsModel } from '~/models/tagsModel'--import { AnalyticsDisplayMenu } from './AnalyticsDisplayMenu'-import { AnalyticsFilterOption, AnalyticsFilterPicker } from './AnalyticsFilterPicker'+import { AnalyticsFilterMenu } from './AnalyticsFilterMenu'import { analyticsListLogic } from './analyticsListLogic'-import { AnalyticsOwnerAvatar } from './AnalyticsOwner'import { AnalyticsSearchInput } from './AnalyticsSearchInput'-import { AnalyticsTypeIcon } from './AnalyticsTypeIcon'-import { ANALYTICS_TYPES, AnalyticsTypeFilter } from './analyticsUtils'-/** Search, type, creator and the personal toggle, all one height so the row reads as one bar. */+/** Search, and beside it the one menu of the list's controls. */export function AnalyticsListFilters(): JSX.Element {- const { filters, filtersActive, searchInput, scope, insightsHidden } = useValues(analyticsListLogic)- const { setSearchInput, setFilters, clearFilters } = useActions(analyticsListLogic)- const { tags: allTags, tagsLoading } = useValues(tagsModel)- const { loadTagsIfNeeded } = useActions(tagsModel)- const { meFirstMembers, membersLoading } = useValues(membersLogic)- const { ensureAllMembersLoaded } = useActions(membersLogic)- const { user } = useValues(userLogic)- const memberOptions: AnalyticsFilterOption[] = meFirstMembers.map((member) => ({- value: member.user.uuid,- label: fullName(member.user) || member.user.email,- media: <AnalyticsOwnerAvatar owner={member.user} />,- hint: member.user.uuid === user?.uuid ? '(you)' : undefined,- }))+ const { searchInput } = useValues(analyticsListLogic)+ const { setSearchInput } = useActions(analyticsListLogic)return (<div className="flex flex-wrap items-center gap-2">@@ -42,73 +18,7 @@ export function AnalyticsListFilters(): JSX.Element {placeholder="Search"dataAttr="analytics-list-search"/>- <ToggleGroup- size="lg"- variant="default"- aria-label="Filter by type"- className="h-8"- value={[filters.type]}- onValueChange={(value: string[]) => value[0] && setFilters({ type: value[0] as AnalyticsTypeFilter })}- >- <ToggleGroupItem value="all" size="lg" data-attr="analytics-list-type-filter">- <IconTrends />- All- </ToggleGroupItem>- {ANALYTICS_TYPES.filter(- // A link can still open the insight type, so its tab stays while it is the one shown.- (info) => !insightsHidden || info.type !== 'insight' || filters.type === 'insight'- ).map((info) => (- <ToggleGroupItem- key={info.type}- value={info.type}- size="lg"- aria-label={info.pluralLabel}- title={info.pluralLabel}- data-attr="analytics-list-type-filter"- >- <span- className="flex items-center [&_svg]:size-4"- // eslint-disable-next-line react/forbid-dom-props- style={{ color: info.color }}- >- <AnalyticsTypeIcon type={info.type} />- </span>- <span className="hidden @6xl/analytics:inline">{info.pluralLabel}</span>- </ToggleGroupItem>- ))}- </ToggleGroup>- {scope === 'all' && (- <AnalyticsFilterPicker- label="Created by"- value={filters.createdBy}- onChange={(createdBy) => setFilters({ createdBy })}- onOpen={ensureAllMembersLoaded}- loading={membersLoading}- options={memberOptions}- searchPlaceholder="Search people"- emptyText="No one matches"- dataAttr="analytics-list-created-by"- />- )}- <AnalyticsFilterPicker- label="Tags"- value={filters.tags}- onChange={(tags) => setFilters({ tags })}- onOpen={loadTagsIfNeeded}- loading={tagsLoading}- options={allTags.map((tag) => ({ value: tag, label: tag }))}- searchPlaceholder="Search tags"- emptyText="No tag matches"- dataAttr="analytics-list-tags"- />- {filtersActive && (- <Button variant="link-muted" size="sm" onClick={() => clearFilters()} data-attr="analytics-list-clear">- Clear filters- </Button>- )}- <div className="ml-auto">- <AnalyticsDisplayMenu />- </div>+ <AnalyticsFilterMenu /></div>)}diff --git a/frontend/src/scenes/analytics/AnalyticsListSkeleton.tsx b/frontend/src/scenes/analytics/AnalyticsListSkeleton.tsxindex 79f15c31fa72..230bb2586137 100644--- a/frontend/src/scenes/analytics/AnalyticsListSkeleton.tsx+++ b/frontend/src/scenes/analytics/AnalyticsListSkeleton.tsx@@ -7,18 +7,14 @@ const COLUMN_LABELS: Record<string, string> = {space: 'Collection',tags: 'Tags',owner: 'Owner',- last_viewed: 'Last viewed',- created: 'Created',+ last_viewed_at: 'Last viewed',+ created_at: 'Created',}export function AnalyticsListSkeleton({ columns }: { columns: AnalyticsListColumns }): JSX.Element {return (<div aria-busy aria-label="Loading analytics">- <Table- fullWidth- size="sm"- className="w-full min-w-0 **:data-expand:min-w-64 **:data-expand:max-w-0 **:data-[slot=table]:min-w-208"- >+ <Table fullWidth size="sm" className="**:data-expand:min-w-64 **:data-expand:max-w-0"><TableHeader><TableRow>{columns.map((column) => (diff --git a/frontend/src/scenes/analytics/AnalyticsSearchInput.tsx b/frontend/src/scenes/analytics/AnalyticsSearchInput.tsxindex 58b19ee5263f..8e2b2a5cfb6c 100644--- a/frontend/src/scenes/analytics/AnalyticsSearchInput.tsx+++ b/frontend/src/scenes/analytics/AnalyticsSearchInput.tsx@@ -24,7 +24,7 @@ export function AnalyticsSearchInput({inputRef.current?.focus()}return (- <InputGroup className="h-8 w-56 max-w-full">+ <InputGroup size="sm" className="w-56 max-w-full"><InputGroupAddon align="inline-start"><InputGroupText><IconSearch />diff --git a/frontend/src/scenes/analytics/analyticsFeed.ts b/frontend/src/scenes/analytics/analyticsFeed.tsindex acd24392d356..89f483b9e278 100644--- a/frontend/src/scenes/analytics/analyticsFeed.ts+++ b/frontend/src/scenes/analytics/analyticsFeed.ts@@ -2,19 +2,33 @@ import api from 'lib/api'import { FileSystemEntry } from '~/queries/schema/schema-general'-import {- ANALYTICS_TYPES,- AnalyticsItem,- AnalyticsType,- AnalyticsTypeFilter,- fileSystemEntryToAnalytics,-} from './analyticsUtils'+import { ANALYTICS_TYPES, AnalyticsItem, AnalyticsType, fileSystemEntryToAnalytics } from './analyticsUtils'export const ANALYTICS_FEED_PAGE_SIZE = 20+const ANALYTICS_ORDER_BYS = ['-created_at', 'created_at', '-last_viewed_at', 'last_viewed_at'] as const++/** A column of the list, with a leading `-` for descending, as the file system API takes it. */+export type AnalyticsOrderBy = (typeof ANALYTICS_ORDER_BYS)[number]++export function isAnalyticsOrderBy(value: unknown): value is AnalyticsOrderBy {+ return ANALYTICS_ORDER_BYS.includes(value as AnalyticsOrderBy)+}++export function parseAnalyticsOrderBy(orderBy: AnalyticsOrderBy): { id: string; desc: boolean } {+ return { id: orderBy.replace('-', ''), desc: orderBy.startsWith('-') }+}++/** The order for a sorted column, or undefined for a column the list cannot sort on. */+export function analyticsOrderByOfColumn({ id, desc }: { id: string; desc: boolean }): AnalyticsOrderBy | undefined {+ const orderBy = `${desc ? '-' : ''}${id}`+ return isAnalyticsOrderBy(orderBy) ? orderBy : undefined+}+export interface AnalyticsFeedQuery {- type: AnalyticsTypeFilter- orderBy?: '-created_at' | '-last_viewed_at' | 'last_viewed_at'+ /** The types to list; empty means every type. */+ types: AnalyticsType[]+ orderBy?: AnalyticsOrderBysearch: string/** Creators' uuids; empty means anyone. The file system cannot filter on a uuid, so the rows are narrowed on the client. */createdBy: string[]@@ -22,12 +36,12 @@ export interface AnalyticsFeedQuery {createdByMe: boolean/** Tag names a row must all carry. Like the creator, narrowed on the client. */tags: string[]- /** Leaves insights out of the All list. Picking the insight type still shows them. */+ /** Leaves insights out of the list of every type. Picking the insight type still shows them. */hideInsights?: boolean}export const EMPTY_ANALYTICS_FEED_QUERY: AnalyticsFeedQuery = {- type: 'all',+ types: [],search: '',createdBy: [],createdByMe: false,@@ -68,10 +82,9 @@ export interface AnalyticsFeed {const TAGGABLE_ANALYTICS_TYPES: ReadonlySet<AnalyticsType> = new Set<AnalyticsType>(['dashboard', 'insight'])export function analyticsFeedTypes(query: AnalyticsFeedQuery): AnalyticsType[] {- const types =- query.type !== 'all'- ? [query.type]- : ANALYTICS_TYPES.map((info) => info.type).filter((type) => !query.hideInsights || type !== 'insight')+ const types = query.types.length+ ? query.types+ : ANALYTICS_TYPES.map((info) => info.type).filter((type) => !query.hideInsights || type !== 'insight')return query.tags.length ? types.filter((type) => TAGGABLE_ANALYTICS_TYPES.has(type)) : types}@@ -122,7 +135,7 @@ export async function fetchAnalyticsSourcePage(if (!item || !matchesAnalyticsQuery(item, query)) {return []}- if (query.orderBy && query.orderBy !== '-created_at') {+ if (query.orderBy && parseAnalyticsOrderBy(query.orderBy).id === 'last_viewed_at') {item.timestamp = entry.last_viewed_at ?? null}return [item]@@ -135,7 +148,7 @@ export function analyticsTime(item: AnalyticsItem, orderBy?: AnalyticsFeedQuery[return -Infinity}const time = new Date(item.timestamp).getTime()- return orderBy === 'last_viewed_at' ? -time : time+ return orderBy && !parseAnalyticsOrderBy(orderBy).desc ? -time : time}function analyticsItemComesFirst(@@ -198,6 +211,7 @@ export function analyticsFeedFromSources(sources: (AnalyticsSourceState | undefiloading: sources.some((source) => !source || source.loading || source.refreshing),hasMore: blocking.length > 0,failedTypes: failed.map((source) => source.type),- loadFailed: initialized && failed.length === sources.length && items.length === 0,+ // A tag filter on untaggable types leaves no sources at all, which is an empty list and not a failure.+ loadFailed: initialized && sources.length > 0 && failed.length === sources.length && items.length === 0,}}diff --git a/frontend/src/scenes/analytics/analyticsFeedLogic.test.ts b/frontend/src/scenes/analytics/analyticsFeedLogic.test.tsindex 532b050f5d57..3ae458a2f816 100644--- a/frontend/src/scenes/analytics/analyticsFeedLogic.test.ts+++ b/frontend/src/scenes/analytics/analyticsFeedLogic.test.ts@@ -228,8 +228,8 @@ describe('analyticsFeedLogic', () => {})describe('mergeAnalyticsSources view order', () => {- test.each(['-last_viewed_at', 'last_viewed_at'] as const)(- 'merges %s across types with unviewed rows last',+ test.each(['-last_viewed_at', 'last_viewed_at', '-created_at', 'created_at'] as const)(+ 'merges %s across types with rows that have no time last',(orderBy) => {const source = (type: 'dashboard' | 'notebook', days: (number | null)[]): AnalyticsSourceState => ({projectId: '1',@@ -253,9 +253,9 @@ describe('mergeAnalyticsSources view order', () => {failed: false,generation: 0,})- const dashboards = orderBy === '-last_viewed_at' ? [5, 2, null] : [2, 5, null]+ const dashboards = orderBy.startsWith('-') ? [5, 2, null] : [2, 5, null]const { items } = mergeAnalyticsSources([source('dashboard', dashboards), source('notebook', [3, null])])- const expected = orderBy === '-last_viewed_at' ? [5, 3, 2, null, null] : [2, 3, 5, null, null]+ const expected = orderBy.startsWith('-') ? [5, 3, 2, null, null] : [2, 3, 5, null, null]expect(items.map((item) => item.timestamp)).toEqual(expected.map((day) => (day === null ? null : at(day))))expect(items.slice(-2).map((item) => item.type)).toEqual(['notebook', 'dashboard'])}diff --git a/frontend/src/scenes/analytics/analyticsListLogic.test.ts b/frontend/src/scenes/analytics/analyticsListLogic.test.tsindex 7c75aedfccbc..3df19f054cbf 100644--- a/frontend/src/scenes/analytics/analyticsListLogic.test.ts+++ b/frontend/src/scenes/analytics/analyticsListLogic.test.ts@@ -99,6 +99,20 @@ describe('analyticsListLogic', () => {])})+ it('lets a sort chosen in the menu replace a header click', async () => {+ const logic = analyticsListLogic()+ logic.mount()+ await expectLogic(logic, () => router.actions.push(urls.analyticsList())).toFinishAllListeners()+ await expectLogic(logic, () => logic.actions.setFilters({ orderBy: 'created_at' })).toFinishAllListeners()+ expect(logic.values.feedQuery.orderBy).toBe('created_at')++ await expectLogic(logic, () => logic.actions.setDefaultSort('-last_viewed_at')).toFinishAllListeners()++ expect(logic.values.filters.orderBy).toBeUndefined()+ expect(logic.values.feedQuery.orderBy).toBe('-last_viewed_at')+ expect(router.values.searchParams.orderBy).toBeUndefined()+ })+it('opens each list on the Display default sort, and a header click sorts only that visit', async () => {userLogic.actions.loadUserSuccess({...userLogic.values.user!,@@ -143,10 +157,10 @@ describe('analyticsListLogic', () => {folder: false,})- await expectLogic(logic, () => logic.actions.setFilters({ type: 'insight' })).toFinishAllListeners()+ await expectLogic(logic, () => logic.actions.setFilters({ types: ['insight'] })).toFinishAllListeners()expect(logic.values.items.map((item) => item.type)).toContain('insight')await expectLogic(logic, () => logic.actions.setInsightsHidden(true)).toFinishAllListeners()- expect(logic.values.filters.type).toBe('all')+ expect(logic.values.filters.types).toEqual([])await expectLogic(logic, () => router.actions.push(urls.analyticsMine())).toFinishAllListeners()expect(logic.values.feedQuery.hideInsights).toBe(true)@@ -173,6 +187,44 @@ describe('analyticsListLogic', () => {expect(logic.values.items.map((item) => item.type)).toContain('insight')})+ it.each([+ ['one type as plain text', { type: 'canvas' }, ['canvas']],+ ['several types', { type: ['canvas', 'notebook'] }, ['canvas', 'notebook']],+ ['no type', {}, []],+ ['an unknown type', { type: ['canvas', 'nonsense'] }, ['canvas']],+ ])('reads %s from the URL', async (_, params, types) => {+ const logic = analyticsListLogic()+ logic.mount()+ router.actions.push(urls.analyticsList(params))+ await expectLogic(logic).toFinishAllListeners()+ expect(logic.values.filters.types).toEqual(types)+ })++ it('narrows the feed to every picked type', async () => {+ const logic = analyticsListLogic()+ logic.mount()+ logic.actions.setFilters({ types: ['canvas', 'notebook'] })+ await expectLogic(logic).toFinishAllListeners()+ expect(logic.values.feedQuery.types).toEqual(['canvas', 'notebook'])+ })++ it('drops only insights from the picked types when insights get hidden', async () => {+ const logic = analyticsListLogic()+ logic.mount()+ logic.actions.setFilters({ types: ['insight', 'notebook'] })+ logic.actions.setInsightsHidden(true)+ await expectLogic(logic).toFinishAllListeners()+ expect(logic.values.filters.types).toEqual(['notebook'])+ })++ it('shows no matches, not a load error, for a tag on types that carry no tags', async () => {+ const logic = analyticsListLogic()+ logic.mount()+ logic.actions.setFilters({ types: ['canvas'], tags: ['weekly'] })+ await expectLogic(logic).toFinishAllListeners()+ expect(logic.values.listState).toBe('no-matches')+ })+it('refreshes view times when URL filters restore a cached sorted list', async () => {const logic = analyticsListLogic()logic.mount()diff --git a/frontend/src/scenes/analytics/analyticsListLogic.ts b/frontend/src/scenes/analytics/analyticsListLogic.tsindex 7b5051b6fc09..2eca581bd39e 100644--- a/frontend/src/scenes/analytics/analyticsListLogic.ts+++ b/frontend/src/scenes/analytics/analyticsListLogic.ts@@ -28,6 +28,7 @@ import {AnalyticsFeedQuery,AnalyticsSourceState,analyticsFeedTypes,+ isAnalyticsOrderBy,analyticsSourceKey,} from './analyticsFeed'import { analyticsFeedLogic, selectAnalyticsFeed } from './analyticsFeedLogic'@@ -35,7 +36,7 @@ import { analyticsShareLogic } from './analyticsShareLogic'import {ANALYTICS_FILE_SYSTEM_TYPES,AnalyticsItem,- AnalyticsTypeFilter,+ AnalyticsType,fileSystemBaseType,fileSystemEntryName,fileSystemEntryToAnalytics,@@ -48,7 +49,8 @@ const FOLDER_PAGE_SIZE = ANALYTICS_FEED_PAGE_SIZEexport const DEFAULT_ANALYTICS_SORT: NonNullable<AnalyticsListDisplayConfiguration['default_sort']> = '-last_viewed_at'export interface AnalyticsListFilters {- type: AnalyticsTypeFilter+ /** Empty means every type. */+ types: AnalyticsType[]orderBy?: AnalyticsFeedQuery['orderBy']search: string/** User uuids; empty means anyone. */@@ -59,7 +61,7 @@ export interface AnalyticsListFilters {}export const DEFAULT_ANALYTICS_LIST_FILTERS: AnalyticsListFilters = {- type: 'all',+ types: [],search: '',createdBy: [],folder: null,@@ -101,15 +103,13 @@ function urlParamToString(value: unknown): string {}export function analyticsListFiltersFromUrl(params: Record<string, any>): AnalyticsListFilters {- const type = typeof params.type === 'string' && isAnalyticsType(params.type) ? params.type : 'all'const tags = Array.isArray(params.tags)? params.tags.filter((tag: unknown): tag is string => typeof tag === 'string'): []return {- type,- orderBy: ['-created_at', '-last_viewed_at', 'last_viewed_at'].includes(params.orderBy)- ? params.orderBy- : undefined,+ // A link can carry one type as plain text, such as the canvas product's `type=canvas`.+ types: stringList(params.type).filter(isAnalyticsType),+ orderBy: isAnalyticsOrderBy(params.orderBy) ? params.orderBy : undefined,search: urlParamToString(params.search),createdBy: stringList(params.createdBy),folder: params.folder === undefined || params.folder === null ? null : urlParamToString(params.folder),@@ -120,7 +120,7 @@ export function analyticsListFiltersFromUrl(params: Record<string, any>): Analytexport function analyticsListUrlParams(filters: AnalyticsListFilters): AnalyticsListUrlParams {return {orderBy: filters.orderBy,- type: filters.type === 'all' ? undefined : filters.type,+ type: filters.types.length ? filters.types : undefined,search: filters.search || undefined,createdBy: filters.createdBy.length ? filters.createdBy : undefined,folder: filters.folder ?? undefined,@@ -129,7 +129,9 @@ export function analyticsListUrlParams(filters: AnalyticsListFilters): Analytics}export function analyticsListFiltersActive(filters: AnalyticsListFilters): boolean {- return filters.type !== 'all' || !!filters.search.trim() || filters.createdBy.length > 0 || filters.tags.length > 0+ return (+ filters.types.length > 0 || !!filters.search.trim() || filters.createdBy.length > 0 || filters.tags.length > 0+ )}/** Narrows rows the server did not filter: folder contents come back whole. */@@ -143,7 +145,7 @@ export function filterAnalytics(return items.filter((item) =>filters.tags.every((tag) => item.tags.includes(tag)) &&- (filters.type === 'all' ? !insightsHidden || item.type !== 'insight' : item.type === filters.type) &&+ (filters.types.length ? filters.types.includes(item.type) : !insightsHidden || item.type !== 'insight') &&(!needle || item.name.toLowerCase().includes(needle)) &&(!createdBy.length || (!!item.createdBy && createdBy.includes(item.createdBy.uuid))))@@ -179,6 +181,7 @@ export interface analyticsListLogicValues {loadedCount: numberloading: booleanmode: AnalyticsListMode+ narrowingFiltersActive: booleanscope: AnalyticsListScopesearchInput: stringshownQuery: AnalyticsFeedQuery | null@@ -230,6 +233,9 @@ export interface analyticsListLogicActions {clearFilters: () => {value: true}+ clearNarrowingFilters: () => {+ value: true+ }loadFolderContents: (_: void) => voidloadFolderContentsFailure: (error: string,@@ -310,6 +316,7 @@ export interface analyticsListLogicMeta {__keaTypeGenInternalSelectorTypes: {mode: (filters: AnalyticsListFilters) => AnalyticsListModefiltersActive: (filters: AnalyticsListFilters) => boolean+ narrowingFiltersActive: (filters: AnalyticsListFilters, scope: AnalyticsListScope) => booleancurrentUserUuid: (user: UserType | null) => string | nullcreators: (filters: AnalyticsListFilters, currentUserUuid: string | null, scope: AnalyticsListScope) => string[]displayConfiguration: (uiConfiguration: UserUIConfiguration | null) => AnalyticsListDisplayConfiguration@@ -421,6 +428,7 @@ export const analyticsListLogic = kea<analyticsListLogicType>([/** Remembers URL filters without reading anything, for a visit the flag does not render yet. */storeFilters: (filters: AnalyticsListFilters) => ({ filters }),clearFilters: true,+ clearNarrowingFilters: true,setSearchInput: (search: string) => ({ search }),setFeedSearch: (search: string) => ({ search }),setShownQuery: (query: AnalyticsFeedQuery) => ({ query }),@@ -514,6 +522,15 @@ export const analyticsListLogic = kea<analyticsListLogicType>([(s) => [s.filters],(filters: AnalyticsListFilters): boolean => analyticsListFiltersActive(filters),],+ // What the funnel's dot means, so not the search text. My work has no Created by row, so a creator kept from+ // View all narrows nothing there.+ narrowingFiltersActive: [+ (s) => [s.filters, s.scope],+ (filters: AnalyticsListFilters, scope: AnalyticsListScope): boolean =>+ filters.types.length > 0 ||+ filters.tags.length > 0 ||+ (scope === 'all' && filters.createdBy.length > 0),+ ],// My work narrows to the person; View all narrows to whoever they picked.// The user record is replaced on every reload; its uuid is not, so the feed query only changes when the person does.currentUserUuid: [(s) => [s.user], (user: UserType | null): string | null => user?.uuid ?? null],@@ -549,7 +566,7 @@ export const analyticsListLogic = kea<analyticsListLogicType>([defaultSort: NonNullable<AnalyticsListDisplayConfiguration['default_sort']>,insightsHidden: boolean): AnalyticsFeedQuery => ({- type: filters.type,+ types: filters.types,// A header click sorts this visit through the URL; the next visit opens on the default again.orderBy: filters.orderBy ?? defaultSort,search: feedSearch.trim(),@@ -829,9 +846,9 @@ export const analyticsListLogic = kea<analyticsListLogicType>([folder: values.filters.folder !== null,})updateDisplay({ hide_insights: hidden })- if (hidden && values.filters.type === 'insight') {- // The insight tab goes away, so the list cannot stay on it.- actions.setFilters({ type: 'all' })+ if (hidden && values.filters.types.includes('insight')) {+ // The insight option goes away, so the list cannot stay on it.+ actions.setFilters({ types: values.filters.types.filter((type) => type !== 'insight') })} else if (values.mode === 'feed') {// A folder's rows are already loaded and narrowed on the client.loadCurrentMode()@@ -841,8 +858,10 @@ export const analyticsListLogic = kea<analyticsListLogicType>([// pinned: analytics event name and properties. Renaming them breaks dashboards.posthog.capture('analytics default sort changed', { order_by: orderBy, scope: values.scope })updateDisplay({ default_sort: orderBy })- // A sort in the URL is this visit's choice, so only a list on the default sort changes now.- if (values.mode === 'feed' && !values.filters.orderBy) {+ // The person just chose the order, so a sort from a header click or a link gives way to it.+ if (values.filters.orderBy) {+ actions.setFilters({ orderBy: undefined })+ } else if (values.mode === 'feed') {loadCurrentMode()}},@@ -854,7 +873,7 @@ export const analyticsListLogic = kea<analyticsListLogicType>([if (changed.length) {// pinned: analytics event name and `type` property. Renaming them breaks dashboards.posthog.capture('views list filtered', {- type: values.filters.type,+ type: values.filters.types.length > 1 ? 'multiple' : (values.filters.types[0] ?? 'all'),changed,created_by: !values.filters.createdBy.length? 'anyone'@@ -871,6 +890,9 @@ export const analyticsListLogic = kea<analyticsListLogicType>([actions.setFeedSearch(values.filters.search)actions.loadList()},+ clearNarrowingFilters: () => {+ actions.setFilters({ types: [], createdBy: [], tags: [] })+ },clearFilters: () => {actions.setFeedSearch('')loadCurrentMode()diff --git a/frontend/src/scenes/analytics/analyticsUtils.ts b/frontend/src/scenes/analytics/analyticsUtils.tsindex 6b0a272933a0..dd0e68b807f0 100644--- a/frontend/src/scenes/analytics/analyticsUtils.ts+++ b/frontend/src/scenes/analytics/analyticsUtils.ts@@ -12,7 +12,6 @@ import type { CanvasApi } from 'products/canvas/frontend/generated/api.schemas'// pinned: these values are the `type` property of the `views new picked` and `views list filtered` events.export type AnalyticsType = 'canvas' | 'notebook' | 'dashboard' | 'insight'-export type AnalyticsTypeFilter = AnalyticsType | 'all'export interface AnalyticsTypeInfo {type: AnalyticsTypediff --git a/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookFilterMenu.tsx b/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookFilterMenu.tsxindex b850de1b9437..bf5a6fa78e12 100644--- a/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookFilterMenu.tsx+++ b/frontend/src/scenes/notebooks/NotebookSelectButton/QuillNotebookFilterMenu.tsx@@ -1,12 +1,17 @@import { useActions, useValues } from 'kea'import { useMemo } from 'react'-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from '@posthog/quill'+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuSeparator,+ FilterMenuTrigger,+} from '@posthog/quill'import { fullName } from 'lib/utils/strings'import { userLogic } from 'scenes/userLogic'-import { TodayFilterMenuTrigger } from '~/layout/today/TodayFilterMenuTrigger'import { TodayRecentRadioSubmenu } from '~/layout/today/TodayRecentRadioSubmenu'import { membersLogic } from '~/models/membersLogic'@@ -38,7 +43,7 @@ export function QuillNotebookFilterMenu({return (<DropdownMenu onOpenChange={(open) => open && ensureAllMembersLoaded()}>- <TodayFilterMenuTrigger active={createdBy !== null} dataAttr="notebooks-select-button-filter" />+ <FilterMenuTrigger active={createdBy !== null} dataAttr="notebooks-select-button-filter" /><DropdownMenuContent align="end" className="min-w-56"><TodayRecentRadioSubmenulabel="Created by"diff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.tsindex 51b769825c30..914ed7e273a3 100644--- a/frontend/src/scenes/urls.ts+++ b/frontend/src/scenes/urls.ts@@ -37,7 +37,7 @@ import type { SettingId, SettingLevelId, SettingSectionId } from './settings/typ/** The filters the analytics list reads from its URL. */export interface AnalyticsListUrlParams {orderBy?: string- type?: string+ type?: string | string[]createdBy?: string[]folder?: stringsearch?: stringdiff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 7ee7092d65c3..ecf77529ae6b 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -940,6 +940,9 @@ importers:'@stripe/stripe-js':specifier: ^4.5.0version: 4.5.0+ '@tanstack/react-table':+ specifier: ^8.21.3'@tanstack/react-virtual':specifier: ^3.14.3diff --git a/products/tasks/frontend/spaces/SpaceFeedFilterMenu.tsx b/products/tasks/frontend/spaces/SpaceFeedFilterMenu.tsxindex 14cbfbbb351d..7dc7b46995da 100644--- a/products/tasks/frontend/spaces/SpaceFeedFilterMenu.tsx+++ b/products/tasks/frontend/spaces/SpaceFeedFilterMenu.tsx@@ -1,8 +1,13 @@import { useActions, useValues } from 'kea'-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from '@posthog/quill'+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuSeparator,+ FilterMenuTrigger,+} from '@posthog/quill'-import { TodayFilterMenuTrigger } from '~/layout/today/TodayFilterMenuTrigger'import { RECENT_CREATED_BY_OPTIONS, RECENT_STATUS_OPTIONS } from '~/layout/today/todayRecentFilters'import { DEFAULT_RECENT_SORT, RECENT_SORT_OPTIONS } from '~/layout/today/todayRecentOrder'import { TodayRecentRadioSubmenu } from '~/layout/today/TodayRecentRadioSubmenu'@@ -39,7 +44,7 @@ export function SpaceFeedFilterMenu({ sourceOptions }: { sourceOptions: string[]return (<DropdownMenu>- <TodayFilterMenuTrigger active={filtersActive} dataAttr="today-space-feed-filter" />+ <FilterMenuTrigger active={filtersActive} dataAttr="today-space-feed-filter" /><DropdownMenuContent align="end" className="min-w-56"><TodayRecentRadioSubmenulabel="Group by"