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.
63 lines
1.6 KiB
63 lines
1.6 KiB
import React, { FC, useEffect } from 'react'
|
|
import { RouteComponentProps } from 'react-router-dom'
|
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
import { faEdit } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { setTitle } from 'src/utils'
|
|
import { Group } from 'src/types'
|
|
|
|
import PageHeader from 'src/components/page-header'
|
|
import GroupInfo from 'src/components/group-info'
|
|
|
|
interface Params {
|
|
id: string
|
|
}
|
|
|
|
export interface Props extends RouteComponentProps<Params> {
|
|
group?: Group
|
|
fetchGroup: () => void
|
|
}
|
|
|
|
const Self: FC<Props> = ({ group, fetchGroup }) => {
|
|
useEffect(() => {
|
|
fetchGroup()
|
|
}, [])
|
|
|
|
useEffect(() => {
|
|
if (group) setTitle(group.name)
|
|
}, [group])
|
|
|
|
if (!group) {
|
|
return (
|
|
<div>
|
|
<PageHeader title="Group" />
|
|
<div className="main-content"></div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
<PageHeader title={group.name} />
|
|
|
|
<div className="main-content">
|
|
<GroupInfo group={group} />
|
|
<br /><br />
|
|
|
|
{group.membership === 'admin' &&
|
|
<div>
|
|
<button className="button is-warning">
|
|
<span className="icon is-small">
|
|
<FontAwesomeIcon icon={faEdit} />
|
|
</span>
|
|
<span>Edit {group.name}</span>
|
|
</button>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default Self
|