You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
import React, { FC, useEffect } from 'react'
|
|
import { Link } from 'react-router-dom'
|
|
import noop from 'lodash/noop'
|
|
import moment from 'moment'
|
|
import { GroupLog } from 'src/types'
|
|
|
|
export interface Props {
|
|
group: string
|
|
logs?: GroupLog[]
|
|
fetchLogs?: () => void
|
|
}
|
|
|
|
const MemberList: FC<Props> = ({ group, logs = [], fetchLogs = noop }) => {
|
|
useEffect(() => {
|
|
if (logs.length === 0) fetchLogs()
|
|
}, [group, fetchLogs])
|
|
|
|
return (
|
|
<table className="table is-bordered is-striped is-narrow is-hoverable is-fullwidth">
|
|
<thead>
|
|
<tr>
|
|
<th>Who</th>
|
|
<th>What</th>
|
|
<th>When</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{logs.map(log => (
|
|
<tr>
|
|
<td><Link to={`/u/${log.user.id}`}>{log.user.id}</Link></td>
|
|
<td>{log.content}</td>
|
|
<td>{moment(log.created).format('MMMM Do YYYY, h:mm:ss a')}</td>
|
|
</tr>
|
|
))}
|
|
</tbody>
|
|
</table>
|
|
)
|
|
}
|
|
|
|
export default MemberList
|