@@ -103,6 +111,7 @@ export default connect(
show_donate_modal: state.user.get('show_donate_modal'),
show_create_group_modal: state.user.get('show_create_group_modal'),
show_my_groups_modal: state.user.get('show_my_groups_modal'),
+ show_group_settings_modal: state.user.get('show_group_settings_modal'),
show_app_download_modal: state.user.get('show_app_download_modal'),
loginUnclosable,
notifications: state.app.get('notifications'),
@@ -125,6 +134,10 @@ export default connect(
if (e) e.preventDefault()
dispatch(user.actions.hideMyGroups())
},
+ hideGroupSettings: e => {
+ if (e) e.preventDefault()
+ dispatch(user.actions.hideGroupSettings())
+ },
hideAppDownload: e => {
if (e) e.preventDefault()
dispatch(user.actions.hideAppDownload())
diff --git a/src/components/modules/groups/GroupSettings.jsx b/src/components/modules/groups/GroupSettings.jsx
new file mode 100644
index 00000000..61f74904
--- /dev/null
+++ b/src/components/modules/groups/GroupSettings.jsx
@@ -0,0 +1,194 @@
+import React from 'react'
+import {connect} from 'react-redux'
+import { Formik, Form, Field, ErrorMessage, } from 'formik'
+import { Map } from 'immutable'
+import { api, formatter } from 'golos-lib-js'
+import tt from 'counterpart'
+
+import g from 'app/redux/GlobalReducer'
+import transaction from 'app/redux/TransactionReducer'
+import user from 'app/redux/UserReducer'
+import { session } from 'app/redux/UserSaga'
+import DropdownMenu from 'app/components/elements/DropdownMenu'
+import ExtLink from 'app/components/elements/ExtLink'
+import Icon from 'app/components/elements/Icon'
+import LoadingIndicator from 'app/components/elements/LoadingIndicator'
+import DialogManager from 'app/components/elements/common/DialogManager'
+import { showLoginDialog } from 'app/components/dialogs/LoginDialog'
+import { getGroupLogo, getGroupMeta, getGroupTitle } from 'app/utils/groups'
+
+class GroupSettings extends React.Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ loaded: false
+ }
+ }
+
+ componentDidMount() {
+ const { currentGroup } = this.props
+ const group = currentGroup.toJS()
+ const { name, member_list, privacy, json_metadata } = group
+ const meta = getGroupMeta(json_metadata)
+ let admin
+ for (const mem of member_list) {
+ if (mem.member_type === 'admin') {
+ admin = mem.account
+ }
+ break
+ }
+ const initialValues = {
+ title: meta.title,
+ logo: meta.logo,
+ admin,
+ privacy
+ }
+ this.setState({
+ initialValues
+ })
+ }
+
+ onTitleChange = (e, { applyFieldValue }) => {
+ const { value } = e.target
+ if (value.trimLeft() !== value) {
+ return
+ }
+ applyFieldValue('title', value)
+ }
+
+ onLogoChange = (e, { applyFieldValue }) => {
+ const { value } = e.target
+ applyFieldValue('logo', value)
+ }
+
+ onAdminChange = (e, { applyFieldValue }) => {
+ const { value } = e.target
+ applyFieldValue('admin', value)
+ }
+
+ validate = async () => {
+
+ }
+
+ onSubmit = async () => {
+
+ }
+
+ closeMe = (e) => {
+ e.preventDefault()
+ this.props.closeMe()
+ }
+
+ render() {
+ const { currentGroup } = this.props
+ const group = currentGroup.toJS()
+ const { name, json_metadata } = group
+
+ const meta = getGroupMeta(json_metadata)
+ const title = getGroupTitle(meta, name)
+
+ const { initialValues } = this.state
+
+ let form
+ if (!initialValues) {
+ form =
+ } else {
+ form =
+ {({
+ handleSubmit, isSubmitting, isValid, values, errors, setFieldValue, applyFieldValue, setFieldTouched, handleChange,
+ }) => {
+ const disabled = !isValid
+ return (
+
+ )}}
+ }
+
+ return
+
+
{tt('group_settings_jsx.title_GROUP', {
+ GROUP: title
+ })}
+
+ {form}
+
+ }
+}
+
+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,
+ currentGroup: state.user.get('current_group'),
+ }
+ },
+ dispatch => ({
+ })
+)(GroupSettings)
diff --git a/src/components/modules/groups/GroupSettings.scss b/src/components/modules/groups/GroupSettings.scss
new file mode 100644
index 00000000..927dd851
--- /dev/null
+++ b/src/components/modules/groups/GroupSettings.scss
@@ -0,0 +1,5 @@
+.GroupSettings {
+ h3 {
+ padding-left: 0.75rem;
+ }
+}
diff --git a/src/components/modules/groups/MyGroups.jsx b/src/components/modules/groups/MyGroups.jsx
index a87169f4..b43f78f0 100644
--- a/src/components/modules/groups/MyGroups.jsx
+++ b/src/components/modules/groups/MyGroups.jsx
@@ -1,9 +1,7 @@
import React from 'react'
import {connect} from 'react-redux'
-import { Formik, Form, Field, ErrorMessage, } from 'formik'
import { Map } from 'immutable'
import { api, formatter } from 'golos-lib-js'
-import { Asset, Price, AssetEditor } from 'golos-lib-js/lib/utils'
import tt from 'counterpart'
import g from 'app/redux/GlobalReducer'
@@ -14,7 +12,6 @@ import DropdownMenu from 'app/components/elements/DropdownMenu'
import ExtLink from 'app/components/elements/ExtLink'
import Icon from 'app/components/elements/Icon'
import LoadingIndicator from 'app/components/elements/LoadingIndicator'
-import FormikAgent from 'app/components/elements/donate/FormikUtils'
import DialogManager from 'app/components/elements/common/DialogManager'
import { showLoginDialog } from 'app/components/dialogs/LoginDialog'
import { getGroupLogo, getGroupMeta } from 'app/utils/groups'
@@ -73,6 +70,11 @@ class MyGroups extends React.Component {
}))
}
+ showGroupSettings = (e, group) => {
+ e.preventDefault()
+ this.props.showGroupSettings({ group })
+ }
+
_renderGroup = (group) => {
const { name, json_metadata } = group
@@ -99,11 +101,15 @@ class MyGroups extends React.Component {
{
e.preventDefault()
}}>
- |