Skip to content
Snippets Groups Projects
Unverified Commit c9fbddc2 authored by Anton Kulyk's avatar Anton Kulyk Committed by GitHub
Browse files

Visually differentiate basic and custom actions (#28544)

parent 3c1078dd
No related branches found
No related tags found
No related merge requests found
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import { css } from "@emotion/react";
import Button from "metabase/core/components/Button"; import Button from "metabase/core/components/Button";
import Link from "metabase/core/components/Link"; import Link from "metabase/core/components/Link";
import Icon from "metabase/components/Icon"; import Icon from "metabase/components/Icon";
...@@ -47,23 +48,26 @@ export const MenuIcon = styled(Icon)` ...@@ -47,23 +48,26 @@ export const MenuIcon = styled(Icon)`
} }
`; `;
export const ActionCard = styled.div` export const ActionCardContainer = styled.div`
display: block;
position: relative; position: relative;
margin-top: 0.75rem;
`;
const baseActionCardStyles = css`
padding: 1rem; padding: 1rem;
margin-top: 0.75rem;
border-radius: 6px; border-radius: 6px;
color: ${color("text-white")};
background-color: ${color("text-dark")};
`; `;
export const CodeBlock = styled.pre` export const CodeBlock = styled.pre`
${baseActionCardStyles}
font-family: Monaco, monospace; font-family: Monaco, monospace;
font-size: 0.7rem; font-size: 0.7rem;
white-space: pre-wrap; white-space: pre-wrap;
margin: 0; margin: 0;
color: ${color("text-white")};
background-color: ${color("text-dark")};
`; `;
export const ActionRunButtonContainer = styled.div` export const ActionRunButtonContainer = styled.div`
...@@ -78,13 +82,13 @@ export const ActionRunButton = styled(Button)` ...@@ -78,13 +82,13 @@ export const ActionRunButton = styled(Button)`
`; `;
export const ImplicitActionCardContentRoot = styled.div` export const ImplicitActionCardContentRoot = styled.div`
${baseActionCardStyles};
display: flex; display: flex;
flex-direction: column;
align-items: center; align-items: center;
justify-content: center;
`;
export const ImplicitActionMessage = styled.span` color: ${color("text-medium")};
display: block; background-color: ${color("bg-medium")};
margin-top: 0.5rem;
font-weight: 400;
`; `;
...@@ -4,11 +4,10 @@ import Link from "metabase/core/components/Link"; ...@@ -4,11 +4,10 @@ import Link from "metabase/core/components/Link";
import EntityMenu from "metabase/components/EntityMenu"; import EntityMenu from "metabase/components/EntityMenu";
import ModalWithTrigger from "metabase/components/ModalWithTrigger"; import ModalWithTrigger from "metabase/components/ModalWithTrigger";
import { useConfirmation } from "metabase/hooks/use-confirmation"; import { useConfirmation } from "metabase/hooks/use-confirmation";
import ImplicitActionIcon from "metabase/actions/components/ImplicitActionIcon";
import ActionExecuteModal from "metabase/actions/containers/ActionExecuteModal"; import ActionExecuteModal from "metabase/actions/containers/ActionExecuteModal";
import { WritebackAction, WritebackQueryAction } from "metabase-types/api"; import { WritebackAction, WritebackQueryAction } from "metabase-types/api";
import { import {
ActionCard, ActionCardContainer,
ActionHeader, ActionHeader,
ActionRunButtonContainer, ActionRunButtonContainer,
ActionRunButton, ActionRunButton,
...@@ -17,7 +16,6 @@ import { ...@@ -17,7 +16,6 @@ import {
ActionTitle, ActionTitle,
CodeBlock, CodeBlock,
ImplicitActionCardContentRoot, ImplicitActionCardContentRoot,
ImplicitActionMessage,
MenuIcon, MenuIcon,
} from "./ModelActionListItem.styled"; } from "./ModelActionListItem.styled";
...@@ -40,8 +38,7 @@ function QueryActionCardContent({ action }: { action: WritebackQueryAction }) { ...@@ -40,8 +38,7 @@ function QueryActionCardContent({ action }: { action: WritebackQueryAction }) {
function ImplicitActionCardContent() { function ImplicitActionCardContent() {
return ( return (
<ImplicitActionCardContentRoot> <ImplicitActionCardContentRoot>
<ImplicitActionIcon size={32} /> <div>{t`Auto tracking schema`}</div>
<ImplicitActionMessage>{t`Auto tracking schema`}</ImplicitActionMessage>
</ImplicitActionCardContentRoot> </ImplicitActionCardContentRoot>
); );
} }
...@@ -102,7 +99,7 @@ function ModelActionListItem({ ...@@ -102,7 +99,7 @@ function ModelActionListItem({
trigger={<MenuIcon name="ellipsis" size={14} />} trigger={<MenuIcon name="ellipsis" size={14} />}
/> />
</ActionHeader> </ActionHeader>
<ActionCard> <ActionCardContainer>
{action.type === "query" ? ( {action.type === "query" ? (
<QueryActionCardContent action={action} /> <QueryActionCardContent action={action} />
) : action.type === "implicit" ? ( ) : action.type === "implicit" ? (
...@@ -127,7 +124,7 @@ function ModelActionListItem({ ...@@ -127,7 +124,7 @@ function ModelActionListItem({
)} )}
</ModalWithTrigger> </ModalWithTrigger>
)} )}
</ActionCard> </ActionCardContainer>
{confirmationModal} {confirmationModal}
</> </>
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment