diff --git a/src/admin/.DS_Store b/src/admin/.DS_Store new file mode 100644 index 0000000..ef82ecf Binary files /dev/null and b/src/admin/.DS_Store differ diff --git a/src/admin/client/modules/.DS_Store b/src/admin/client/modules/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/src/admin/client/modules/.DS_Store differ diff --git a/src/admin/client/modules/apps/.DS_Store b/src/admin/client/modules/apps/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/src/admin/client/modules/apps/.DS_Store differ diff --git a/src/admin/client/modules/apps/account/components/account.js b/src/admin/client/modules/apps/account/components/account.js new file mode 100755 index 0000000..1857303 --- /dev/null +++ b/src/admin/client/modules/apps/account/components/account.js @@ -0,0 +1,83 @@ +import React from 'react'; +import { Field, reduxForm } from 'redux-form'; +import { Link } from 'react-router-dom'; +import { TextField } from 'redux-form-material-ui'; + +import { CustomToggle } from 'modules/shared/form'; +import messages from 'lib/text'; +import style from './style.css'; + +import Paper from 'material-ui/Paper'; +import RaisedButton from 'material-ui/RaisedButton'; +import Divider from 'material-ui/Divider'; +import FontIcon from 'material-ui/FontIcon'; +import { List, ListItem } from 'material-ui/List'; + +const AccountForm = ({ handleSubmit, pristine, submitting, initialValues }) => { + return ( +
+
+ {messages.account} +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+
+
+
+ ); +}; + +export default reduxForm({ + form: 'WebStoreAccountForm', + enableReinitialize: true +})(AccountForm); diff --git a/src/admin/client/modules/apps/account/components/details.js b/src/admin/client/modules/apps/account/components/details.js new file mode 100755 index 0000000..f2130f5 --- /dev/null +++ b/src/admin/client/modules/apps/account/components/details.js @@ -0,0 +1,37 @@ +import React from 'react'; +import messages from 'lib/text'; +import style from './style.css'; +import Account from './account'; +import Developer from './developer'; + +export default class WebStoreAccountDetails extends React.Component { + constructor(props) { + super(props); + } + + componentDidMount() { + this.props.fetchData(); + } + + render() { + const { account, onAccountSubmit, onDeveloperSubmit } = this.props; + const developerData = account ? account.developer : null; + + if (account) { + return ( +
+ + {account && + account.is_developer === true && ( + + )} +
+ ); + } else { + return null; + } + } +} diff --git a/src/admin/client/modules/apps/account/components/developer.js b/src/admin/client/modules/apps/account/components/developer.js new file mode 100755 index 0000000..e1cc3c7 --- /dev/null +++ b/src/admin/client/modules/apps/account/components/developer.js @@ -0,0 +1,92 @@ +import React from 'react'; +import { Field, reduxForm } from 'redux-form'; +import { Link } from 'react-router-dom'; +import { TextField } from 'redux-form-material-ui'; + +import { CustomToggle } from 'modules/shared/form'; +import messages from 'lib/text'; +import style from './style.css'; + +import Paper from 'material-ui/Paper'; +import RaisedButton from 'material-ui/RaisedButton'; +import Divider from 'material-ui/Divider'; +import FontIcon from 'material-ui/FontIcon'; +import { List, ListItem } from 'material-ui/List'; + +const DeveloperForm = ({ + handleSubmit, + pristine, + submitting, + initialValues +}) => { + return ( +
+
+ {messages.developerProfile} +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+
+ ); +}; + +export default reduxForm({ + form: 'WebStoreDeveloperForm', + enableReinitialize: true +})(DeveloperForm); diff --git a/src/admin/client/modules/apps/account/components/style.css b/src/admin/client/modules/apps/account/components/style.css new file mode 100755 index 0000000..8fe62aa --- /dev/null +++ b/src/admin/client/modules/apps/account/components/style.css @@ -0,0 +1,26 @@ +.button { + margin-left: 12px; +} + +.toggle { + margin-top: 12px; + margin-bottom: 22px; +} + +.innerBox { + padding: 30px; +} + +.childrenBox { + padding: 0 30px 30px 30px; +} + +.error { + color: rgb(244, 67, 54); +} + +.detailsContainer { + display: flex; + flex-direction: column; + align-items: center; +} diff --git a/src/admin/client/modules/apps/account/index.js b/src/admin/client/modules/apps/account/index.js new file mode 100755 index 0000000..ebbcc4f --- /dev/null +++ b/src/admin/client/modules/apps/account/index.js @@ -0,0 +1,38 @@ +import { connect } from 'react-redux'; +import { + fetchAccount, + updateAccount, + updateDeveloperAccount +} from '../actions'; +import Details from './components/details'; +import * as webstoreAuth from 'lib/webstoreAuth'; + +const mapStateToProps = (state, ownProps) => { + return { + account: state.apps.account + }; +}; + +const mapDispatchToProps = (dispatch, ownProps) => { + return { + fetchData: () => { + const webstoreAuthorized = webstoreAuth.isCurrentTokenValid(); + if (webstoreAuthorized) { + dispatch(fetchAccount()); + } else { + ownProps.history.push('/admin/apps/login'); + } + }, + onAccountSubmit: values => { + dispatch(updateAccount(values)); + }, + onDeveloperSubmit: values => { + dispatch(updateDeveloperAccount(values)); + } + }; +}; + +export default connect( + mapStateToProps, + mapDispatchToProps +)(Details);