Skip to content
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

Closed
wants to merge 18 commits into from
Closed

Conversation

sibelius
Copy link
Collaborator

@sibelius sibelius commented Jan 4, 2017

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

  • add tests
  • add withSchema, read types from schema.json
  • add frontend boilerplate

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-io
Copy link

codecov-io commented Jan 4, 2017

Codecov Report

Merging #43 into master will increase coverage by 7.45%.
The diff coverage is 37.7%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
packages/create-graphql/src/index.js 0% <ø> (ø) ⬆️
packages/create-graphql/src/commands/index.js 0% <ø> (ø) ⬆️
packages/generator/src/frontend/list/index.js 0% <0%> (ø)
packages/generator/src/frontend/add/index.js 0% <0%> (ø)
packages/create-graphql/src/commands/frontend.js 0% <0%> (ø)
packages/generator/src/frontend/view/index.js 0% <0%> (ø)
packages/generator/src/frontend/edit/index.js 0% <0%> (ø)
packages/generator/src/list/index.js 91.66% <91.66%> (ø)
packages/generator/src/view/index.js 91.66% <91.66%> (ø)
packages/generator/src/edit/index.js 92.3% <92.3%> (ø)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df73aff...9830d5d. Read the comment docs.

];

onSubmit = (data) => {
const { company } = this.props;
Copy link
Collaborator

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({
Copy link
Collaborator

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 %>')}
Copy link
Collaborator

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;
Copy link
Collaborator

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 %>}
Copy link
Collaborator

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 %>}
Copy link
Collaborator

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
Copy link
Collaborator

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>
Copy link
Collaborator

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) {
Copy link
Collaborator

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 %>')}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing.

@sibelius sibelius force-pushed the feature/template_frontend branch 2 times, most recently from 8e12098 to 16ae274 Compare February 6, 2017 18:34
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
@sibelius
Copy link
Collaborator Author

modern FWI

@sibelius sibelius closed this May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants