Skip to content

Commit

Permalink
imported andrew projectform files
Browse files Browse the repository at this point in the history
  • Loading branch information
Reticent93 committed Jul 15, 2020
1 parent 34af8d9 commit 021cd4e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 179 deletions.
58 changes: 31 additions & 27 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
require('dotenv').config();
module.exports = {
env: {
commonjs: true,
browser: true,
es6: true,
node: true
},
extends: [ 'eslint:recommended', 'plugin:react/recommended', 'plugin:prettier/recommended' ],
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2018,
sourceType: 'module'
},
plugins: [ 'react', 'prettier' ],
rules: {
'react/prop-types': 0,
//endOfLine: process.env.REACT_APP_END_OF_LINE
},
overrides: [
{
files: [ '**/*.test.js' ],
env: {
jest: true
}
}
]
env: {
commonjs: true,
browser: true,
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react', 'prettier'],
rules: {
'react/prop-types': 0,
endOfLine: process.env.REACT_APP_END_OF_LINE,
},
overrides: [
{
files: ['**/*.test.js'],
env: {
jest: true,
},
},
],
};
42 changes: 4 additions & 38 deletions src/views/CreateProject/Privacy.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,6 @@
import React, { PropTypes, useState } from 'react';
import React, { PropTypes } from 'react';
import './styles.scss';

const Privacy = ({ isEditing, project, user }) => {
//useQuery?

const [privacy, setPrivacy] = useState(
isEditing ? (project.privateProjects ? 'private' : 'public') : 'public'
);
const [state, setState] = useState({
project: {
userId: user.id,
name: isEditing ? project.name : '',
description: isEditing ? project.description : '',
figma: isEditing ? project.figma : '',
invision: isEditing ? project.invision : '',
privateProjects: isEditing ? project.privateProjects : false,
mainImg: isEditing ? project.mainImg : '',
},
});

const handlePrivacySetting = (e) => {
setPrivacy(e.target.value);
const isPrivate = e.target.value === 'private' ? true : false;

setState({
...state,
project: {
...state.project,
privateProjects: isPrivate,
},
});
};
//import from auth0
//user.id would be user.sub
//user?.sub
const Privacy = () => {
return (
<>
<label htmlFor="privacyLink" className="label">
Expand All @@ -42,16 +9,15 @@ const Privacy = ({ isEditing, project, user }) => {
<select
type="select"
name="privacy"
value={privacy}
/*value={privacy}*/
placeholder="Select privacy settings"
id="privacyLink"
onChange={handlePrivacySetting}
/*onChange={handlePrivacySetting}*/
>
<option value="public">Public</option>
<option value="private">Private</option>
</select>
</>
);
};

export default Privacy;
117 changes: 3 additions & 114 deletions src/views/CreateProject/ProjectFormBody.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<<<<<<< HEAD
import React, { useState } from 'react';
=======
import React, { useState, useEffect } from 'react';
>>>>>>> 5ee28e61c497fa4a6f0b0c1805b358b86c4dfaa7

import Editing from './Editing';
import Privacy from './Privacy';
import CaseStudy from './CaseStudy';
Expand All @@ -28,18 +25,6 @@ import {

import './styles.scss';

<<<<<<< HEAD
const ProjectFromBody = () => {
const [error, setError] = useState('');
const [state, setState] = useState();

const handleChanges = (e) => {
setError('');
setState({
...state,
project: {
...state.project,
=======
const ProjectFromBody = ({
isEditing,
project,
Expand Down Expand Up @@ -125,38 +110,10 @@ const ProjectFromBody = ({
...newProjectData,
project: {
...newProjectData.project,
>>>>>>> 5ee28e61c497fa4a6f0b0c1805b358b86c4dfaa7
[e.target.name]: e.target.value,
},
});
};
<<<<<<< HEAD
return (
<section className="ProjectForm__body">
<div className="left-container">
<header className="ProjectForm__header">
<h2 className="page-header" />
</header>
<MultiImageUpload /*files={files} setFiles={setFiles} */ />

<div>
<div className="thumbnail-container ">
<div /*key={index}*/>
<img
alt=""
/*src={remove}*/
className="remove"
/>
<div className="thumb" /*key={index}*/>
<div /*style={thumbInner}*/>
<img
alt="project thumbnail"
/*src={photo.url}*/
className="thumbnail"
/>
</div>
</div>
=======
/*___________________HANDLE PRIVACY_____________________________*/
const handlePrivacySetting = (e) => {
setPrivacy(e.target.value);
Expand Down Expand Up @@ -224,7 +181,7 @@ const ProjectFromBody = ({
};

const imageHandler = async (addProjectData) => {
setTimeout( async()=>{
setTimeout(async () => {
imgUrl.forEach(async (url) => {
const { data: addProjectPhotoData } = addProjectPhoto({
variables: {
Expand Down Expand Up @@ -260,9 +217,7 @@ const ProjectFromBody = ({
},
},
});
}, 3000)


}, 3000);
};

/*______________________CREATE PROJECT__________________________*/
Expand Down Expand Up @@ -329,7 +284,6 @@ const ProjectFromBody = ({
{isEditing && (
<div>
<ThumbnailContainer />
>>>>>>> 5ee28e61c497fa4a6f0b0c1805b358b86c4dfaa7
</div>
)}
</div>
Expand Down Expand Up @@ -362,19 +316,10 @@ const ProjectFromBody = ({
name="description"
value={description}
type="text"
<<<<<<< HEAD
/*value={name}*/
name="name"
id="name"
placeholder="Enter project title here"
onChange={handleChanges}
/*ref={setTitleRef}*/
=======
placeholder="Enter description here"
onChange={handleChanges}
className="description"
maxLength="240"
>>>>>>> 5ee28e61c497fa4a6f0b0c1805b358b86c4dfaa7
/>
<CharacterCount string={description} limit={240} />

Expand All @@ -391,61 +336,6 @@ const ProjectFromBody = ({
>
{/*if editing a project and a category was previously selected for the project
display that category as the default selection. if not, dispay the defaut option */}
<<<<<<< HEAD
{/* <option value="" disabled selected hidden>
{projectCategories[0].category}
</option>*/}
{/*):(*/}
<option value="" disabled selected hidden>
Please Select a Category
</option>
<option /*key={category.id} value={category.id}*/>
category.category
</option>
</select>

<label htmlFor="figmaLink" className="label">
Figma
</label>
<input
type="text"
name="figma"
/*value={figma}*/
placeholder="Enter link here (optional)"
id="figmaLink"
/*onChange={handleChanges}*/
/>
<label htmlFor="invisionLink" className="label">
Prototype
</label>
<input
type="text"
name="invision"
/*value={invision}*/
placeholder="Enter link here (optional)"
id="invisionLink"
/*onChange={handleChanges}*/
/>

<CaseStudy />
<Privacy />
<Editing />
<div className="submit-cancel-container">
<button type="button" className="cancel-btn">
Cancel
</button>
<button className="submit-button" type="submit" />
</div>
<div className="error">error</div>

<div className="delete-project-button">
<DeleteIcon />
<p>Delete project</p>
</div>
</form>
</div>
</section>
=======
{/* {isEditing && projectCategories[0] ? (
<option value="" disabled selected hidden>
{projectCategories[0].category}
Expand Down Expand Up @@ -518,7 +408,6 @@ const ProjectFromBody = ({
</div>
</section>
</>
>>>>>>> 5ee28e61c497fa4a6f0b0c1805b358b86c4dfaa7
);
};

Expand Down

0 comments on commit 021cd4e

Please sign in to comment.