Skip to content

Commit 34df49c

Browse files
committed
Resolved merge conflicts
2 parents d78dda1 + 2a30711 commit 34df49c

File tree

22 files changed

+684
-304
lines changed

22 files changed

+684
-304
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"@material-ui/styles": "^4.9.6",
113113
"@types/enzyme": "^3.10.5",
114114
"@types/enzyme-adapter-react-16": "^1.0.6",
115+
"@types/js-cookie": "^2.2.6",
115116
"@types/prettier": "^1.19.0",
116117
"@types/prismjs": "^1.16.0",
117118
"@types/react": "^16.8.14",
@@ -137,6 +138,7 @@
137138
"electron-splashscreen": "^1.0.0",
138139
"enzyme": "^3.4.1",
139140
"enzyme-adapter-react-16": "^1.2.0",
141+
"js-cookie": "^2.2.1",
140142
"konva": "^4.2.0",
141143
"localforage": "^1.7.2",
142144
"lodash.throttle": "^4.1.1",

server/controllers/userController.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ const bcrypt = require('bcryptjs');
77

88
userController.createUser = (req, res, next) => {
99
console.log('Creating user...');
10-
const { username, password } = req.body;
10+
const { email, username, password } = req.body;
1111
// error handling if username or password is missing
1212
if (!username) {
1313
return res.status(400).json('No username input');
1414
}
15+
if (!email) {
16+
return res.status(400).json('No email input');
17+
}
1518
if (!password) {
1619
return res.status(400).json('No password input');
1720
}
18-
const projects = [];
21+
1922
// create user using username and password
20-
Users.create({ username, password, projects }, (err, newUser) => {
23+
Users.create({ email, username, password, projects: [] }, (err, newUser) => {
2124
if (err) {
2225
return next({
2326
log: `Error in userController.createUser: ${err}`,

server/models/userModel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ const Schema = mongoose.Schema;
55

66
const userSchema = new Schema({
77
username: { type: String, required: true, unique: true },
8+
email: { type: String, required: true, unique: true },
89
password: { type: String, required: true },
910
projects: Array
1011
});
1112

1213
// salt will go through 10 rounds of hashing
1314
const SALT_WORK_FACTOR = 10;
1415
const bcrypt = require('bcryptjs');
15-
const { session } = require('electron');
1616

1717
// mongoose middleware that will run before the save to collection happens (user gets put into database)
1818
// cannot use arrow function here as context of 'this' is important

src/actionTypes/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,4 @@ export const UPDATE_CHILDREN_SORT: string = 'UPDATE_CHILDREN_SORT';
4141
export const UPDATE_CODE: string = 'UPDATE_CODE';
4242
export const UPDATE_HTML_ATTR: string = 'UPDATE_HTML_ATTR';
4343

44-
export const SET_USERNAME: string = 'SET_USERNAME';
45-
export const SET_PASSWORD: string = 'SET_PASSWORD';
46-
export const LOGIN: string = 'LOGIN';
47-
export const SIGNUP: string = 'SIGNUP';
44+
export const SET_LOGIN_STATE: string = 'SET_LOGIN_STATE';

src/actions/actionCreators.ts

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ import {
3939
UNDO,
4040
UPDATE_HTML_ATTR,
4141
UPDATE_CODE,
42-
SET_USERNAME,
43-
SET_PASSWORD,
44-
LOGIN,
45-
SIGNUP
42+
SET_LOGIN_STATE
4643
} from '../actionTypes/index';
4744
import { loadState } from '../localStorage';
4845
import createFiles from '../utils/createFiles.util';
@@ -333,28 +330,6 @@ export const updateHtmlAttr = ({
333330
payload: { attr, value }
334331
});
335332

336-
export const setUsername = (username: string): Action => ({
337-
type: SET_USERNAME,
338-
payload: username
339-
});
340-
341-
export const setPassword = (password: string): Action => ({
342-
type: SET_PASSWORD,
343-
payload: password
344-
})
345-
346-
// export const login = (username: string, password: string) => ({
347-
// return (dispatch: any) => {
348-
// fetch('/login', {
349-
// method: 'POST',
350-
// body: JSON.stringify({ username, password })
351-
// })
352-
// .then(response => response.json())
353-
// .then(data => console.log(data))
354-
// }
355-
// })
356-
357-
// export const signup = (username: string, password: string): Action => ({
358-
// type: SIGNUP,
359-
// payload: { username, password }
360-
// })
333+
export const setLoginState = (): Action => ({
334+
type: SET_LOGIN_STATE
335+
})

src/components/left/ComponentPanelItemNew.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Grid from '@material-ui/core/Grid';
44
import { useDrag } from 'react-dnd';
55
import { ItemTypes } from '../../constants/ItemTypes';
66

7-
const ComponentPanelItem = (): JSX.Element => {
7+
const ComponentPanelItem: React.FC<{name: String, id: Number, root: Boolean, focusClick: any}> = ({name, id, root, focusClick}) => {
88
// useDrag hook allows components in left panel to be drag source
99
const [{ isDragging }, drag] = useDrag({
1010
item: {
@@ -14,6 +14,7 @@ const ComponentPanelItem = (): JSX.Element => {
1414
instanceId: 2
1515
// category,
1616
},
17+
canDrag: !root,
1718
collect: (monitor: any) => ({
1819
isDragging: !!monitor.isDragging()
1920
})
@@ -22,18 +23,23 @@ const ComponentPanelItem = (): JSX.Element => {
2223
<Grid
2324
item
2425
ref={drag}
25-
xs={12}
26+
xs={8}
2627
style={{
2728
color: 'white',
2829
// this is experimental for version: BLADERUNNER THEME
29-
backgroundColor: 'none',
30-
borderRadius: '10px',
30+
backgroundColor: 'transparent',
3131
// minWidth: '340px',
32-
minHeight: '100px',
33-
border: '2px solid white'
32+
height: '80px',
33+
marginBottom: '15px',
34+
border: root ? '2px dotted rgba(255,255,255, 0.45)' : '2px solid rgba(255,255,255, 1)',
35+
borderRadius: root ? '' : '8px',
3436
}}
3537
>
36-
Component Panel
38+
39+
<div className="compPanelItem" onClick={focusClick}>
40+
<h3>{id} {name}</h3>
41+
</div>
42+
3743
</Grid>
3844
);
3945
};

0 commit comments

Comments
 (0)