Skip to content

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

Uxw 3673 login history (#73050)

Andrei Chernykh9dbfbb38c22b
diff --git a/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.styled.tsx b/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.styled.tsx
deleted file mode 100644
index f5711a39240..00000000000
--- a/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.styled.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-// eslint-disable-next-line no-restricted-imports
-import styled from "@emotion/styled";
-
-import { Label } from "metabase/common/components/type/Label";
-
-export const LoginGroup = styled.div`
- padding: 1rem 0;
-`;
-
-export const LoginItemContent = styled.div`
- display: flex;
- align-items: center;
-`;
-
-export const LoginItemInfo = styled.div`
- display: flex;
- margin-left: auto;
-`;
-
-export const LoginActiveLabel = styled(Label)`
- color: var(--mb-color-summarize);
-`;
diff --git a/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.tsx b/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.tsx
index 51b6e43d0a9..82cd859b1e9 100644
--- a/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.tsx
+++ b/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.tsx
@@ -8,16 +8,9 @@ import { Card } from "metabase/common/components/Card";
import { EmptyState } from "metabase/common/components/EmptyState";
import { Label } from "metabase/common/components/type/Label";
import CS from "metabase/css/core/index.css";
-import { Text } from "metabase/ui";
+import { Box, Flex, Text } from "metabase/ui";
import type { UserLoginHistoryItem } from "metabase-types/api";
-import {
- LoginActiveLabel,
- LoginGroup,
- LoginItemContent,
- LoginItemInfo,
-} from "./LoginHistory.styled";
-
interface FormattedLoginItem extends UserLoginHistoryItem {
date: string;
time: string;
@@ -28,21 +21,23 @@ const LoginHistoryItem = ({ item }: { item: FormattedLoginItem }) => (
className={cx(CS.my2, CS.py1)}
style={{ paddingLeft: 20, paddingRight: 20 }}
>
- <LoginItemContent>
+ <Flex align="flex-start">
<div>
<Label>
- {item.location} -{" "}
- <span className={CS.textMedium}>{item.ip_address}</span>
+ {item.location}
+ <Text component="span" display="block" className={CS.textMedium}>
+ {item.ip_address}
+ </Text>
</Label>
<Text style={{ marginTop: -8 }}>{item.device_description}</Text>
</div>
- <LoginItemInfo>
+ <Flex ml="auto">
{item.active && (
- <LoginActiveLabel className={CS.pr2}>{t`Active`}</LoginActiveLabel>
+ <Label c="summarize" className={CS.pr2}>{t`Active`}</Label>
)}
<Label>{item.time}</Label>
- </LoginItemInfo>
- </LoginItemContent>
+ </Flex>
+ </Flex>
</Card>
);
@@ -53,14 +48,14 @@ const LoginHistoryGroup = ({
items: FormattedLoginItem[];
date: string;
}) => (
- <LoginGroup>
+ <Box py="md">
<Label>{date}</Label>
<div>
{items.map((item) => (
<LoginHistoryItem key={item.timestamp} item={item} />
))}
</div>
- </LoginGroup>
+ </Box>
);
const formatItems = (items: UserLoginHistoryItem[]): FormattedLoginItem[] =>