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
GDGT-3362: Move illustrated modals to the centred Modal layout (#84635)
Will Fry51cc311efb93
diff --git a/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationModal.tsx b/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationModal.tsxindex 07edf369f19..6e074ab08da 100644--- a/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationModal.tsx+++ b/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationModal.tsx@@ -1,4 +1,5 @@import { useCallback, useState } from "react";+import { match } from "ts-pattern";import { t } from "ttag";import { Modal, type ModalProps } from "metabase/ui";@@ -14,8 +15,14 @@ import {DatabaseReplicationForm,type DatabaseReplicationFormFields,} from "./DatabaseReplicationForm";-import { DatabaseReplicationSettingUp } from "./DatabaseReplicationSettingUp";-import { DatabaseReplicationSuccess } from "./DatabaseReplicationSuccess";+import {+ DatabaseReplicationSettingUp,+ getDatabaseReplicationSettingUpModalProps,+} from "./DatabaseReplicationSettingUp";+import {+ DatabaseReplicationSuccess,+ getDatabaseReplicationSuccessModalProps,+} from "./DatabaseReplicationSuccess";interface IRTKQueryError {status: unknown;@@ -102,6 +109,15 @@ export const DatabaseReplicationModal = ({const canCloseModal = !isProgressStep && !isErrorStep;+ // The steps share one Modal so it doesn't remount when the step changes,+ // which means each step's layout, title and illustration are set on it here+ const stepModalProps = match(setupStep)+ .with("form", () => ({ title: t`Set up database replication` }))+ .with("setting-up", getDatabaseReplicationSettingUpModalProps)+ .with("success", getDatabaseReplicationSuccessModalProps)+ .with("error", () => ({ title: t`Couldn't replicate database` }))+ .exhaustive();+return (<Modalopened={isProgressStep || opened}@@ -109,14 +125,8 @@ export const DatabaseReplicationModal = ({closeOnClickOutside={canCloseModal}closeOnEscape={canCloseModal}withCloseButton={canCloseModal}- title={- isProgressStep- ? undefined- : isErrorStep- ? t`Couldn't replicate database`- : t`Set up database replication`- }mah="80%"+ {...stepModalProps}>{setupStep === "form" ? (<DatabaseReplicationFormdiff --git a/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationSettingUp.tsx b/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationSettingUp.tsxindex f9bf362a127..160b3d6996b 100644--- a/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationSettingUp.tsx+++ b/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationSettingUp.tsx@@ -1,41 +1,39 @@import { t } from "ttag";import { MetabotLogo } from "metabase/common/components/MetabotLogo";-import { Box, Flex, Loader, Stack, Text, Title } from "metabase/ui";+import { Box, Flex, Loader, type ModalStepProps, Text } from "metabase/ui";-export const DatabaseReplicationSettingUp = () => (- <Stack align="center" gap="xl" my="4.5rem">- <Box h={96} pos="relative" w={96}>- <MetabotLogo variant="cloud" alt={t`Metabot Cloud`} />- <Flex- bottom={0}- align="center"- direction="row"- gap={0}- justify="center"- pos="absolute"- right={0}- wrap="nowrap"- bg="core-white"- fz={0}- p="sm"- ta="center"- style={{- borderRadius: "100%",- boxShadow: `0 1px 6px 0 var(--mb-color-shadow-default)`,- }}- >- <Loader size="xs" ml={1} mt={1} />- </Flex>- </Box>+export const getDatabaseReplicationSettingUpModalProps =+ (): ModalStepProps => ({+ layout: "centered",+ title: t`Setting up, please wait`,+ illustration: (+ <Box h={96} pos="relative" w={96}>+ <MetabotLogo variant="cloud" alt={t`Metabot Cloud`} />+ <Flex+ bottom={0}+ align="center"+ direction="row"+ gap={0}+ justify="center"+ pos="absolute"+ right={0}+ wrap="nowrap"+ bg="core-white"+ fz={0}+ p="sm"+ ta="center"+ style={{+ borderRadius: "100%",+ boxShadow: `0 1px 6px 0 var(--mb-color-shadow-default)`,+ }}+ >+ <Loader size="xs" ml={1} mt={1} />+ </Flex>+ </Box>+ ),+ });- <Box ta="center">- <Title c="text-primary" fz="lg">{t`Setting up, please wait`}</Title>- <Text- c="text-secondary"- fz="md"- lh="1.25rem"- >{t`This will take just a minute or so`}</Text>- </Box>- </Stack>+export const DatabaseReplicationSettingUp = () => (+ <Text c="text-secondary">{t`This will take just a minute or so`}</Text>);diff --git a/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationSuccess.tsx b/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationSuccess.tsxindex 4c0395fe3e9..d394b4f198e 100644--- a/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationSuccess.tsx+++ b/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationSuccess.tsx@@ -1,7 +1,17 @@import { t } from "ttag";import { MetabotLogo } from "metabase/common/components/MetabotLogo";-import { Box, Button, Stack, Text, Title } from "metabase/ui";+import { Box, Button, Modal, type ModalStepProps, Text } from "metabase/ui";++export const getDatabaseReplicationSuccessModalProps = (): ModalStepProps => ({+ layout: "centered",+ title: t`Replication in progress`,+ illustration: (+ <Box h={96} w={96}>+ <MetabotLogo variant="cloud" />+ </Box>+ ),+});export const DatabaseReplicationSuccess = ({onClose,@@ -9,21 +19,15 @@ export const DatabaseReplicationSuccess = ({onClose: () => void;}) => {return (- <Stack align="center" gap="xl" my="4.5rem">- <Box h={96} w={96}>- <MetabotLogo variant="cloud" />- </Box>-- <Box ta="center">- <Title c="text-primary" fz="lg">{t`Replication in progress`}</Title>- <Text c="text-secondary" fz="md" lh="1.25rem">- {t`The process runs in the background. Depending on the database size, this can take up to several hours. You will get an email once your data is ready to use.`}- </Text>- </Box>-- <Button onClick={onClose} variant="filled" miw="30%">- {t`Done`}- </Button>- </Stack>+ <>+ <Text c="text-secondary">+ {t`The process runs in the background. Depending on the database size, this can take up to several hours. You will get an email once your data is ready to use.`}+ </Text>+ <Modal.Footer>+ <Button onClick={onClose} variant="filled">+ {t`Done`}+ </Button>+ </Modal.Footer>+ </>);};diff --git a/enterprise/frontend/src/metabase-enterprise/google_drive/PausedModal.tsx b/enterprise/frontend/src/metabase-enterprise/google_drive/PausedModal.tsxindex ea6d7697e32..2738af14c9d 100644--- a/enterprise/frontend/src/metabase-enterprise/google_drive/PausedModal.tsx+++ b/enterprise/frontend/src/metabase-enterprise/google_drive/PausedModal.tsx@@ -7,7 +7,7 @@ import { getUserIsAdmin } from "metabase/current-user";import { useSelector } from "metabase/redux";import { useSetting } from "metabase/settings";import { _FileUploadErrorModal } from "metabase/status/components/FileUploadStatusLarge/FileUploadErrorModal";-import { Box, Button, Modal, Stack, Text } from "metabase/ui";+import { Box, Button, Modal, Text } from "metabase/ui";import databaseError from "./database-error.svg?component";@@ -16,39 +16,38 @@ function PausedModal({ onClose }: { onClose: () => void }) {const isAdmin = useSelector(getUserIsAdmin);return (- <Modal opened onClose={onClose} withCloseButton={false}>- <Stack gap="lg" pt="xl" ta="center">- <Box component={databaseError} mx="auto" />- <Text size="lg" fw="bold">- {t`Couldn't upload the file, storage is full`}- </Text>- <Text c="text-secondary">- {isAdmin- ? // eslint-disable-next-line metabase/no-literal-metabase-strings -- admin only- t`Add more storage to your Metabase or connect a database to store the uploaded files.`- : t`Please contact your admin to add more storage.`}- </Text>-- <Stack w="50%" my="xl" mx="auto">- {isAdmin ? (- <>- <Button- variant="filled"- component={ExternalLink}- href={storeUrl}- target="_blank"- >- {t`Add more storage`}- </Button>- <Button onClick={onClose}>{t`Cancel`}</Button>- </>- ) : (- <Button variant="filled" onClick={onClose}>- {t`OK`}+ <Modal+ opened+ onClose={onClose}+ layout="centered"+ illustration={<Box component={databaseError} />}+ title={t`Couldn't upload the file, storage is full`}+ >+ <Text c="text-secondary">+ {isAdmin+ ? // eslint-disable-next-line metabase/no-literal-metabase-strings -- admin only+ t`Add more storage to your Metabase or connect a database to store the uploaded files.`+ : t`Please contact your admin to add more storage.`}+ </Text>+ <Modal.Footer>+ {isAdmin ? (+ <>+ <Button onClick={onClose}>{t`Cancel`}</Button>+ <Button+ variant="filled"+ component={ExternalLink}+ href={storeUrl}+ target="_blank"+ >+ {t`Add more storage`}</Button>- )}- </Stack>- </Stack>+ </>+ ) : (+ <Button variant="filled" onClick={onClose}>+ {t`OK`}+ </Button>+ )}+ </Modal.Footer></Modal>);}diff --git a/enterprise/frontend/src/metabase-enterprise/metabot/components/MetabotAdmin/MetabotSettingUpModal.tsx b/enterprise/frontend/src/metabase-enterprise/metabot/components/MetabotAdmin/MetabotSettingUpModal.tsxindex 2ceb7559f7c..a58338852c1 100644--- a/enterprise/frontend/src/metabase-enterprise/metabot/components/MetabotAdmin/MetabotSettingUpModal.tsx+++ b/enterprise/frontend/src/metabase-enterprise/metabot/components/MetabotAdmin/MetabotSettingUpModal.tsx@@ -12,9 +12,7 @@ import {Loader,Modal,type ModalProps,- Stack,Text,- Title,} from "metabase/ui";import { hasPremiumFeature } from "metabase-enterprise/settings";@@ -44,8 +42,8 @@ export function MetabotSettingUpModal({withCloseButton={false}size="30rem"mah="80%"- >- <Stack align="center" gap="xl" my="4.5rem">+ layout="centered"+ illustration={<Box h={96} pos="relative" w={96}><MetabotLogo variant="cloud" alt={t`Metabot Cloud`} />@@ -72,33 +70,25 @@ export function MetabotSettingUpModal({</Flex>)}</Box>-- {isSettingUp ? (- <Box ta="center">- <Title c="text-primary" fz="lg">- {t`Setting up Metabot AI, please wait`}- </Title>- <Text c="text-secondary" fz="md" lh={1.43}>- {t`This will take just a minute or so`}- </Text>- </Box>- ) : (- <>- <Box ta="center">- <Title c="text-primary" fz="lg">- {t`Metabot AI is ready`}- </Title>- <Text c="text-secondary" fz="md" lh={1.43}>- {t`Happy exploring!`}- </Text>- </Box>-- <Button variant="filled" onClick={onClose}>- {t`Done`}- </Button>- </>- )}- </Stack>+ }+ title={+ isSettingUp+ ? t`Setting up Metabot AI, please wait`+ : t`Metabot AI is ready`+ }+ >+ <Text c="text-secondary">+ {isSettingUp+ ? t`This will take just a minute or so`+ : t`Happy exploring!`}+ </Text>+ {!isSettingUp && (+ <Modal.Footer>+ <Button variant="filled" onClick={onClose}>+ {t`Done`}+ </Button>+ </Modal.Footer>+ )}</Modal>);}diff --git a/enterprise/frontend/src/metabase-enterprise/transforms/upsells/components/TransformsSettingUpModal.tsx b/enterprise/frontend/src/metabase-enterprise/transforms/upsells/components/TransformsSettingUpModal.tsxindex 901c1609467..ae50d242793 100644--- a/enterprise/frontend/src/metabase-enterprise/transforms/upsells/components/TransformsSettingUpModal.tsx+++ b/enterprise/frontend/src/metabase-enterprise/transforms/upsells/components/TransformsSettingUpModal.tsx@@ -12,9 +12,7 @@ import {Loader,Modal,type ModalProps,- Stack,Text,- Title,} from "metabase/ui";import { hasPremiumFeature } from "metabase-enterprise/settings";@@ -36,6 +34,12 @@ export const TransformsSettingUpModal = ({skip: !opened,});const isSettingUp = !hasPremiumFeature(featureToCheck);+ const settingUpTitle = isPython+ ? t`Setting up Python transforms, please wait`+ : t`Setting up transforms, please wait`;+ const readyTitle = isPython+ ? t`Python transforms are ready`+ : t`Transforms are ready`;return (<Modal@@ -46,8 +50,8 @@ export const TransformsSettingUpModal = ({withCloseButton={false}size="30rem"mah="80%"- >- <Stack align="center" gap="xl" my="4.5rem">+ layout="centered"+ illustration={<Box h={96} pos="relative" w={96}><Flexalign="center"@@ -83,37 +87,21 @@ export const TransformsSettingUpModal = ({</Flex>)}</Box>-- {isSettingUp ? (- <Box ta="center">- <Title c="text-primary" fz="lg">- {isPython- ? t`Setting up Python transforms, please wait`- : t`Setting up transforms, please wait`}- </Title>- <Text c="text-secondary" fz="md" lh={1.43}>- {t`This will take just a minute or so`}- </Text>- </Box>- ) : (- <>- <Box ta="center">- <Title c="text-primary" fz="lg">- {isPython- ? t`Python transforms are ready`- : t`Transforms are ready`}- </Title>- <Text c="text-secondary" fz="md" lh={1.43}>- {t`Happy transforming!`}- </Text>- </Box>-- <Button variant="filled" onClick={onClose}>- {t`Done`}- </Button>- </>- )}- </Stack>+ }+ title={isSettingUp ? settingUpTitle : readyTitle}+ >+ <Text c="text-secondary">+ {isSettingUp+ ? t`This will take just a minute or so`+ : t`Happy transforming!`}+ </Text>+ {!isSettingUp && (+ <Modal.Footer>+ <Button variant="filled" onClick={onClose}>+ {t`Done`}+ </Button>+ </Modal.Footer>+ )}</Modal>);};diff --git a/frontend/src/metabase/admin/settings/components/CloudPanel/MigrationStart.tsx b/frontend/src/metabase/admin/settings/components/CloudPanel/MigrationStart.tsxindex 4604ca5a3c6..babca098717 100644--- a/frontend/src/metabase/admin/settings/components/CloudPanel/MigrationStart.tsx+++ b/frontend/src/metabase/admin/settings/components/CloudPanel/MigrationStart.tsx@@ -28,29 +28,22 @@ export const MigrationStart = ({onClose={closeModal}size="36rem"data-testid="new-cloud-migration-confirmation"- styles={{- body: {- padding: 0,- },- }}+ layout="centered"+ illustration={<Icon name="cloud_filled" size="3rem" c="core-brand" />}+ title={t`Get started with Metabase Cloud`}>- <Box mt="lg" pb="4rem" px="6rem" ta="center">- <Icon name="cloud_filled" size="3rem" c="core-brand" />- <Modal.Title mt="1.5rem">{t`Get started with Metabase Cloud`}</Modal.Title>-- <Text mt="1.5rem">- {t`Just a heads up: your Metabase will be read-only for up to 30+ <Text c="text-secondary">+ {t`Just a heads up: your Metabase will be read-only for up to 30minutes while we prep it for migration.`}{" "}- <ExternalLink href="https://www.metabase.com/cloud/">{t`Learn More.`}</ExternalLink>- </Text>-+ <ExternalLink href="https://www.metabase.com/cloud/">{t`Learn More.`}</ExternalLink>+ </Text>+ <Modal.Footer><Buttonvariant="filled"disabled={isStarting}onClick={startNewMigration}- mt="2rem">{t`Migrate now`}</Button>- </Box>+ </Modal.Footer></Modal></>);diff --git a/frontend/src/metabase/collections/components/CollectionHeader/CollectionUploadInfoModal.tsx b/frontend/src/metabase/collections/components/CollectionHeader/CollectionUploadInfoModal.tsxindex bd787088367..77c76359360 100644--- a/frontend/src/metabase/collections/components/CollectionHeader/CollectionUploadInfoModal.tsx+++ b/frontend/src/metabase/collections/components/CollectionHeader/CollectionUploadInfoModal.tsx@@ -3,7 +3,7 @@ import { t } from "ttag";import { Link } from "metabase/common/components/Link";import { useSelector } from "metabase/redux";import { getApplicationName } from "metabase/selectors/whitelabel";-import { Box, Button, Modal, Stack, Text, Title } from "metabase/ui";+import { Button, Modal, Stack, Text } from "metabase/ui";export const UploadInfoModal = ({isAdmin,@@ -18,9 +18,8 @@ export const UploadInfoModal = ({openedonClose={onClose}size="30rem"- styles={{ header: { marginBottom: "1rem" } }}- >- <Stack gap="lg" align="center" justify="center">+ layout="centered"+ illustration={<Textcomponent="div"px="sm"@@ -29,24 +28,24 @@ export const UploadInfoModal = ({fw={700}c="core-brand"bg="background_surface-brand-subtle"- mx="auto"bdrs="xs">{t`New`}</Text>- <Title order={2} ta="center" fz="xl">- {t`Upload CSVs to ${applicationName}`}- </Title>- {isAdmin ? (- <>- <Box>- <Text c="text-secondary" mb="1rem">- {t`Team members will be able to upload CSV files and work with them just like any other data source.`}- </Text>- <Text c="text-secondary">- {t`You'll be able to pick the default database where the data should be stored when enabling the feature.`}- </Text>- </Box>+ }+ title={t`Upload CSVs to ${applicationName}`}+ >+ {isAdmin ? (+ <>+ <Stack gap="md" ta="start">+ <Text c="text-secondary">+ {t`Team members will be able to upload CSV files and work with them just like any other data source.`}+ </Text>+ <Text c="text-secondary">+ {t`You'll be able to pick the default database where the data should be stored when enabling the feature.`}+ </Text>+ </Stack>+ <Modal.Footer><Buttoncomponent={Link}to="/admin/settings/uploads"@@ -55,18 +54,20 @@ export const UploadInfoModal = ({>{t`Go to setup`}</Button>- </>- ) : (- <>- <Box>- <Text c="text-secondary">- {t`You'll need to ask your admin to enable this feature to get started. Then, you'll be able to upload CSV files and work with them just like any other data source.`}- </Text>- </Box>- <Button onClick={onClose}>{t`Got it`}</Button>- </>- )}- </Stack>+ </Modal.Footer>+ </>+ ) : (+ <>+ <Text c="text-secondary">+ {t`You'll need to ask your admin to enable this feature to get started. Then, you'll be able to upload CSV files and work with them just like any other data source.`}+ </Text>+ <Modal.Footer>+ <Button variant="filled" onClick={onClose}>+ {t`Got it`}+ </Button>+ </Modal.Footer>+ </>+ )}</Modal>);};diff --git a/frontend/src/metabase/common/components/ErrorPages/ErrorDiagnosticModal.tsx b/frontend/src/metabase/common/components/ErrorPages/ErrorDiagnosticModal.tsxindex e72087365c8..9cff219c68c 100644--- a/frontend/src/metabase/common/components/ErrorPages/ErrorDiagnosticModal.tsx+++ b/frontend/src/metabase/common/components/ErrorPages/ErrorDiagnosticModal.tsx@@ -131,8 +131,12 @@ export const ErrorDiagnosticModal = ({if (isSubmissionComplete) {return (- <Modal opened onClose={onClose} size={550}>- <Stack gap="sm" align="center" py="xxl">+ <Modal+ opened+ onClose={onClose}+ size={550}+ layout="centered"+ illustration={<MetabotLogovariant="bug"alt={c(@@ -140,14 +144,15 @@ export const ErrorDiagnosticModal = ({).t`Bug report submitted`}style={{ height: "100px", width: "100px" }}/>- <Text ta="center" size="lg" fw="bold">- {t`Thank you for your feedback!`}- </Text>- <Text ta="center" c="text-secondary">- {t`Bug report submitted successfully.`}- </Text>- <Button mt="xxl" onClick={onClose}>{t`Close`}</Button>- </Stack>+ }+ title={t`Thank you for your feedback!`}+ >+ <Text c="text-secondary">{t`Bug report submitted successfully.`}</Text>+ <Modal.Footer>+ <Button variant="filled" onClick={onClose}>+ {t`Close`}+ </Button>+ </Modal.Footer></Modal>);}diff --git a/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModal.tsx b/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModal.tsxindex 330ca5b2007..b74f583335b 100644--- a/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModal.tsx+++ b/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModal.tsx@@ -9,10 +9,17 @@ import {} from "metabase/api/cloud-proxy";import { Center, Loader, Modal } from "metabase/ui";-import { UpgradeModalError } from "./UpgradeModalError";+import {+ UpgradeModalError,+ getUpgradeErrorModalProps,+} from "./UpgradeModalError";import { UpgradeModalInitial } from "./UpgradeModalInitial";-import { UpgradeModalLoading } from "./UpgradeModalLoading";+import {+ UpgradeModalLoading,+ getUpgradeLoadingModalProps,+} from "./UpgradeModalLoading";import type { ModalStep, UpgradeFlow } from "./types";+import { useIsUpgradeSettingUp } from "./use-is-upgrade-setting-up";interface UpgradeModalProps {opened: boolean;@@ -85,6 +92,10 @@ export function UpgradeModal({ opened, onClose }: UpgradeModalProps) {}: undefined;+ const isSettingUp = useIsUpgradeSettingUp({+ skip: !opened || step !== "loading",+ });+const [startTrial] = useStartTrialMutation();const [changePlan] = useChangePlanMutation();@@ -104,8 +115,8 @@ export function UpgradeModal({ opened, onClose }: UpgradeModalProps) {} else if (planAlias) {await changePlan({ new_plan_alias: planAlias }).unwrap();}- // Stay in loading state - UpgradeModalLoading will poll for the- // no-upsell feature and show success when it arrives+ // Stay in loading state - useIsUpgradeSettingUp polls for the+ // no-upsell feature and the modal shows success when it arrives} catch {setStep("error");}@@ -125,8 +136,23 @@ export function UpgradeModal({ opened, onClose }: UpgradeModalProps) {(!isTrialAvailable && isPreviewLoading) ||(showPlanPricing && isPlanLoading);+ const isErrorShown =+ step === "error" || (step === "initial" && hasQueryError);++ const getStepModalProps = () => {+ if (step === "loading") {+ return getUpgradeLoadingModalProps({ flow, isSettingUp });+ }+ return isErrorShown ? getUpgradeErrorModalProps() : undefined;+ };+return (- <Modal opened={opened} onClose={handleClose} size="md">+ <Modal+ opened={opened}+ onClose={handleClose}+ size="md"+ {...getStepModalProps()}+ >{step === "initial" && isDataLoading && !hasQueryError && (<Center h={200}><Loader />@@ -143,11 +169,9 @@ export function UpgradeModal({ opened, onClose }: UpgradeModalProps) {/>)}{step === "loading" && (- <UpgradeModalLoading flow={flow} onDone={handleClose} />- )}- {(step === "error" || (step === "initial" && hasQueryError)) && (- <UpgradeModalError onClose={handleClose} />+ <UpgradeModalLoading isSettingUp={isSettingUp} onDone={handleClose} />)}+ {isErrorShown && <UpgradeModalError onClose={handleClose} />}</Modal>);}diff --git a/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModalError.tsx b/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModalError.tsxindex 003cd104f43..821dc51e9d4 100644--- a/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModalError.tsx+++ b/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModalError.tsx@@ -1,6 +1,30 @@import { t } from "ttag";-import { Button, Flex, Icon, Stack, Text, Title } from "metabase/ui";+import {+ Button,+ Flex,+ Icon,+ Modal,+ type ModalStepProps,+ Text,+} from "metabase/ui";++export const getUpgradeErrorModalProps = (): ModalStepProps => ({+ layout: "centered",+ title: t`Something went wrong`,+ illustration: (+ <Flex+ align="center"+ justify="center"+ w={64}+ h={64}+ bg="feedback-negative"+ bdrs="50%"+ >+ <Icon name="warning" c="core-white" size={32} />+ </Flex>+ ),+});interface UpgradeModalErrorProps {onClose: () => void;@@ -8,32 +32,13 @@ interface UpgradeModalErrorProps {export function UpgradeModalError({ onClose }: UpgradeModalErrorProps) {return (- <Stack align="center" gap="xl" py="xxl">- <Flex- align="center"- justify="center"- w={64}- h={64}- bg="feedback-negative"- style={{ borderRadius: "50%" }}- >- <Icon name="warning" c="core-white" size={32} />- </Flex>-- <Stack align="center" gap="xxs">- <Title order={3} ta="center">- {t`Something went wrong`}- </Title>- <Text c="text-secondary" ta="center">- {t`Please try again later.`}- </Text>- </Stack>-- <Flex justify="center" w="100%">+ <>+ <Text c="text-secondary">{t`Please try again later.`}</Text>+ <Modal.Footer><Button variant="filled" color="brand" onClick={onClose}>{t`Close`}</Button>- </Flex>- </Stack>+ </Modal.Footer>+ </>);}diff --git a/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModalLoading.tsx b/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModalLoading.tsxindex 2e50207d906..aafa97d5450 100644--- a/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModalLoading.tsx+++ b/frontend/src/metabase/common/components/upsells/components/UpgradeModal/UpgradeModalLoading.tsx@@ -1,92 +1,85 @@import { t } from "ttag";import {- WAITING_REFRESH_INTERVAL,- useGetSettingsQuery,- useTokenRefreshUntil,-} from "metabase/settings";-import { Button, Flex, Icon, Loader, Stack, Text, Title } from "metabase/ui";+ Button,+ Center,+ Flex,+ Icon,+ Loader,+ Modal,+ type ModalStepProps,+ Text,+} from "metabase/ui";import type { UpgradeFlow } from "./types";-interface UpgradeModalLoadingProps {- flow: UpgradeFlow;- onDone: () => void;-}--export function UpgradeModalLoading({+export function getUpgradeLoadingModalProps({flow,- onDone,-}: UpgradeModalLoadingProps) {- // Poll every second until no-upsell feature appears- useTokenRefreshUntil("no-upsell", { intervalMs: WAITING_REFRESH_INTERVAL });-- const { data: settings } = useGetSettingsQuery();- const tokenFeatures = settings?.["token-status"]?.features ?? [];- const isSettingUp = !tokenFeatures.includes("no-upsell");-+ isSettingUp,+}: {+ flow: UpgradeFlow;+ isSettingUp: boolean;+}): ModalStepProps {const isTrial = flow === "trial";if (isSettingUp) {- const title = isTrial- ? t`Setting up your free trial, please wait`- : // eslint-disable-next-line metabase/no-literal-metabase-strings -- Upsell for Metabase Pro, only visible to admins- t`Setting up Metabase Pro, please wait`;-- return (- <Stack align="center" gap="xl" py="xxl">- <Loader size="xl" />-- <Stack align="center" gap="xxs">- <Title order={3} ta="center">- {title}- </Title>- <Text c="text-secondary" ta="center">- {t`This will take just a minute or so`}- </Text>- </Stack>-- <Flex justify="center" w="100%">- <Button variant="filled" color="brand" disabled>- {t`Done`}- </Button>- </Flex>- </Stack>- );+ return {+ layout: "centered",+ title: isTrial+ ? t`Setting up your free trial, please wait`+ : // eslint-disable-next-line metabase/no-literal-metabase-strings -- Upsell for Metabase Pro, only visible to admins+ t`Setting up Metabase Pro, please wait`,+ // Same size as the ready and error badges, so the modal keeps its height+ illustration: (+ <Center w={64} h={64}>+ <Loader size="xl" />+ </Center>+ ),+ };}- // Success state - feature has arrived- const successTitle = isTrial- ? t`Your free trial is ready`- : // eslint-disable-next-line metabase/no-literal-metabase-strings -- Upsell for Metabase Pro, only visible to admins- t`Metabase Pro is ready to use`;-- return (- <Stack align="center" gap="xl" py="xxl">+ return {+ layout: "centered",+ title: isTrial+ ? t`Your free trial is ready`+ : // eslint-disable-next-line metabase/no-literal-metabase-strings -- Upsell for Metabase Pro, only visible to admins+ t`Metabase Pro is ready to use`,+ illustration: (<Flexalign="center"justify="center"w={64}h={64}bg="feedback-positive"- style={{ borderRadius: "50%" }}+ bdrs="50%"><Icon name="check" c="core-white" size={32} /></Flex>+ ),+ };+}- <Stack align="center" gap="xxs">- <Title order={3} ta="center">- {successTitle}- </Title>- <Text c="text-secondary" ta="center">- {t`Happy exploring!`}- </Text>- </Stack>+interface UpgradeModalLoadingProps {+ isSettingUp: boolean;+ onDone: () => void;+}- <Flex justify="center" w="100%">+export function UpgradeModalLoading({+ isSettingUp,+ onDone,+}: UpgradeModalLoadingProps) {+ return (+ <>+ <Text c="text-secondary">+ {isSettingUp+ ? t`This will take just a minute or so`+ : t`Happy exploring!`}+ </Text>+ <Modal.Footer><Buttonvariant="filled"color="brand"+ disabled={isSettingUp}onClick={() => {onDone();window.location.reload();@@ -94,7 +87,7 @@ export function UpgradeModalLoading({>{t`Done`}</Button>- </Flex>- </Stack>+ </Modal.Footer>+ </>);}diff --git a/frontend/src/metabase/common/components/upsells/components/UpgradeModal/use-is-upgrade-setting-up.ts b/frontend/src/metabase/common/components/upsells/components/UpgradeModal/use-is-upgrade-setting-up.tsnew file mode 100644index 00000000000..6384ed9eae9--- /dev/null+++ b/frontend/src/metabase/common/components/upsells/components/UpgradeModal/use-is-upgrade-setting-up.ts@@ -0,0 +1,21 @@+import {+ WAITING_REFRESH_INTERVAL,+ useGetSettingsQuery,+ useTokenRefreshUntil,+} from "metabase/settings";++/**+ * Polls the token status while `skip` is false and returns whether the+ * upgrade is still being set up. Returns `true` while skipped or while+ * settings are loading.+ */+export function useIsUpgradeSettingUp({ skip }: { skip: boolean }) {+ useTokenRefreshUntil("no-upsell", {+ intervalMs: WAITING_REFRESH_INTERVAL,+ skip,+ });++ const { data: settings } = useGetSettingsQuery(undefined, { skip });+ const tokenFeatures = settings?.["token-status"]?.features ?? [];+ return !tokenFeatures.includes("no-upsell");+}diff --git a/frontend/src/metabase/nav/components/AboutModal/AboutModal.tsx b/frontend/src/metabase/nav/components/AboutModal/AboutModal.tsxindex 9fddd0c45db..26298fb0c67 100644--- a/frontend/src/metabase/nav/components/AboutModal/AboutModal.tsx+++ b/frontend/src/metabase/nav/components/AboutModal/AboutModal.tsx@@ -11,7 +11,6 @@ import { useSetting } from "metabase/settings";import {Box,Divider,- Flex,Modal,type ModalProps,Stack,@@ -34,46 +33,51 @@ export const AboutModal = ({const showTrademark = !isWhiteLabeling;return (- <Modal opened={opened} onClose={onClose} withCloseButton={false} size={475}>- <Flex direction="column" align="center" pb="xl">- <Box c="core-brand" pb="lg">+ <Modal+ opened={opened}+ onClose={onClose}+ size={475}+ layout="centered"+ illustration={+ <Box c="core-brand"><LogoIcon height={48} /></Box>- <Stack gap={14} align="center">- <Title order={2}>{t`Thanks for using ${applicationName}!`}</Title>- <Title order={4}>- {t`You're on version`} {tag}- </Title>- <Text c="text-secondary" fw="bold">- {t`Built on`} {date}- </Text>- {tag &&- !/^v\d+\.\d+\.\d+$/.test(tag) &&- _.map(versionExtra, (value, key) => (- <Text key={key} c="text-secondary" fw="bold">- {capitalize(key)}: {String(value)}- </Text>- ))}+ }+ title={t`Thanks for using ${applicationName}!`}+ >+ <Stack gap={14}>+ <Title order={5}>+ {t`You're on version`} {tag}+ </Title>+ <Text c="text-secondary" fw="bold">+ {t`Built on`} {date}+ </Text>+ {tag &&+ !/^v\d+\.\d+\.\d+$/.test(tag) &&+ _.map(versionExtra, (value, key) => (+ <Text key={key} c="text-secondary" fw="bold">+ {capitalize(key)}: {String(value)}+ </Text>+ ))}- {showTrademark && (- <>- <Divider size={2} w="100%" />- <Stack align="center" gap={0}>- <Text fz="sm" fw="bold" c="text-secondary" lh="sm">- {/* eslint-disable-next-line metabase/no-literal-metabase-strings -- This only shows on OSS instance */}- {t`Metabase is a Trademark of Metabase, Inc`}- </Text>- <Text- fz="sm"- fw="bold"- c="text-secondary"- lh="sm"- >{t`and is built with care by a team from all across this pale blue dot.`}</Text>- </Stack>- </>- )}- </Stack>- </Flex>+ {showTrademark && (+ <>+ <Divider size={2} w="100%" />+ <Stack align="center" gap={0}>+ <Text fz="sm" fw="bold" c="text-secondary" lh="sm">+ {/* eslint-disable-next-line metabase/no-literal-metabase-strings -- This only shows on OSS instance */}+ {t`Metabase is a Trademark of Metabase, Inc`}+ </Text>+ <Text+ fz="sm"+ fw="bold"+ c="text-secondary"+ lh="sm"+ >{t`and is built with care by a team from all across this pale blue dot.`}</Text>+ </Stack>+ </>+ )}+ </Stack></Modal>);};diff --git a/frontend/src/metabase/query_builder/components/SavedQuestionIntroModal.tsx b/frontend/src/metabase/query_builder/components/SavedQuestionIntroModal.tsxindex dad3e3b599b..c4f086aaee8 100644--- a/frontend/src/metabase/query_builder/components/SavedQuestionIntroModal.tsx+++ b/frontend/src/metabase/query_builder/components/SavedQuestionIntroModal.tsx@@ -3,7 +3,7 @@ import { t } from "ttag";import EmptyMetric from "assets/img/empty-states/qbnewb-metric.svg";import EmptyModel from "assets/img/empty-states/qbnewb-model.svg";import EmptyQuestion from "assets/img/empty-states/qbnewq-question.svg";-import { Box, Button, Modal, Stack, Text, Title } from "metabase/ui";+import { Box, Button, Modal, Text } from "metabase/ui";import type Question from "metabase-lib/v1/Question";interface Props {@@ -49,35 +49,26 @@ export const SavedQuestionIntroModal = ({}: Props) => {const { image, title, message } = getLabels(question);- /**- * We need this value for both the header and the body content width.- * Can't set it on the Modal.Content because it overrides the actual modal width.- */- const contentWidth = "28rem";-return (- <Modal.Root opened={isShowingNewbModal} onClose={onClose} size={560}>- <Modal.Overlay />- <Modal.Content p="xxl" ta="center">- <Modal.Header maw={contentWidth} mx="auto" my="lg">- <Stack align="center" w="100%">- <Box w="6rem">- <img- src={image}- alt={t`Saved entity modal empty state illustration`}- />- </Box>- <Title order={3}>{title}</Title>- </Stack>- </Modal.Header>- <Modal.Body maw={contentWidth} mx="auto" my="lg">- <Text mb="xl">{message}</Text>- <Button- variant="filled"- onClick={onClose}- >{t`Start exploring`}</Button>- </Modal.Body>- </Modal.Content>- </Modal.Root>+ <Modal+ opened={isShowingNewbModal}+ onClose={onClose}+ size={560}+ layout="centered"+ illustration={+ <Box w="6rem">+ <img+ src={image}+ alt={t`Saved entity modal empty state illustration`}+ />+ </Box>+ }+ title={title}+ >+ <Text c="text-secondary">{message}</Text>+ <Modal.Footer>+ <Button variant="filled" onClick={onClose}>{t`Start exploring`}</Button>+ </Modal.Footer>+ </Modal>);};diff --git a/frontend/src/metabase/ui/components/overlays/Modal/Modal.mdx b/frontend/src/metabase/ui/components/overlays/Modal/Modal.mdxindex 6202e8be28e..1fd5f471722 100644--- a/frontend/src/metabase/ui/components/overlays/Modal/Modal.mdx+++ b/frontend/src/metabase/ui/components/overlays/Modal/Modal.mdx@@ -31,7 +31,7 @@ Pass the heading as `title` and put the action buttons in a `Modal.Footer` as th### Layouts- `layout="default"` left-aligns the title and body, and right-aligns the buttons.-- `layout="centered"` centre-aligns everything, stacks the buttons with the primary one on top, and shows an optional `illustration` above the title.+- `layout="centered"` centre-aligns everything, stacks the buttons with the primary one on top, and shows an optional `illustration` above the title. Body copy is centred too. To left-align it, pass `ta="start"` to its `Text` (or to the `Stack` that wraps it).Don't confuse `layout` with Mantine's `centered` prop, which sets the modal's vertical position in the viewport.diff --git a/frontend/src/metabase/ui/components/overlays/Modal/Modal.module.css b/frontend/src/metabase/ui/components/overlays/Modal/Modal.module.cssindex ee09ca6ae15..5d654ec7baf 100644--- a/frontend/src/metabase/ui/components/overlays/Modal/Modal.module.css+++ b/frontend/src/metabase/ui/components/overlays/Modal/Modal.module.css@@ -79,14 +79,25 @@}.root[data-layout="centered"] {+ /* Zero height so the content sits in the same place with or without the+ close button, while staying sticky so the button doesn't scroll away */.header {justify-content: flex-end;+ min-height: 0;+ height: 0;+ padding-block: 0;+ background-color: transparent;++ .ModalCloseButton {+ margin-top: var(--mantine-spacing-xl);+ }}.body {padding-inline: var(--mantine-spacing-xxl);- padding-bottom: rem(64px);+ padding-block: rem(64px);text-align: center;+ text-wrap: pretty;}.footer {diff --git a/frontend/src/metabase/ui/components/overlays/Modal/index.tsx b/frontend/src/metabase/ui/components/overlays/Modal/index.tsxindex d3a14f6534d..eb6da3a77b3 100644--- a/frontend/src/metabase/ui/components/overlays/Modal/index.tsx+++ b/frontend/src/metabase/ui/components/overlays/Modal/index.tsx@@ -81,6 +81,15 @@ export interface ModalPropsillustration?: ReactNode;}+/**+ * The props that change from step to step when a multi-step modal reuses+ * one `Modal`, so moving between steps doesn't remount it.+ */+export type ModalStepProps = Pick<+ ModalProps,+ "layout" | "title" | "illustration"+>;+export interface ModalRootPropsextendsOmit<MantineModalRootProps, ForbiddenMantineModalProps>,