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
Closes EMB-650 statics embedded dashboard export icon overlapped with tab (#62685)
Sébastiend8aa553a093c
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Narrow_With_Many_Tabs.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Narrow_With_Many_Tabs.pngnew file mode 100644index 00000000000..ee1ffcb191bBinary files /dev/null and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Narrow_With_Many_Tabs.png differdiff --git a/frontend/src/metabase/common/components/TabRow/TabRow.tsx b/frontend/src/metabase/common/components/TabRow/TabRow.tsxindex c162a4d8e26..d537e877e2f 100644--- a/frontend/src/metabase/common/components/TabRow/TabRow.tsx+++ b/frontend/src/metabase/common/components/TabRow/TabRow.tsx@@ -14,6 +14,7 @@ import {horizontalListSortingStrategy,} from "@dnd-kit/sortable";import { useMergedRef } from "@mantine/hooks";+import cx from "classnames";import {type ReactNode,type Ref,@@ -114,6 +115,12 @@ const TabRowInner = forwardRef<HTMLDivElement, TabRowProps<unknown>>(onScroll={(event) => setScrollPosition(event.currentTarget.scrollLeft)}ref={mergedRef}{...props}+ className={cx(+ {+ scrollable: showScrollLeft || showScrollRight,+ },+ props.className,+ )}><DndContextonDragEnd={onDragEnd}diff --git a/frontend/src/metabase/public/components/EmbedFrame/EmbedFrame.styled.tsx b/frontend/src/metabase/public/components/EmbedFrame/EmbedFrame.styled.tsxindex 570466e16c4..57b6e682fe1 100644--- a/frontend/src/metabase/public/components/EmbedFrame/EmbedFrame.styled.tsx+++ b/frontend/src/metabase/public/components/EmbedFrame/EmbedFrame.styled.tsx@@ -1,3 +1,4 @@+import isPropValid from "@emotion/is-prop-valid";// eslint-disable-next-line no-restricted-importsimport { css } from "@emotion/react";// eslint-disable-next-line no-restricted-imports@@ -79,11 +80,23 @@ export const TitleAndDescriptionContainer = styled(FullWidthContainer, {`}`;-export const DashboardTabsContainer = styled(FullWidthContainer)`+export const DashboardTabsContainer = styled(FullWidthContainer, {+ shouldForwardProp: isPropValid,+})<{+ narrow?: boolean;+}>`${breakpointMaxSmall} {padding-left: 0;padding-right: 0;}++ ${({ narrow }) =>+ narrow &&+ `+ [role="tablist"].scrollable {+ width: calc(100% - 60px);+ }+ `}`;export const Separator = styled.div`diff --git a/frontend/src/metabase/public/components/EmbedFrame/EmbedFrame.tsx b/frontend/src/metabase/public/components/EmbedFrame/EmbedFrame.tsxindex 99840e31a2a..00283498166 100644--- a/frontend/src/metabase/public/components/EmbedFrame/EmbedFrame.tsx+++ b/frontend/src/metabase/public/components/EmbedFrame/EmbedFrame.tsx@@ -235,7 +235,7 @@ export const EmbedFrame = ({</TitleAndDescriptionContainer>)}{dashboardTabs && (- <DashboardTabsContainer>+ <DashboardTabsContainer narrow={!titled && pdfDownloadsEnabled}><FixedWidthContainerdata-testid="fixed-width-dashboard-tabs"isFixedWidth={dashboard?.width === "fixed"}diff --git a/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView.stories.tsx b/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView.stories.tsxindex 6688cff3ee0..a6d182a6728 100644--- a/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView.stories.tsx+++ b/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView.stories.tsx@@ -23,7 +23,11 @@ import { BarChart } from "metabase/visualizations/visualizations/BarChart";import ObjectDetail from "metabase/visualizations/visualizations/ObjectDetail";import Table from "metabase/visualizations/visualizations/Table/Table";import TABLE_RAW_SERIES from "metabase/visualizations/visualizations/Table/stories-data/orders-with-people.json";-import type { Dashboard, DashboardCard } from "metabase-types/api";+import type {+ Dashboard,+ DashboardCard,+ DashboardTab,+} from "metabase-types/api";import {createMockCard,createMockColumn,@@ -120,13 +124,19 @@ const PARAMETER_ID = "param-hex";interface CreateDashboardOpts {hasScroll?: boolean;dashcards?: DashboardCard[];+ tabs?: DashboardTab[];}-function createDashboard({ hasScroll, dashcards }: CreateDashboardOpts = {}) {+function createDashboard({+ hasScroll,+ dashcards,+ tabs,+}: CreateDashboardOpts = {}) {return createMockDashboard({id: DASHBOARD_ID,name: "My dashboard",width: "full",parameters: [createMockParameter({ id: PARAMETER_ID })],+ tabs,dashcards: dashcards ?? [createMockDashboardCard({id: DASHCARD_BAR_ID,@@ -183,6 +193,38 @@ const defaultArgs: Partial<MockDashboardContextProps> = {withFooter: true,};+export const NarrowWithManyTabs = {+ render: Template,+ args: {+ ...defaultArgs,+ titled: false,+ dashboard: createDashboard({+ dashcards: [],+ tabs: [+ { id: 0, dashboard_id: DASHBOARD_ID, name: "Tab 1" },+ { id: 1, dashboard_id: DASHBOARD_ID, name: "Tab 2" },+ { id: 2, dashboard_id: DASHBOARD_ID, name: "Tab 3" },+ { id: 3, dashboard_id: DASHBOARD_ID, name: "Tab 4" },+ { id: 4, dashboard_id: DASHBOARD_ID, name: "Tab 5" },+ { id: 5, dashboard_id: DASHBOARD_ID, name: "Tab 6" },+ { id: 6, dashboard_id: DASHBOARD_ID, name: "Tab 7" },+ { id: 7, dashboard_id: DASHBOARD_ID, name: "Tab 8" },+ { id: 8, dashboard_id: DASHBOARD_ID, name: "Tab 9" },+ { id: 9, dashboard_id: DASHBOARD_ID, name: "Tab 10" },+ { id: 10, dashboard_id: DASHBOARD_ID, name: "Tab 11" },+ { id: 11, dashboard_id: DASHBOARD_ID, name: "Tab 12" },+ { id: 12, dashboard_id: DASHBOARD_ID, name: "Tab 13" },+ { id: 13, dashboard_id: DASHBOARD_ID, name: "Tab 14" },+ { id: 14, dashboard_id: DASHBOARD_ID, name: "Tab 15" },+ { id: 15, dashboard_id: DASHBOARD_ID, name: "Tab 16" },+ { id: 16, dashboard_id: DASHBOARD_ID, name: "Tab 17" },+ { id: 17, dashboard_id: DASHBOARD_ID, name: "Tab 18" },+ ],+ }),+ },+ decorators: [NarrowDecorator],+};+export const LightThemeDefault = {render: Template,args: defaultArgs,@@ -432,3 +474,11 @@ function LightBackgroundDecorator(Story: StoryFn) {</Box>);}++function NarrowDecorator(Story: StoryFn) {+ return (+ <Box w={800} h={600} style={{ position: "relative" }}>+ <Story />+ </Box>+ );+}