From 4e159bd8787048a4338cbdabfeefa836c16503b1 Mon Sep 17 00:00:00 2001 From: Foopert Date: Mon, 30 Jul 2018 20:27:13 -0400 Subject: [PATCH 1/4] ADD: (WIP) UI 'Add Task' Feature for Dashboard and Sidebar --- src/App/Home/Dashboard/Dashboard.js | 87 ++++++++++++++++++++++++++++- src/App/components/sidebar.js | 29 +++++++++- src/graphql/mutations.js | 13 ++++- 3 files changed, 126 insertions(+), 3 deletions(-) diff --git a/src/App/Home/Dashboard/Dashboard.js b/src/App/Home/Dashboard/Dashboard.js index 062e4bc..3d0eddc 100644 --- a/src/App/Home/Dashboard/Dashboard.js +++ b/src/App/Home/Dashboard/Dashboard.js @@ -1,15 +1,100 @@ -import React from 'react' +import React, { Component } from 'react' import { withRouter } from 'react-router-dom' +import { Button, Input, Form } from 'semantic-ui-react' +import { createProject } from '../../../graphql/mutations' // Dashboard: Dashboard style setup with some grouping and visualizations + +const defaultState = { + editing: false, +} + +// Add button that sends "createProject" mutation request on click +class MenuAddProjectButton extends Component { + + constructor(props) { + super(props) + this.state = defaultState + } + + /* + render() { + if (this.props.editing) { + return (
Loading
) + } + } + */ + + toggleEdit() { + this.setState({ + editing: !this.state.editing, + }) + } + + buttonCreateProject() { + this.props.createProject({ + string: "MyMemesTitle" + }) + } + + render() { + return ( +
+
+ ) + } + + /* + render() { + return ( +
+
+ ) + } + */ +} + +/* +const MenuAddProjectButton = () => { + + let editing = false + + return ( +
+
+ ) +} +*/ + class Dashboard extends React.Component { render() { return (
Dashboard +
) } +} + +const funcs = { + } export default withRouter(Dashboard) diff --git a/src/App/components/sidebar.js b/src/App/components/sidebar.js index 3cfe974..cb6c4ce 100644 --- a/src/App/components/sidebar.js +++ b/src/App/components/sidebar.js @@ -1,9 +1,34 @@ import React from 'react' -import { Sidebar, Segment, Menu, Icon, Divider } from 'semantic-ui-react' +import { Button, Sidebar, Segment, Menu, Icon, Divider, Input } from 'semantic-ui-react' import { Link } from 'react-router-dom' import styled from 'styled-components' +import { createProject } from '../../graphql/mutations' import { AnvilSidebar } from '../../utils/anvil' + +// Add button that sends "createProject" mutation request on click +const MenuAddProjectButton = ({createProject}) => { + + const handleRef = (c) => { + this.inputRef = c + } + + const focus = () => { + this.inputRef.focus() + } + + let editing = false + + return ( +
+
+ ) +} class Sidenav extends React.Component { render() { return ( @@ -37,6 +62,8 @@ const MenuProjects = ({ projects }) => {

{project.title}

+ {/* console.log('memes')}/>*/} + ) }) diff --git a/src/graphql/mutations.js b/src/graphql/mutations.js index f00439f..e6f517e 100644 --- a/src/graphql/mutations.js +++ b/src/graphql/mutations.js @@ -10,4 +10,15 @@ const updateTask = gql` } ` -export { updateTask } \ No newline at end of file +// createProject(owners: [ID],title: String!): Project +const createProject = gql` + mutation createProject($owners: [ID], $title: String!) { + createProject(owners: $owners, title: $title) { + id + owners + title + } + } +` + +export { updateTask, createProject } \ No newline at end of file From 1f6998b04432e3b87f40a3ea125d678a26daf54d Mon Sep 17 00:00:00 2001 From: Foopert Date: Mon, 30 Jul 2018 20:44:05 -0400 Subject: [PATCH 2/4] FIX: Adding deleteTask to mutations.js --- src/graphql/mutations.js.orig | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/graphql/mutations.js.orig diff --git a/src/graphql/mutations.js.orig b/src/graphql/mutations.js.orig new file mode 100644 index 0000000..14722c8 --- /dev/null +++ b/src/graphql/mutations.js.orig @@ -0,0 +1,32 @@ +import gql from 'graphql-tag' + +const updateTask = gql` + mutation updateTask($id: ID!, $title: String, $description: String, $due: Int, $completed: Boolean, $section: ID) { + updateTask(id: $id, title: $title, description: $description, due: $due, completed: $completed, section: $section) { + id + title + description + } + } +` +const deleteTask = gql` + mutation deleteTask($id: ID!) { + deleteTask(id: $id) { + id + title + } + } +` + +// createProject(owners: [ID],title: String!): Project +const createProject = gql` + mutation createProject($owners: [ID], $title: String!) { + createProject(owners: $owners, title: $title) { + id + owners + title + } + } +` + +export { updateTask, createProject, deleteTask } From b92572b2553e1cff193bcb74281031d89c7c3fe6 Mon Sep 17 00:00:00 2001 From: Foopert Date: Mon, 30 Jul 2018 20:46:52 -0400 Subject: [PATCH 3/4] FIX: Deleted .orig file of mutations.js --- src/graphql/mutations.js.orig | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 src/graphql/mutations.js.orig diff --git a/src/graphql/mutations.js.orig b/src/graphql/mutations.js.orig deleted file mode 100644 index 14722c8..0000000 --- a/src/graphql/mutations.js.orig +++ /dev/null @@ -1,32 +0,0 @@ -import gql from 'graphql-tag' - -const updateTask = gql` - mutation updateTask($id: ID!, $title: String, $description: String, $due: Int, $completed: Boolean, $section: ID) { - updateTask(id: $id, title: $title, description: $description, due: $due, completed: $completed, section: $section) { - id - title - description - } - } -` -const deleteTask = gql` - mutation deleteTask($id: ID!) { - deleteTask(id: $id) { - id - title - } - } -` - -// createProject(owners: [ID],title: String!): Project -const createProject = gql` - mutation createProject($owners: [ID], $title: String!) { - createProject(owners: $owners, title: $title) { - id - owners - title - } - } -` - -export { updateTask, createProject, deleteTask } From 5e512d454e4c14f71aad80a9d860615c1611f94d Mon Sep 17 00:00:00 2001 From: Connor Maloney Date: Fri, 10 Aug 2018 14:29:38 -0400 Subject: [PATCH 4/4] ADD: Can now add project through UI --- src/App/Home/Dashboard/Dashboard.js | 106 +++++++++++++++++++--------- src/App/components/sidebar.js | 4 +- src/graphql/mutations.js | 9 ++- 3 files changed, 80 insertions(+), 39 deletions(-) diff --git a/src/App/Home/Dashboard/Dashboard.js b/src/App/Home/Dashboard/Dashboard.js index 3d0eddc..9dd3611 100644 --- a/src/App/Home/Dashboard/Dashboard.js +++ b/src/App/Home/Dashboard/Dashboard.js @@ -2,6 +2,7 @@ import React, { Component } from 'react' import { withRouter } from 'react-router-dom' import { Button, Input, Form } from 'semantic-ui-react' import { createProject } from '../../../graphql/mutations' +import { Mutation } from "react-apollo"; // Dashboard: Dashboard style setup with some grouping and visualizations @@ -9,48 +10,86 @@ const defaultState = { editing: false, } +// Change this buttons on click to trigger a create project. + +// TODO: Replace button with "trigger" component +const CreateProject = ( {title, owners} ) => { + + let input; + let editing = false; + + return ( + + {(createProject, { data }) => ( +
+
+ )} +
+ + /* + + {(createProject, { data }) => ( +