mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
display localized type in reports table
This commit is contained in:
parent
aa341d1dd2
commit
34d3d16641
@ -5,6 +5,7 @@ import { useMessages } from 'components/hooks';
|
||||
import useUser from 'components/hooks/useUser';
|
||||
import { useState } from 'react';
|
||||
import { Button, Flexbox, Icon, Icons, Modal, Text } from 'react-basics';
|
||||
import { REPORT_TYPES } from 'lib/constants';
|
||||
|
||||
export function ReportsTable({
|
||||
data = [],
|
||||
@ -34,6 +35,15 @@ export function ReportsTable({
|
||||
{ name: 'action', label: ' ' },
|
||||
];
|
||||
|
||||
const cellRender = (row, data, key) => {
|
||||
if (key === 'type') {
|
||||
return formatMessage(
|
||||
labels[Object.keys(REPORT_TYPES).find(key => REPORT_TYPES[key] === row.type)],
|
||||
);
|
||||
}
|
||||
return data[key];
|
||||
};
|
||||
|
||||
const handleConfirm = () => {
|
||||
onDelete(report.id);
|
||||
};
|
||||
@ -42,6 +52,7 @@ export function ReportsTable({
|
||||
<>
|
||||
<SettingsTable
|
||||
columns={columns}
|
||||
cellRender={cellRender}
|
||||
data={data}
|
||||
showSearch={true}
|
||||
showPaging={true}
|
||||
|
Loading…
Reference in New Issue
Block a user