The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Highlight personal collections navigation and prevent horizontal grid scrolling (#83300)
Anderson6a860db454a5
diff --git a/frontend/src/metabase/common/components/CollectionListView/CollectionListView.module.css b/frontend/src/metabase/common/components/CollectionListView/CollectionListView.module.cssindex ff4f30ba177..ea89f8acd55 100644--- a/frontend/src/metabase/common/components/CollectionListView/CollectionListView.module.css+++ b/frontend/src/metabase/common/components/CollectionListView/CollectionListView.module.css@@ -5,6 +5,7 @@.card {color: var(--mb-color-text-secondary);cursor: pointer;+ outline-offset: -2px;}.card:hover {diff --git a/frontend/src/metabase/common/components/CollectionListView/CollectionListView.tsx b/frontend/src/metabase/common/components/CollectionListView/CollectionListView.tsxindex 004cfa5334d..1ec001cf576 100644--- a/frontend/src/metabase/common/components/CollectionListView/CollectionListView.tsx+++ b/frontend/src/metabase/common/components/CollectionListView/CollectionListView.tsx@@ -34,17 +34,21 @@ export const CollectionListView = ({containerClassName,}: CollectionListViewProps) => {const renderItem = (item: CollectionListItem) => (- <Link to={item.link}>- <Card shadow="none" withBorder className={styles.card}>- <Group gap="xxs">- <Icon name={item.icon} className={CS.mr1} size={18} />+ <Card+ component={Link}+ to={item.link}+ shadow="none"+ withBorder+ className={styles.card}+ >+ <Group gap="xxs">+ <Icon name={item.icon} className={CS.mr1} size={18} />- <Title order={6} component="h3">- {item.name}- </Title>- </Group>- </Card>- </Link>+ <Title order={6} component="h3">+ {item.name}+ </Title>+ </Group>+ </Card>);return (diff --git a/frontend/src/metabase/common/components/VirtualizedGrid/VirtualizedGrid.tsx b/frontend/src/metabase/common/components/VirtualizedGrid/VirtualizedGrid.tsxindex 32466f2b9bb..5f2f83663ab 100644--- a/frontend/src/metabase/common/components/VirtualizedGrid/VirtualizedGrid.tsx+++ b/frontend/src/metabase/common/components/VirtualizedGrid/VirtualizedGrid.tsx@@ -3,7 +3,7 @@ import type { Key, ReactNode } from "react";import { useMemo, useRef } from "react";import _ from "underscore";-import { Box, type BoxProps, Grid, useMatches } from "metabase/ui";+import { Box, type BoxProps, SimpleGrid, useMatches } from "metabase/ui";import type { BreakpointName } from "metabase/ui/theme";type VirtualizedGridProps<T> = {@@ -53,9 +53,6 @@ export const VirtualizedGrid = <T,>({const virtualRows = virtualizer.getVirtualItems();- // Calculate span for current breakpoint- const currentSpan = 12 / currentColumns;-return (<Box ref={parentRef} h="100%" style={{ overflowY: "auto" }} {...boxProps}><Box h={virtualizer.getTotalSize()} pos="relative">@@ -71,13 +68,11 @@ export const VirtualizedGrid = <T,>({w="100%"style={{ transform: `translateY(${virtualRow.start}px)` }}>- <Grid gutter="lg">+ <SimpleGrid cols={currentColumns} spacing="lg">{rowItems.map((item) => (- <Grid.Col key={keyExtractor(item)} span={currentSpan}>- {renderItem(item)}- </Grid.Col>+ <Box key={keyExtractor(item)}>{renderItem(item)}</Box>))}- </Grid>+ </SimpleGrid></Box>);})}diff --git a/frontend/src/metabase/common/components/VirtualizedGrid/VirtualizedGrid.unit.spec.tsx b/frontend/src/metabase/common/components/VirtualizedGrid/VirtualizedGrid.unit.spec.tsxindex ce83b067160..7afbbd9309a 100644--- a/frontend/src/metabase/common/components/VirtualizedGrid/VirtualizedGrid.unit.spec.tsx+++ b/frontend/src/metabase/common/components/VirtualizedGrid/VirtualizedGrid.unit.spec.tsx@@ -1,4 +1,9 @@-import { mockGetBoundingClientRect, render, screen } from "__support__/ui";+import {+ mockGetBoundingClientRect,+ render,+ screen,+ within,+} from "__support__/ui";import { VirtualizedGrid } from "./VirtualizedGrid";@@ -27,15 +32,24 @@ describe("VirtualizedGrid", () => {// Need to use container to test actual DOM structure/chunking behavior// eslint-disable-next-line testing-library/no-container- const rows = container.querySelectorAll('[style*="translateY"]');+ const rows = container.querySelectorAll<HTMLDivElement>(+ 'div[style*="translateY"]',+ );// With 10 items and 4 columns per row, we should have 3 rowsexpect(rows.length).toBe(3);- // Each item should be wrapped in a Grid.Col (has class starting with m_)- // eslint-disable-next-line testing-library/no-container- const gridCols = container.querySelectorAll('[class*="m_"]');- expect(gridCols.length).toBe(16);+ expect(+ Array.from(rows, (row) =>+ within(row)+ .getAllByText(/^Item \d+$/)+ .map((item) => item.textContent),+ ),+ ).toEqual([+ ["Item 0", "Item 1", "Item 2", "Item 3"],+ ["Item 4", "Item 5", "Item 6", "Item 7"],+ ["Item 8", "Item 9"],+ ]);});it("should not render children outside the bounding client rect", () => {diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsxindex 0ff85c6e49b..7fa0fcc9cf6 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx@@ -299,6 +299,7 @@ export function MainNavbarView({<PaddedSidebarLinkicon="group"url={OTHER_USERS_COLLECTIONS_URL}+ isSelected={collectionItem?.id === "users"}>{t`Other users' personal collections`}</PaddedSidebarLink>diff --git a/frontend/src/metabase/nav/containers/MainNavbar/tests/common.unit.spec.tsx b/frontend/src/metabase/nav/containers/MainNavbar/tests/common.unit.spec.tsxindex 9fe8274360b..62ff960ab8d 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/tests/common.unit.spec.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/tests/common.unit.spec.tsx@@ -468,6 +468,32 @@ describe("nav > containers > MainNavbar", () => {).toBeInTheDocument();});+ it("should select other users' personal collections when viewing them (#79967)", async () => {+ await setup({+ pathname: Urls.otherUsersPersonalCollections(),+ route: "/collection/:slug",+ user: createMockUser({ is_superuser: true }),+ });++ const listItem = screen.getByRole("listitem", {+ name: /Other users' personal collections/i,+ });+ expect(listItem).toHaveAttribute("aria-selected", "true");+ });++ it("should not select other users' personal collections when viewing another collection (#79967)", async () => {+ await setup({+ pathname: Urls.collection(TEST_COLLECTION),+ route: "/collection/:slug",+ user: createMockUser({ is_superuser: true }),+ });++ const listItem = screen.getByRole("listitem", {+ name: /Other users' personal collections/i,+ });+ expect(listItem).toHaveAttribute("aria-selected", "false");+ });+it("admin not should see other users personal collections if there no other users", async () => {await setup({user: createMockUser({ is_superuser: true }),