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
Use blue shadow on embedding hub card to highlight next step (#63655)
Phoomparin Mano1a6044bbb3c9
diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.cssindex a2e5f5f6939..37c20c74f37 100644--- a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css@@ -22,6 +22,9 @@.step.stepDone .stepIcon {color: var(--mb-color-bg-white);background: var(--mb-color-success-darker);++ /** Prevent blue border color from affecting the done icon */+ border-color: transparent;}.stepWrapper {@@ -63,5 +66,9 @@.stepCard:not(.lockedStepCard):hover {border: 1px solid var(--mb-color-focus) !important;+}++.stepCard.nextStepCard {+ border: 1px solid var(--mb-color-focus) !important;box-shadow: 0 2px 24px 0 var(--mb-color-shadow-embedding-hub-card);}diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsxindex 48b0cf27889..34b9c04830e 100644--- a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx@@ -41,6 +41,21 @@ export const StepperWithCards = ({ steps }: { steps: StepperStep[] }) => {return null;}+ // Find the next actionable card (first undone, unlocked card in the first incomplete step)+ const nextCard = (() => {+ const firstIncompleteStep = steps.find(+ (step) => !step.cards.every((card) => card.done || card.optional),+ );++ if (!firstIncompleteStep) {+ return null;+ }++ return firstIncompleteStep.cards.find(+ (card) => !card.done && !card.locked && !card.optional,+ );+ })();+return (<Stepperactive={0}@@ -72,17 +87,21 @@ export const StepperWithCards = ({ steps }: { steps: StepperStep[] }) => {? card.clickAction.onClick: undefined;+ const isNextCard = nextCard && nextCard.id === card.id;+return (<CardAction card={card} key={card.id}><CardclassName={cx(S.stepCard, {[S.optionalStepCard]: card.optional,[S.lockedStepCard]: card.locked,+ [S.nextStepCard]: isNextCard,})}component={onClick ? "button" : undefined}onClick={onClick}disabled={card.locked}data-testid={`step-card-${card.id}`}+ data-next-step={isNextCard}><Stack justify="space-between" h="100%"><Stack gap="xs" h="100%">diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsxindex 17d3ba95ef7..b51d4f2fbbd 100644--- a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx@@ -169,4 +169,104 @@ describe("StepperWithCards", () => {const lockIcon = screen.getByLabelText("lock icon");expect(lockIcon).toBeInTheDocument();});++ it("should mark next step with data-next-step", () => {+ const steps = createMockSteps([+ {+ id: "step1",+ title: "First Step",+ cards: [+ { id: "1", done: true }, // done card+ { id: "2", done: false, locked: true }, // locked, should skip+ { id: "3", done: false, optional: true }, // optional, should skip+ { id: "4", done: false }, // this should be the next step+ ],+ },+ {+ id: "step2",+ title: "Second Step",+ cards: [+ { id: "5", done: false }, // should not be next since step 1 is incomplete+ ],+ },+ ]);++ render(<StepperWithCards steps={steps} />);++ expect(screen.getByTestId("step-card-4")).toHaveAttribute(+ "data-next-step",+ "true",+ );++ ["1", "2", "3", "5"].forEach((id) => {+ expect(screen.getByTestId(`step-card-${id}`)).not.toHaveAttribute(+ "data-next-step",+ "true",+ );+ });+ });++ it("should handle step progression and completion correctly", () => {+ const completeFirstStep = createMockSteps([+ {+ id: "step1",+ title: "First Step",+ cards: [+ { id: "1", done: true },+ { id: "2", done: false, optional: true }, // optional, step is still complete+ ],+ },+ {+ id: "step2",+ title: "Second Step",+ cards: [+ { id: "3", done: false }, // this should be next+ { id: "4", done: false },+ ],+ },+ ]);++ render(<StepperWithCards steps={completeFirstStep} />);++ // Step 1 is complete, so card 3 should be next.+ expect(screen.getByTestId("step-card-3")).toHaveAttribute(+ "data-next-step",+ "true",+ );++ ["1", "2", "4"].forEach((id) => {+ expect(screen.getByTestId(`step-card-${id}`)).not.toHaveAttribute(+ "data-next-step",+ "true",+ );+ });+ });++ it("all steps complete", () => {+ // all steps are complete+ const allComplete = createMockSteps([+ {+ id: "step1",+ title: "First Step",+ cards: [{ id: "1", done: true }],+ },+ {+ id: "step2",+ title: "Second Step",+ cards: [+ { id: "2", done: true },+ { id: "3", done: false, optional: true }, // optional undone card+ ],+ },+ ]);++ render(<StepperWithCards steps={allComplete} />);++ // When all steps are complete, no cards should be marked as next+ const allCards = ["1", "2", "3"];+ allCards.forEach((id) => {+ const card = screen.getByTestId(`step-card-${id}`);+ expect(card).not.toHaveAttribute("data-next-step", "true");+ });+ });});