2018-07-31 14:44:52 +02:00
|
|
|
//@flow
|
2018-07-31 18:44:01 +02:00
|
|
|
import React from "react";
|
2018-07-31 14:44:52 +02:00
|
|
|
|
2018-07-31 18:44:01 +02:00
|
|
|
import Page from "../../components/layout/Page";
|
2018-07-31 14:44:52 +02:00
|
|
|
import { translate } from "react-i18next";
|
2018-07-31 18:44:01 +02:00
|
|
|
import GroupForm from "./GroupForm";
|
|
|
|
|
import { connect } from "react-redux";
|
|
|
|
|
import { createGroup } from "../modules/groups";
|
2018-07-31 19:05:06 +02:00
|
|
|
import type { Group } from "../types/Group";
|
2018-07-31 14:44:52 +02:00
|
|
|
|
|
|
|
|
export interface Props {
|
2018-07-31 18:44:01 +02:00
|
|
|
t: string => string;
|
2018-07-31 19:05:06 +02:00
|
|
|
createGroup: Group => void;
|
2018-07-31 14:44:52 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-31 18:44:01 +02:00
|
|
|
export interface State {}
|
2018-07-31 14:44:52 +02:00
|
|
|
|
|
|
|
|
class AddGroup extends React.Component<Props, State> {
|
|
|
|
|
render() {
|
|
|
|
|
const { t } = this.props;
|
2018-07-31 18:44:01 +02:00
|
|
|
return (
|
|
|
|
|
<Page title={t("add-group.title")} subtitle={t("add-group.subtitle")}>
|
|
|
|
|
<div>
|
|
|
|
|
<GroupForm submitForm={group => this.createGroup(group)} />
|
|
|
|
|
</div>
|
|
|
|
|
</Page>
|
|
|
|
|
);
|
2018-07-31 14:44:52 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-31 18:44:01 +02:00
|
|
|
createGroup = (group: Group) => {
|
|
|
|
|
this.props.createGroup(group);
|
|
|
|
|
};
|
2018-07-31 14:44:52 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-31 18:44:01 +02:00
|
|
|
const mapDispatchToProps = dispatch => {
|
|
|
|
|
return {
|
|
|
|
|
createGroup: (group: Group) => dispatch(createGroup(group))
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = state => {};
|
|
|
|
|
|
|
|
|
|
export default connect(
|
|
|
|
|
mapStateToProps,
|
|
|
|
|
mapDispatchToProps
|
|
|
|
|
)(translate("groups")(AddGroup));
|