|
@@ -1,8 +1,8 @@
|
|
import styled from 'styled-components'
|
|
import styled from 'styled-components'
|
|
import gql from 'graphql-tag'
|
|
import gql from 'graphql-tag'
|
|
import { Mutation, Query } from 'react-apollo'
|
|
import { Mutation, Query } from 'react-apollo'
|
|
-import File from './File'
|
|
|
|
-import ProjectVersion from './ProjectVersion'
|
|
|
|
|
|
+import { FileFields, FileState, uploadFile } from './FileUpload'
|
|
|
|
+import { ProjectVersionFields, ProjectVersionState } from './ProjectVersionForm'
|
|
|
|
|
|
const CREATE_PROJECT = gql`
|
|
const CREATE_PROJECT = gql`
|
|
mutation CREATE_PROJECT($name: String!, $abbreviation: String!, $description: String) {
|
|
mutation CREATE_PROJECT($name: String!, $abbreviation: String!, $description: String) {
|
|
@@ -94,6 +94,14 @@ class Project extends React.Component {
|
|
this.state.id = data.createProject.id
|
|
this.state.id = data.createProject.id
|
|
}}>
|
|
}}>
|
|
<ProjectFields title="Project" state={this.state} onChange={this.toState} />
|
|
<ProjectFields title="Project" state={this.state} onChange={this.toState} />
|
|
|
|
+ {this.state.versions.map(version =>
|
|
|
|
+ <ProjectVersionFields title="Project version" state={version} onChange={this.toState} />
|
|
|
|
+ )}
|
|
|
|
+ <button onClick={event => this.state.versions.push(ProjectVersionState)}>Add project version</button>
|
|
|
|
+ {this.state.files.map(file =>
|
|
|
|
+ <FileFields state={file} onChange={this.toState} />
|
|
|
|
+ )}
|
|
|
|
+ <button onClick={event => this.state.files.push(FileState)}>Add file</button>
|
|
<button type='submit'>{this.state.id && this.state.id !== "__NEW__" ? "Save" : "Add"}</button>
|
|
<button type='submit'>{this.state.id && this.state.id !== "__NEW__" ? "Save" : "Add"}</button>
|
|
</form>
|
|
</form>
|
|
)}
|
|
)}
|