Commit e90e1b1b authored by / /\ / /\/'s avatar / /\ / /\/
Browse files

add props from state to community creation form

parent a3e17795
......@@ -2,45 +2,87 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import shouldComponentUpdate from 'app/utils/shouldComponentUpdate';
import { connect } from 'react-redux';
import * as communityActions from 'app/redux/CommunityReducer';
const CreateCommunity = ({ accountName }) => {
const CreateCommunity = ({
accountName,
communityCreateError,
communityCreatePending,
communityDescription,
communityHivemindOperationError,
communityHivemindOperationPending,
communityNSFW,
communityOwnerMasterPassword,
communityOwnerName,
communityTitle,
isMyAccount,
updateCommunityTitle,
updateCommunityDescription,
updateCommunityNSFW,
}) => {
debugger;
const handleCommunityTitleInput = e => {};
return (
<div className="row">
<div className="column large-6 small-12">
<div>CREATE A COMMUNITY</div>
<label for="community_title">Title</label>
<label htmlFor="community_title">Title</label>
<input
id="community_title"
name="community_title"
minLength="4"
maxLength="30"
required
onChange={handleCommunityTitleInput}
/>
<label for="community_description">Description</label>
<label htmlFor="community_description">Description</label>
<input
id="community_description"
name="community_description"
minLength="10"
maxLength="140"
onChange={handleCommunityDescriptionInput}
required
/>
<label id="is_nsfw" for="is_nsfw">
<label id="is_nsfw" htmlFor="is_nsfw">
Is NSFW.
</label>
<input type="checkbox" name="is_nsfw" />
<input
type="checkbox"
name="is_nsfw"
onChange={handleCommunityNSFWInput}
/>
</div>
</div>
);
};
export default connect(
// mapStateToProps
(state, ownProps) => {
const { account } = ownProps;
const accountName = account.get('name');
const current = state.user.get('current');
const username = current && current.get('username');
const isMyAccount = username === accountName;
return { ...ownProps, isMyAccount, accountName };
return {
...ownProps,
...state.community.toJS(),
isMyAccount,
accountName,
};
},
dispatch => ({})
// mapDispatchToProps
dispatch => {
return {
updateCommunityTitle: title => {
dispatch(communityActions.setCommunityTitle(title));
},
updateCommunityDescription: description => {
dispatch(communityActions.setCommunityDescription(description));
},
updateCommunityNSFW: isNSFW => {
dispatch(communityActions.setCommunityNSFW(isNSFW));
},
};
}
)(CreateCommunity);
{
"development": {
"username": "root",
"password": "password",
"password": "",
"database": "steemit_dev",
"host": "127.0.0.1",
"dialect": "mysql"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment