-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathChangeLog.tsx
More file actions
51 lines (47 loc) · 2.58 KB
/
ChangeLog.tsx
File metadata and controls
51 lines (47 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from 'react';
interface Log {
id: number;
action: string;
timestamp: string;
actor: string;
details: string;
}
interface Props {
logs: Log[];
}
const ChangeLog: React.FC<Props> = ({ logs }) => {
return (
<div className="mt-8">
<h3 className="text-lg font-medium text-gray-900 mb-4">Audit Trail</h3>
<div className="flex flex-col">
<div className="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div className="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
<div className="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
<table className="min-w-full divide-y divide-gray-200">
<thead className="bg-gray-50">
<tr>
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Timestamp</th>
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actor</th>
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Details</th>
</tr>
</thead>
<tbody className="bg-white divide-y divide-gray-200">
{logs.map((log) => (
<tr key={log.id}>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{new Date(log.timestamp).toLocaleString()}</td>
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">{log.action}</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{log.actor}</td>
<td className="px-6 py-4 text-sm text-gray-500">{log.details}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
);
};
export default ChangeLog;