Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Explorations UI tweaks (#85132)

Denis Berezin420052473c08
diff --git a/e2e/test/scenarios/explorations/explorations.cy.spec.ts b/e2e/test/scenarios/explorations/explorations.cy.spec.ts
index 4c8bee2840b..f56b88c6f6d 100644
--- a/e2e/test/scenarios/explorations/explorations.cy.spec.ts
+++ b/e2e/test/scenarios/explorations/explorations.cy.spec.ts
@@ -185,6 +185,20 @@ function openExploreFurtherToast(threadName: string): void {
cy.findByRole("button", { name: "View" }).click();
});
}
+function measureGreeting(title: string | RegExp, promptInputTestId: string) {
+ return cy.findByText(title).then(($title) =>
+ cy.findByTestId(promptInputTestId).then(($input) => {
+ const titleRect = $title[0].getBoundingClientRect();
+ const inputRect = $input[0].getBoundingClientRect();
+ return {
+ titleTop: Math.round(titleRect.top),
+ titleLeft: Math.round(titleRect.left),
+ inputTop: Math.round(inputRect.top),
+ };
+ }),
+ );
+}
+
describe("scenarios > explorations", () => {
beforeEach(() => {
cy.task("stopMockLlmServer");
@@ -200,6 +214,25 @@ describe("scenarios > explorations", () => {
H.expectNoBadSnowplowEvents();
});
+ describe("entry page", () => {
+ it("aligns the title and prompt input with the /question/ask page", () => {
+ cy.visit("/question/ask");
+ cy.findByTestId("metabot-conversation-history").should("be.visible");
+ measureGreeting(
+ /What (would you like to know|do you want to explore|are you looking to learn)\?/,
+ "metabot-chat-input",
+ ).then((askLayout) => {
+ cy.visit("/question/research");
+ measureGreeting(
+ "What do you want to research?",
+ "exploration-prompt-input",
+ ).then((researchLayout) => {
+ expect(researchLayout).to.deep.equal(askLayout);
+ });
+ });
+ });
+ });
+
describe("new research", () => {
it("picks Our analytics + metrics + timelines, filters the data pickers by search, creates an exploration, and lands on the detail page", () => {
createTimelineWithSentinelEvent("Releases", "star").then((releasesId) => {
diff --git a/frontend/src/metabase/explorations/components/NewExplorationChat/NewExplorationChat.module.css b/frontend/src/metabase/explorations/components/NewExplorationChat/NewExplorationChat.module.css
index c6f6dee40a9..e011e1eaaf5 100644
--- a/frontend/src/metabase/explorations/components/NewExplorationChat/NewExplorationChat.module.css
+++ b/frontend/src/metabase/explorations/components/NewExplorationChat/NewExplorationChat.module.css
@@ -8,7 +8,7 @@
keep the container and ProseMirror min-heights in sync
otherwise there's a huge area that looks like the ProseMirror editor, but clicking on it doesn't focus the editor
*/
- :global(.ProseMirror) {
+ &.inputContainer :global(.ProseMirror) {
min-height: 8rem;
}
}
diff --git a/frontend/src/metabase/explorations/components/NewExplorationEntry/NewExplorationEntry.module.css b/frontend/src/metabase/explorations/components/NewExplorationEntry/NewExplorationEntry.module.css
index 83983e58127..253a00ca92d 100644
--- a/frontend/src/metabase/explorations/components/NewExplorationEntry/NewExplorationEntry.module.css
+++ b/frontend/src/metabase/explorations/components/NewExplorationEntry/NewExplorationEntry.module.css
@@ -21,13 +21,31 @@
}
.inputContainer {
- :global(.ProseMirror) {
+ border-radius: var(--mantine-radius-sm);
+ box-shadow:
+ 0 0 0 1px var(--mb-color-border-neutral),
+ 0 4px 24px rgba(0, 0, 0, 0.08);
+ transition: box-shadow 150ms ease;
+
+ &:focus-within {
+ box-shadow:
+ 0 0 0 1px var(--mb-color-border-neutral),
+ 0 4px 24px rgba(0, 0, 0, 0.12);
+ }
+
+ &.inputContainer :global(.ProseMirror) {
min-height: 7rem;
}
}
.explorationsContainer {
+ /* five rows of 4rem, the 0.5rem gaps between them, and the border */
+ max-height: calc(5 * 4rem + 4 * 0.5rem + 2px);
overflow-y: auto;
+ background: var(--mb-color-background_page-primary);
+ border: 1px solid var(--mb-color-border-neutral-subtle);
+ border-radius: var(--mantine-radius-sm);
+ box-shadow: var(--mantine-shadow-xs);
}
.explorationLink {
diff --git a/frontend/src/metabase/explorations/components/NewExplorationEntry/NewExplorationEntry.tsx b/frontend/src/metabase/explorations/components/NewExplorationEntry/NewExplorationEntry.tsx
index d66c3ee6004..d64db862db0 100644
--- a/frontend/src/metabase/explorations/components/NewExplorationEntry/NewExplorationEntry.tsx
+++ b/frontend/src/metabase/explorations/components/NewExplorationEntry/NewExplorationEntry.tsx
@@ -97,16 +97,12 @@ export function NewExplorationEntry({ selection }: NewExplorationEntryProps) {
{t`Explore`}
</Button>
)}
- <Text fz="xl" fw={600} c="text-primary" mb="0.5rem">
- {t`What do you want to research?`}
- </Text>
- <Paper
- w="100%"
- bd="1px solid border-neutral"
- bdrs="0.75rem"
- p="0.5rem 1rem 1rem"
- className={S.inputContainer}
- >
+ <Flex align="center" mih="2rem">
+ <Text fz="xl" fw={600} c="text-primary">
+ {t`What do you want to research?`}
+ </Text>
+ </Flex>
+ <Paper w="100%" p="0.5rem 1rem 1rem" className={S.inputContainer}>
{canUseNlq ? (
<MetabotPromptInput
value={prompt}
diff --git a/frontend/src/metabase/metabot/components/MetabotAsk/MetabotAsk.module.css b/frontend/src/metabase/metabot/components/MetabotAsk/MetabotAsk.module.css
index 65d792aef66..8c35f0196d6 100644
--- a/frontend/src/metabase/metabot/components/MetabotAsk/MetabotAsk.module.css
+++ b/frontend/src/metabase/metabot/components/MetabotAsk/MetabotAsk.module.css
@@ -1,3 +1,11 @@
.chat {
--metabot-chat-messages-padding-top: 2rem;
}
+
+/* placed before the greeting in the DOM for tab order, so it needs a z-index to paint above it */
+.historyAction {
+ position: absolute;
+ top: var(--mantine-spacing-lg);
+ right: var(--mantine-spacing-lg);
+ z-index: 1;
+}
diff --git a/frontend/src/metabase/metabot/components/MetabotAsk/MetabotAsk.tsx b/frontend/src/metabase/metabot/components/MetabotAsk/MetabotAsk.tsx
index e27243ace08..c35f63e54a3 100644
--- a/frontend/src/metabase/metabot/components/MetabotAsk/MetabotAsk.tsx
+++ b/frontend/src/metabase/metabot/components/MetabotAsk/MetabotAsk.tsx
@@ -61,13 +61,17 @@ export const MetabotAsk = () => {
) : undefined;
return (
- <Flex direction="column" h="100%" w="100%" bg="background_page-primary">
+ <Flex
+ direction="column"
+ h="100%"
+ w="100%"
+ bg="background_page-primary"
+ pos="relative"
+ >
{showGreeting ? (
<>
{historyAction && (
- <Flex justify="flex-end" px="lg" pt="lg">
- {historyAction}
- </Flex>
+ <Box className={S.historyAction}>{historyAction}</Box>
)}
<MetabotGreeting
conversationId={conversationId}
diff --git a/frontend/src/metabase/metabot/components/MetabotAsk/MetabotGreeting.tsx b/frontend/src/metabase/metabot/components/MetabotAsk/MetabotGreeting.tsx
index ed81362c6aa..4099fe50f5e 100644
--- a/frontend/src/metabase/metabot/components/MetabotAsk/MetabotGreeting.tsx
+++ b/frontend/src/metabase/metabot/components/MetabotAsk/MetabotGreeting.tsx
@@ -84,7 +84,8 @@ export const MetabotGreeting = ({
<Button
component={ForwardRefLink}
to={Urls.newExploration()}
- bd="none"
+ variant="subtle"
+ color="neutral"
leftSection={<Icon name="telescope" c="core-brand" />}
>
{t`Research`}