Skip to content

Commit acd1d7f

Browse files
committed
upload
1 parent 74d616f commit acd1d7f

8 files changed

Lines changed: 276 additions & 0 deletions

File tree

src/admin/.DS_Store

6 KB
Binary file not shown.

src/admin/client/modules/.DS_Store

6 KB
Binary file not shown.
6 KB
Binary file not shown.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import React from 'react';
2+
import { Field, reduxForm } from 'redux-form';
3+
import { Link } from 'react-router-dom';
4+
import { TextField } from 'redux-form-material-ui';
5+
6+
import { CustomToggle } from 'modules/shared/form';
7+
import messages from 'lib/text';
8+
import style from './style.css';
9+
10+
import Paper from 'material-ui/Paper';
11+
import RaisedButton from 'material-ui/RaisedButton';
12+
import Divider from 'material-ui/Divider';
13+
import FontIcon from 'material-ui/FontIcon';
14+
import { List, ListItem } from 'material-ui/List';
15+
16+
const AccountForm = ({ handleSubmit, pristine, submitting, initialValues }) => {
17+
return (
18+
<div style={{ maxWidth: 720, width: '100%' }}>
19+
<div className="gray-title" style={{ margin: '15px 0 15px 20px' }}>
20+
{messages.account}
21+
</div>
22+
<form
23+
onSubmit={handleSubmit}
24+
style={{
25+
display: 'initial',
26+
width: '100%'
27+
}}
28+
>
29+
<Paper style={{ margin: '0px 20px' }} zDepth={1}>
30+
<div style={{ padding: '10px 30px 30px 30px' }}>
31+
<div>
32+
<Field
33+
component={TextField}
34+
fullWidth={true}
35+
name="email"
36+
floatingLabelText={messages.email}
37+
/>
38+
</div>
39+
<div>
40+
<Field
41+
component={TextField}
42+
fullWidth={true}
43+
name="shop_url"
44+
floatingLabelText={messages.shopUrl}
45+
/>
46+
</div>
47+
<div>
48+
<Field
49+
component={TextField}
50+
fullWidth={true}
51+
name="admin_url"
52+
floatingLabelText={messages.adminUrl}
53+
/>
54+
</div>
55+
<Field
56+
component={CustomToggle}
57+
name="is_developer"
58+
label={messages.isDeveloper}
59+
style={{ paddingTop: 16, paddingBottom: 16 }}
60+
/>
61+
</div>
62+
<div
63+
className="buttons-box"
64+
style={{ display: pristine ? 'none' : 'block' }}
65+
>
66+
<RaisedButton
67+
type="submit"
68+
label={messages.save}
69+
primary={true}
70+
className={style.button}
71+
disabled={pristine || submitting}
72+
/>
73+
</div>
74+
</Paper>
75+
</form>
76+
</div>
77+
);
78+
};
79+
80+
export default reduxForm({
81+
form: 'WebStoreAccountForm',
82+
enableReinitialize: true
83+
})(AccountForm);
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from 'react';
2+
import messages from 'lib/text';
3+
import style from './style.css';
4+
import Account from './account';
5+
import Developer from './developer';
6+
7+
export default class WebStoreAccountDetails extends React.Component {
8+
constructor(props) {
9+
super(props);
10+
}
11+
12+
componentDidMount() {
13+
this.props.fetchData();
14+
}
15+
16+
render() {
17+
const { account, onAccountSubmit, onDeveloperSubmit } = this.props;
18+
const developerData = account ? account.developer : null;
19+
20+
if (account) {
21+
return (
22+
<div className={style.detailsContainer + ' scroll col-full-height'}>
23+
<Account initialValues={account} onSubmit={onAccountSubmit} />
24+
{account &&
25+
account.is_developer === true && (
26+
<Developer
27+
initialValues={developerData}
28+
onSubmit={onDeveloperSubmit}
29+
/>
30+
)}
31+
</div>
32+
);
33+
} else {
34+
return null;
35+
}
36+
}
37+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import React from 'react';
2+
import { Field, reduxForm } from 'redux-form';
3+
import { Link } from 'react-router-dom';
4+
import { TextField } from 'redux-form-material-ui';
5+
6+
import { CustomToggle } from 'modules/shared/form';
7+
import messages from 'lib/text';
8+
import style from './style.css';
9+
10+
import Paper from 'material-ui/Paper';
11+
import RaisedButton from 'material-ui/RaisedButton';
12+
import Divider from 'material-ui/Divider';
13+
import FontIcon from 'material-ui/FontIcon';
14+
import { List, ListItem } from 'material-ui/List';
15+
16+
const DeveloperForm = ({
17+
handleSubmit,
18+
pristine,
19+
submitting,
20+
initialValues
21+
}) => {
22+
return (
23+
<div style={{ maxWidth: 720, width: '100%' }}>
24+
<div className="gray-title" style={{ margin: '15px 0 15px 20px' }}>
25+
{messages.developerProfile}
26+
</div>
27+
<form
28+
onSubmit={handleSubmit}
29+
style={{
30+
display: 'initial',
31+
width: '100%'
32+
}}
33+
>
34+
<Paper style={{ margin: '0px 20px' }} zDepth={1}>
35+
<div style={{ padding: '10px 30px 30px 30px' }}>
36+
<div>
37+
<Field
38+
component={TextField}
39+
fullWidth={true}
40+
name="name"
41+
floatingLabelText={messages.fullName}
42+
/>
43+
</div>
44+
<div>
45+
<Field
46+
component={TextField}
47+
fullWidth={true}
48+
name="description"
49+
floatingLabelText={messages.description}
50+
multiLine={true}
51+
rows={1}
52+
/>
53+
</div>
54+
<div>
55+
<Field
56+
component={TextField}
57+
fullWidth={true}
58+
name="website"
59+
floatingLabelText={messages.website}
60+
/>
61+
</div>
62+
<div>
63+
<Field
64+
component={TextField}
65+
fullWidth={true}
66+
name="email"
67+
floatingLabelText={messages.email}
68+
/>
69+
</div>
70+
</div>
71+
<div
72+
className="buttons-box"
73+
style={{ display: pristine ? 'none' : 'block' }}
74+
>
75+
<RaisedButton
76+
type="submit"
77+
label={messages.save}
78+
primary={true}
79+
className={style.button}
80+
disabled={pristine || submitting}
81+
/>
82+
</div>
83+
</Paper>
84+
</form>
85+
</div>
86+
);
87+
};
88+
89+
export default reduxForm({
90+
form: 'WebStoreDeveloperForm',
91+
enableReinitialize: true
92+
})(DeveloperForm);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.button {
2+
margin-left: 12px;
3+
}
4+
5+
.toggle {
6+
margin-top: 12px;
7+
margin-bottom: 22px;
8+
}
9+
10+
.innerBox {
11+
padding: 30px;
12+
}
13+
14+
.childrenBox {
15+
padding: 0 30px 30px 30px;
16+
}
17+
18+
.error {
19+
color: rgb(244, 67, 54);
20+
}
21+
22+
.detailsContainer {
23+
display: flex;
24+
flex-direction: column;
25+
align-items: center;
26+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { connect } from 'react-redux';
2+
import {
3+
fetchAccount,
4+
updateAccount,
5+
updateDeveloperAccount
6+
} from '../actions';
7+
import Details from './components/details';
8+
import * as webstoreAuth from 'lib/webstoreAuth';
9+
10+
const mapStateToProps = (state, ownProps) => {
11+
return {
12+
account: state.apps.account
13+
};
14+
};
15+
16+
const mapDispatchToProps = (dispatch, ownProps) => {
17+
return {
18+
fetchData: () => {
19+
const webstoreAuthorized = webstoreAuth.isCurrentTokenValid();
20+
if (webstoreAuthorized) {
21+
dispatch(fetchAccount());
22+
} else {
23+
ownProps.history.push('/admin/apps/login');
24+
}
25+
},
26+
onAccountSubmit: values => {
27+
dispatch(updateAccount(values));
28+
},
29+
onDeveloperSubmit: values => {
30+
dispatch(updateDeveloperAccount(values));
31+
}
32+
};
33+
};
34+
35+
export default connect(
36+
mapStateToProps,
37+
mapDispatchToProps
38+
)(Details);

0 commit comments

Comments
 (0)