Skip to content

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

fix: port undolisting toasts to the toast spec always dark (#83311)

Uladzimir Havenchyk96e656af6e3d
diff --git a/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js b/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js
index 66dd587e50b..135395458d9 100644
--- a/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js
+++ b/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js
@@ -300,7 +300,6 @@ function assertSuccessfullUpdateToast() {
H.undoToastList()
.last()
.should("be.visible")
- .should("have.attr", "color", "feedback-positive")
.should("contain.text", "Successfully updated");
}
@@ -310,7 +309,6 @@ function assertSuccessfullDeleteToast() {
H.undoToastList()
.last()
.should("be.visible")
- .should("have.attr", "color", "feedback-positive")
.should("contain.text", "Successfully deleted");
}
diff --git a/e2e/test/scenarios/sharing/alert/alert.cy.spec.js b/e2e/test/scenarios/sharing/alert/alert.cy.spec.js
index 992a5e188b3..d274d541a00 100644
--- a/e2e/test/scenarios/sharing/alert/alert.cy.spec.js
+++ b/e2e/test/scenarios/sharing/alert/alert.cy.spec.js
@@ -230,7 +230,6 @@ describe("scenarios > alert", () => {
cy.button("Done").click();
});
cy.findByTestId("toast-undo").within(() => {
- cy.root().should("have.attr", "color", "feedback-negative");
cy.root().should("have.text", normalUserAlertError);
});
@@ -243,7 +242,6 @@ describe("scenarios > alert", () => {
cy.button("Done").click();
});
cy.findByTestId("toast-undo").within(() => {
- cy.root().should("have.attr", "color", "feedback-negative");
cy.root().should("have.text", normalUserSubscriptionError);
});
});
diff --git a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/toasts/ErrorUpdateToast.tsx b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/toasts/ErrorUpdateToast.tsx
index 050b67d5a12..ef37ab2ba5c 100644
--- a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/toasts/ErrorUpdateToast.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/toasts/ErrorUpdateToast.tsx
@@ -33,10 +33,10 @@ export const ErrorUpdateToast = ({ error }: ErrorUpdateToastProps) => {
return (
<Box w="18rem">
<Text
- c="text-primary-inverse"
+ c="inherit"
fw={700}
>{t`Editing unavailable: no PK defined`}</Text>
- <Text c="text-primary-inverse">{jt`Add a primary key in your database or set an ${(
+ <Text c="inherit">{jt`Add a primary key in your database or set an ${(
<Anchor
component={Link}
to={Urls.dataStudioData({
@@ -57,8 +57,8 @@ export const ErrorUpdateToast = ({ error }: ErrorUpdateToastProps) => {
if (showDetails) {
return (
<Stack gap="0.5rem" w="30rem" maw="100%">
- <Text c="text-primary-inverse">{t`Couldn't save table changes:`}</Text>
- <Text c="text-primary-inverse" style={{ fontFamily: "monospace" }}>
+ <Text c="inherit">{t`Couldn't save table changes:`}</Text>
+ <Text c="inherit" style={{ fontFamily: "monospace" }}>
{errorMessage}
</Text>
</Stack>
@@ -69,14 +69,12 @@ export const ErrorUpdateToast = ({ error }: ErrorUpdateToastProps) => {
<Group gap="2.5rem" w="20rem">
<Group gap="0.5rem">
<Icon name="warning" c="feedback-negative" size={12} />
- <Text
- c="text-primary-inverse"
- fw={700}
- >{t`Couldn't save table changes`}</Text>
+ <Text c="inherit" fw={700}>{t`Couldn't save table changes`}</Text>
</Group>
<Button
- variant="default"
+ variant="on-dark-secondary"
+ size="sm"
onClick={() => setShowDetails(true)}
>{t`More info`}</Button>
</Group>
diff --git a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/toasts/use-table-editing-toast-controller.tsx b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/toasts/use-table-editing-toast-controller.tsx
index a2975a7a526..a111272554e 100644
--- a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/toasts/use-table-editing-toast-controller.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/toasts/use-table-editing-toast-controller.tsx
@@ -24,7 +24,6 @@ export function useTableEditingToastController() {
showErrorToast(error: unknown, onDismiss?: () => void) {
dispatch(
addUndo({
- toastColor: "background_page-primary-inverse",
icon: null,
renderChildren: () => <ErrorUpdateToast error={error} />,
timeout: null, // removes automatic toast hide
diff --git a/frontend/src/metabase/common/components/UndoListing.tsx b/frontend/src/metabase/common/components/UndoListing.tsx
index acdefc7c195..94412650800 100644
--- a/frontend/src/metabase/common/components/UndoListing.tsx
+++ b/frontend/src/metabase/common/components/UndoListing.tsx
@@ -116,12 +116,14 @@ function UndoToast({
const dark = undo.dark ?? true;
const noBorder = undo.showProgress;
+ const pausedProgressColor = dark
+ ? "tooltip-text-secondary"
+ : "background_page-tertiary-inverse";
return (
<Card
ref={undo.ref}
data-testid="toast-undo"
- color={undo.toastColor}
role="status"
className={S.toast}
data-paused={undo.pausedAt != null || undefined}
@@ -145,9 +147,7 @@ function UndoToast({
{undo.showProgress && (
<Progress
size="sm"
- color={
- undo.pausedAt ? "background_page-tertiary-inverse" : "core-brand"
- }
+ color={undo.pausedAt ? pausedProgressColor : "core-brand"}
/* we intentionally break a11y - css animation is smoother */
value={100}
pos="absolute"
@@ -180,7 +180,7 @@ function UndoToast({
</Ellipsified>
)}
</Flex>
- <Flex className={S.controls} align="center" flex="0 0 auto">
+ <Flex className={S.controls} align="center" gap="sm" flex="0 0 auto">
{undo.actions && undo.actions.length > 0 && (
<Button
className={S.actionButton}
@@ -212,7 +212,7 @@ function UndoToast({
color={undo.dismissIconColor || "tooltip-text"}
name="close"
onClick={onDismiss}
- ml="lg"
+ ml="sm"
/>
)}
</Flex>
diff --git a/frontend/src/metabase/dashboard/actions/parameters.tsx b/frontend/src/metabase/dashboard/actions/parameters.tsx
index 9a333d0e9bb..57fe3760482 100644
--- a/frontend/src/metabase/dashboard/actions/parameters.tsx
+++ b/frontend/src/metabase/dashboard/actions/parameters.tsx
@@ -256,7 +256,7 @@ export const moveParameter =
message: (
<Text
className={cx(CS.flex, CS.flexFull, CS.flexNoShrink)}
- c="text-primary-inverse"
+ c="inherit"
w="8rem"
>{t`Filter moved`}</Text>
),
diff --git a/frontend/src/metabase/home/components/CustomHomePageModal/CustomHomePageModal.tsx b/frontend/src/metabase/home/components/CustomHomePageModal/CustomHomePageModal.tsx
index 1a5be90b6bc..060a9160c91 100644
--- a/frontend/src/metabase/home/components/CustomHomePageModal/CustomHomePageModal.tsx
+++ b/frontend/src/metabase/home/components/CustomHomePageModal/CustomHomePageModal.tsx
@@ -42,12 +42,12 @@ export const CustomHomePageModal = ({
<Box ml="0.5rem" mr="2.5rem">
<Text
span
- c="text-primary-inverse"
+ c="inherit"
fw={700}
>{t`This dashboard has been set as your homepage.`}</Text>
<Text
span
- c="text-primary-inverse"
+ c="inherit"
>{t`You can change this in Admin > Settings > General.`}</Text>
</Box>
),
diff --git a/frontend/src/metabase/questions/components/MoveCardModal/MoveCardToast/MoveCardToast.tsx b/frontend/src/metabase/questions/components/MoveCardModal/MoveCardToast/MoveCardToast.tsx
index 1a44c9e7c2c..fdad2db12cd 100644
--- a/frontend/src/metabase/questions/components/MoveCardModal/MoveCardToast/MoveCardToast.tsx
+++ b/frontend/src/metabase/questions/components/MoveCardModal/MoveCardToast/MoveCardToast.tsx
@@ -26,7 +26,7 @@ function MoveCardToast({ card, destination }: MoveCardToastProps) {
if (!destination) {
return (
<Flex align="center">
- <Icon name="warning" color="text-primary-inverse" mr="sm" />
+ <Icon name="warning" mr="sm" />
{t`Something went wrong`}
</Flex>
);
@@ -44,7 +44,7 @@ function MoveCardToast({ card, destination }: MoveCardToastProps) {
return (
<Flex align="center" data-testid="move-card-toast">
- <Icon name="collection" color="text-primary-inverse" mr="sm" />
+ <Icon name="collection" mr="sm" />
{match(type)
.with("question", () => jt`Question moved to ${link}`)
.with("model", () => jt`Model moved to ${link}`)