feat: add relative date in execution row
This commit is contained in:
@@ -6,9 +6,10 @@ import Stack from '@mui/material/Stack';
|
|||||||
import CardActionArea from '@mui/material/CardActionArea';
|
import CardActionArea from '@mui/material/CardActionArea';
|
||||||
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
import type { IExecution } from '@automatisch/types';
|
import type { IExecution } from '@automatisch/types';
|
||||||
|
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import FlowAppIcons from 'components/FlowAppIcons';
|
import FlowAppIcons from 'components/FlowAppIcons';
|
||||||
import { Apps, CardContent, Typography } from './style';
|
import { Apps, CardContent, Typography } from './style';
|
||||||
|
|
||||||
@@ -16,12 +17,14 @@ type ExecutionRowProps = {
|
|||||||
execution: IExecution;
|
execution: IExecution;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getHumanlyDate = (timestamp: number) => DateTime.fromMillis(timestamp).toLocaleString(DateTime.DATETIME_MED);
|
|
||||||
|
|
||||||
export default function ExecutionRow(props: ExecutionRowProps): React.ReactElement {
|
export default function ExecutionRow(props: ExecutionRowProps): React.ReactElement {
|
||||||
|
const formatMessage = useFormatMessage();
|
||||||
const { execution } = props;
|
const { execution } = props;
|
||||||
const { flow } = execution;
|
const { flow } = execution;
|
||||||
|
|
||||||
|
const createdAt = DateTime.fromMillis(parseInt(execution.createdAt, 10));
|
||||||
|
const relativeCreatedAt = createdAt.toRelative();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link to={URLS.EXECUTION(execution.id)}>
|
<Link to={URLS.EXECUTION(execution.id)}>
|
||||||
<Card sx={{ mb: 1 }}>
|
<Card sx={{ mb: 1 }}>
|
||||||
@@ -41,7 +44,7 @@ export default function ExecutionRow(props: ExecutionRowProps): React.ReactEleme
|
|||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Typography variant="caption" noWrap>
|
<Typography variant="caption" noWrap>
|
||||||
{getHumanlyDate(parseInt(execution.createdAt, 10))}
|
{formatMessage('execution.executedAt', { datetime: relativeCreatedAt })}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
|
@@ -48,6 +48,7 @@
|
|||||||
"flows.create": "Create flow",
|
"flows.create": "Create flow",
|
||||||
"flows.title": "Flows",
|
"flows.title": "Flows",
|
||||||
"executions.title": "Executions",
|
"executions.title": "Executions",
|
||||||
|
"execution.executedAt": "executed {datetime}",
|
||||||
"profileSettings.title": "My Profile",
|
"profileSettings.title": "My Profile",
|
||||||
"profileSettings.email": "Email",
|
"profileSettings.email": "Email",
|
||||||
"profileSettings.updateEmail": "Update email",
|
"profileSettings.updateEmail": "Update email",
|
||||||
|
Reference in New Issue
Block a user