Skip to content

Commit 869c68f

Browse files
committed
Fix action log on mobile
1 parent 97278aa commit 869c68f

2 files changed

Lines changed: 37 additions & 22 deletions

File tree

src/pages/ActionLog.jsx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Col, Row, Table } from 'react-bootstrap';
1+
import { Col, Row } from 'react-bootstrap';
22
import { useTranslation } from 'react-i18next';
33
import { Navigate } from 'react-router-dom';
44

@@ -36,20 +36,16 @@ const ActionLog = () => {
3636
<Col>
3737
{isLoading && <LoadingIcon large />}
3838
{error && <ErrorMessage error={error} />}
39-
{actionLog && <Table>
40-
<thead>
41-
<tr>
42-
<th>{t('views.action_log.columns.date_time')}</th>
43-
<th>{t('views.action_log.columns.device')}</th>
44-
<th>{t('views.action_log.columns.action')}</th>
45-
<th>{t('views.action_log.columns.user')}</th>
46-
<th>{t('views.action_log.columns.application')}</th>
47-
</tr>
48-
</thead>
49-
<tbody>
50-
{actionLog.map(entry => <ActionLogEntry key={entry.id} entry={entry} />)}
51-
</tbody>
52-
</Table>}
39+
{actionLog && <>
40+
<Row className="row-cols-1 row-cols-lg-5 d-none d-lg-flex fw-bold">
41+
<Col>{t('views.action_log.columns.date_time')}</Col>
42+
<Col>{t('views.action_log.columns.device')}</Col>
43+
<Col>{t('views.action_log.columns.action')}</Col>
44+
<Col>{t('views.action_log.columns.user')}</Col>
45+
<Col>{t('views.action_log.columns.application')}</Col>
46+
</Row>
47+
{actionLog.map(entry => <ActionLogEntry key={entry.id} entry={entry} />)}
48+
</>}
5349
</Col>
5450
</Row>
5551
</>);

src/widgets/ActionLog/ActionLogEntry.jsx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,43 @@ import { parseISO } from 'date-fns';
22
import PropTypes from 'prop-types';
33

44
import { useDateTimeFormatter } from '../../utils/useDateTimeFormatter.js';
5+
import { Col, Row } from 'react-bootstrap';
6+
import { useTranslation } from 'react-i18next';
57

68
const ActionLogEntry = ({
79
entry,
810
}) => {
11+
const { t } = useTranslation();
12+
913
const {
1014
formatDefault,
1115
formatDistanceToNow,
1216
} = useDateTimeFormatter();
1317

1418
const dateTime = parseISO(entry.createdAt);
1519

16-
return (<tr>
17-
<td>{formatDefault(dateTime)} ({formatDistanceToNow(dateTime)})</td>
18-
<td>{entry.deviceId}</td>
19-
<td>{entry.action}</td>
20-
<td>{entry.User.name} ({entry.User.username})</td>
21-
<td>{entry.Application.name}</td>
22-
</tr>);
20+
return (<Row className="row-cols-1 row-cols-lg-5 border-top pt-1 mb-1">
21+
<Col>
22+
<strong className="d-lg-none">{t('views.action_log.columns.date_time')}: </strong>
23+
{formatDefault(dateTime)} ({formatDistanceToNow(dateTime)})
24+
</Col>
25+
<Col>
26+
<strong className="d-lg-none">{t('views.action_log.columns.device')}: </strong>
27+
{entry.deviceId}
28+
</Col>
29+
<Col>
30+
<strong className="d-lg-none">{t('views.action_log.columns.action')}: </strong>
31+
{entry.action}
32+
</Col>
33+
<Col>
34+
<strong className="d-lg-none">{t('views.action_log.columns.user')}: </strong>
35+
{entry.User.name} ({entry.User.username})
36+
</Col>
37+
<Col>
38+
<strong className="d-lg-none">{t('views.action_log.columns.application')}: </strong>
39+
{entry.Application.name}
40+
</Col>
41+
</Row>);
2342
};
2443

2544
ActionLogEntry.propTypes = {

0 commit comments

Comments
 (0)