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.
61 lines
1.7 KiB
61 lines
1.7 KiB
import React, { FC, useEffect } from 'react'
|
|
import { RouteComponentProps } from 'react-router'
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
import { faUserPlus } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { setTitle } from 'src/utils'
|
|
import { useDeepCompareEffect } from 'src/hooks'
|
|
|
|
import { Entity, Form } from 'src/types'
|
|
|
|
import PageHeader from 'src/components/page-header'
|
|
import Loading from 'src/components/pages/loading'
|
|
import CreateUserForm from 'src/components/create-user-form'
|
|
|
|
interface Params {
|
|
id: string
|
|
}
|
|
|
|
export interface Props extends RouteComponentProps<Params> {
|
|
group?: Entity
|
|
form: Form
|
|
fetchGroup: () => void
|
|
initForm: () => void
|
|
register: (form: Form) => void
|
|
}
|
|
|
|
const RegisterGroup: FC<Props> = ({ group, form, fetchGroup, initForm, register }) => {
|
|
useEffect(() => {
|
|
fetchGroup()
|
|
initForm()
|
|
setTitle('Register')
|
|
}, [])
|
|
|
|
useDeepCompareEffect(() => {
|
|
if (group) setTitle(`Register @ ${group.name}`)
|
|
}, [group])
|
|
|
|
if (!group) return <Loading />
|
|
|
|
return (
|
|
<div>
|
|
<PageHeader title="Register" subtitle={group ? group.name : ''} />
|
|
|
|
<div className="main-content">
|
|
<div className="centered-content">
|
|
<CreateUserForm />
|
|
<br />
|
|
|
|
<button className="button is-primary" onClick={() => register(form)}>
|
|
<span className="icon is-small">
|
|
<FontAwesomeIcon icon={faUserPlus} />
|
|
</span>
|
|
<span>Create Your Account</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default RegisterGroup
|