-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e90fb0
commit df4f19a
Showing
9 changed files
with
252 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.msgs-start-panel { | ||
.button { | ||
display: block; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react' | ||
import tt from 'counterpart' | ||
import {connect} from 'react-redux' | ||
|
||
import user from 'app/redux/UserReducer' | ||
import './StartPanel.scss' | ||
|
||
class StartPanel extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
} | ||
} | ||
|
||
startChat = (e) => { | ||
e.preventDefault() | ||
const inp = document.getElementsByClassName('conversation-search-input') | ||
if (!inp.length) { | ||
console.error('startChat - no conversation-search-input') | ||
return | ||
} | ||
if (inp.length > 1) { | ||
console.error('startChat - multiple conversation-search-input:', inp) | ||
return | ||
} | ||
inp[0].focus() | ||
} | ||
|
||
goCreateGroup = (e) => { | ||
e.preventDefault() | ||
this.props.showCreateGroup() | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<img className='msgs-empty-chat' src='/msg_empty.png' /> | ||
<div className='msgs-start-panel'> | ||
<button className='button' onClick={this.startChat}>{tt('msgs_start_panel.start_chat')}</button> | ||
<button className='button hollow' onClick={this.goCreateGroup}>{tt('msgs_start_panel.create_group')}</button> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default connect( | ||
(state, ownProps) => { | ||
return { ...ownProps } | ||
}, | ||
dispatch => ({ | ||
showCreateGroup() { | ||
dispatch(user.actions.showCreateGroup()) | ||
}, | ||
}) | ||
)(StartPanel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
import React from 'react' | ||
import {connect} from 'react-redux' | ||
import { Formik, Form, Field, ErrorMessage, } from 'formik' | ||
import { Map } from 'immutable' | ||
import { Asset, AssetEditor } from 'golos-lib-js/lib/utils' | ||
import tt from 'counterpart' | ||
|
||
import g from 'app/redux/GlobalReducer' | ||
import transaction from 'app/redux/TransactionReducer' | ||
import user from 'app/redux/UserReducer' | ||
import LoadingIndicator from 'app/components/elements/LoadingIndicator' | ||
import FormikAgent from 'app/components/elements/donate/FormikUtils' | ||
|
||
class CreateGroup extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
initialValues: { | ||
name: '' | ||
} | ||
} | ||
} | ||
|
||
validate = () => { | ||
} | ||
|
||
_onSubmit = () => { | ||
} | ||
|
||
render() { | ||
const form = (<Formik | ||
initialValues={this.state.initialValues} | ||
enableReinitialize={true} | ||
validate={this.validate} | ||
onSubmit={this._onSubmit} | ||
> | ||
{({ | ||
handleSubmit, isSubmitting, isValid, values, setFieldValue, handleChange, | ||
}) => { | ||
const disabled = !isValid | ||
return ( | ||
<Form> | ||
|
||
<div className='row' style={{ marginTop: '1.0rem', marginBottom: '1.0rem' }}> | ||
<div className='column small-3' style={{paddingTop: 5}}> | ||
{tt('create_group_jsx.name')} | ||
</div> | ||
<div className='column small-9'> | ||
<Field | ||
type='text' | ||
name='name' | ||
/> | ||
<ErrorMessage name='name' component='div' className='error' /> | ||
</div> | ||
</div> | ||
|
||
<div className='row' style={{ marginTop: '1.0rem', marginBottom: '1.0rem' }}> | ||
<div className='column small-3' style={{paddingTop: 5}}> | ||
{tt('create_group_jsx.logo')} | ||
</div> | ||
<div className='column small-9'> | ||
<Field | ||
type='text' | ||
name='logo' | ||
/> | ||
<ErrorMessage name='logo' component='div' className='error' /> | ||
</div> | ||
</div> | ||
|
||
<div className='row' style={{ marginTop: '1.0rem', marginBottom: '1.0rem' }}> | ||
<div className='column small-3' style={{paddingTop: 5}}> | ||
{tt('create_group_jsx.admin')} | ||
</div> | ||
<div className='column small-9'> | ||
<Field | ||
type='text' | ||
name='admin' | ||
/> | ||
<ErrorMessage name='admin' component='div' className='error' /> | ||
</div> | ||
</div> | ||
|
||
<div className='row' style={{ marginTop: '1.0rem', marginBottom: '1.0rem' }}> | ||
<div className='column small-3' style={{paddingTop: 5}}> | ||
{tt('create_group_jsx.encrypted')} | ||
</div> | ||
<div className='column small-9'> | ||
<Field | ||
type='checkbox' | ||
name='encrypted' | ||
/> | ||
<ErrorMessage name='encrypted' component='div' className='error' /> | ||
</div> | ||
</div> | ||
|
||
<div className='row' style={{ marginTop: '1.0rem', marginBottom: '1.0rem' }}> | ||
<div className='column small-3' style={{paddingTop: 5}}> | ||
{tt('create_group_jsx.access')} | ||
</div> | ||
<div className='column small-9'> | ||
<Field | ||
type='checkbox' | ||
name='access' | ||
/> | ||
<ErrorMessage name='access' component='div' className='error' /> | ||
</div> | ||
</div> | ||
|
||
{isSubmitting ? <span><LoadingIndicator type='circle' /><br /></span> | ||
: <span> | ||
<button type='submit' disabled={disabled} className='button'> | ||
{tt('create_group_jsx.submit')} | ||
</button> | ||
</span>} | ||
</Form> | ||
)}}</Formik>) | ||
|
||
return <div> | ||
<div className='row'> | ||
<h3>{tt('msgs_start_panel.create_group')}</h3> | ||
</div> | ||
{form} | ||
</div> | ||
} | ||
} | ||
|
||
export default connect( | ||
(state, ownProps) => { | ||
const currentUser = state.user.getIn(['current']) | ||
const currentAccount = currentUser && state.global.getIn(['accounts', currentUser.get('username')]) | ||
|
||
return { ...ownProps, | ||
currentUser, | ||
currentAccount, | ||
} | ||
}, | ||
dispatch => ({ | ||
}) | ||
)(CreateGroup) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters