-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Templates for Relay frontend #43
Conversation
Add.js.template - simple screen with a form with all input fields of the mutation from schema.json, it commit mutation onSubmit AddMutation.js.template - simple add mutation template Edit.js.template - simple screen with a form to edit a graphql object type EditMutation.js.template - simple edit mutation template List.js.template - list of objects from relay View.js.template - tabbed detail view of graphql object type WIP of #12
Codecov Report
@@ Coverage Diff @@
## master #43 +/- ##
==========================================
+ Coverage 59.01% 66.46% +7.45%
==========================================
Files 13 22 +9
Lines 305 334 +29
==========================================
+ Hits 180 222 +42
+ Misses 125 112 -13
Continue to review full report at Codecov.
|
]; | ||
|
||
onSubmit = (data) => { | ||
const { company } = this.props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be const { <%= camelCasedName %> } = this.props;
.
onSubmit = (data) => { | ||
const { company } = this.props; | ||
|
||
const mutation = new <%= rawName %>EditMutation({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be name
instead of rawName
.
<%= rawName %>: () => Relay.QL` | ||
fragment on <%= name %> { | ||
id | ||
${<%= name %>EditMutation.getFragment('<%= rawName %>')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<%= camelCasedName %>
instead of rawName
.
}; | ||
|
||
render() { | ||
const { <%= rawName %> } = this.props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<%= camelCasedName %>
instead of rawName
.
<Form | ||
fields={this.fields} | ||
onSubmit={this.onSubmit} | ||
value={<%= rawName %>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<%= camelCasedName %>
instead of rawName
.
label: 'Details', | ||
component: ( | ||
<FlightEdit | ||
<%= rawName %>={<%= rawName %>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCaseName
.
const tabs = [{ | ||
label: 'Details', | ||
component: ( | ||
<FlightEdit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<%= name %>Edit
.
|
||
return ( | ||
<div> | ||
<h1 style={styles.title}><%= name %>: {<%= rawName %>.id}</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCaseName
instead of rawName
.
fragments: { | ||
viewer: ({ id }) => Relay.QL` | ||
fragment on Viewer { | ||
<%= rawName %>(id: $id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCaseName
instead of rawName
.
fragment on Viewer { | ||
<%= rawName %>(id: $id) { | ||
id | ||
${<%= name %>Edit.getFragment('<%= rawName %>')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing.
8e12098
to
16ae274
Compare
Add.js.template - simple screen with a form with all input fields of the mutation from schema.json, it commit mutation onSubmit AddMutation.js.template - simple add mutation template Edit.js.template - simple screen with a form to edit a graphql object type EditMutation.js.template - simple edit mutation template List.js.template - list of objects from relay View.js.template - tabbed detail view of graphql object type WIP of #12
16ae274
to
679f906
Compare
…feature/template_frontend
…ature/template_frontend
…into feature/template_frontend
modern FWI |
Add.js.template - simple screen with a form with all input fields
of the mutation from schema.json, it commit mutation onSubmit
AddMutation.js.template - simple add mutation template
Edit.js.template - simple screen with a form to edit a graphql object type
EditMutation.js.template - simple edit mutation template
List.js.template - list of objects from relay
View.js.template - tabbed detail view of graphql object type
WIP of #12
TODO
withSchema
, read types fromschema.json