Skip to content

Commit e8715ad

Browse files
authored
Merge pull request #12 from eddypjr/finalTest
Changed version number of package.json from 5.0 to 6.0 and reviewed for OS LAB final merge
2 parents 0701c10 + f53b5b2 commit e8715ad

File tree

15 files changed

+16
-529
lines changed

15 files changed

+16
-529
lines changed

__tests__/__snapshots__/enzyme.test.tsx.snap

Lines changed: 0 additions & 458 deletions
This file was deleted.

__tests__/enzyme.test.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ describe('Test AppContainer container', () => {
109109
});
110110
// testing for a RightContainer
111111
it('Should render RightContainer', () => {
112-
// This test doesnt work eventhough the component renders
113-
// expect(
114-
// target.contains(
115-
// <RightContainer isThemeLight={props.isThemeLight}/>
116-
// )).toBe(true);
117112
expect(
118113
target.find(RightContainer)
119114
).toHaveLength(1);

app/electron/main.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,9 @@ async function createWindow() {
6060
// Create the browser window.
6161
win = new BrowserWindow({
6262
// full screen
63-
// width: 1920,
64-
// height: 1080,
65-
width: 1024,
66-
height: 576,
63+
width: 1920,
64+
height: 1080,
65+
6766
minWidth: 980,
6867
// window title
6968
title: 'ReacType',
@@ -203,15 +202,6 @@ app.on('ready', createWindow);
203202

204203
// TRYING ELECTRON-WINDOW-MANAGER When the application is ready
205204

206-
// app.on('ready', () => {
207-
// windowManager.setDefaultSetup({'width': 800, 'height': 450, 'position': 'right'});
208-
// // Open Dashboard window
209-
// const dashboard = windowManager.open('home', 'Welcome ...', 'http://localhost:5000/home.html');
210-
// dashboard.toggleDevTools(false);
211-
// // Load ReacType window
212-
// createWindow();
213-
// });
214-
215205
// Quit when all windows are closed.
216206
app.on('window-all-closed', () => {
217207
app.quit();

app/src/components/bottom/CodePreview.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import 'ace-builds/src-noconflict/theme-solarized_dark';
88
import 'ace-builds/src-noconflict/theme-solarized_light';
99
import 'ace-builds/src-noconflict/theme-terminal';
1010
import { Component } from '../../interfaces/Interfaces';
11-
import { EditorState } from 'draft-js';
12-
import { Editor } from 'react-draft-wysiwyg';
1311
import useResizeObserver from '../../tree/useResizeObserver';
1412
import { string } from 'prop-types';
1513

app/src/components/main/Canvas.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Component, DragItem } from '../../interfaces/Interfaces';
66
import { combineStyles } from '../../helperFunctions/combineStyles';
77
import renderChildren from '../../helperFunctions/renderChildren';
88

9-
109
function Canvas() {
1110
const [state, dispatch] = useContext(StateContext);
1211
// find the current component to render on the canvas
@@ -25,7 +24,7 @@ function Canvas() {
2524
changeFocus(state.canvasFocus.componentId, null);
2625
};
2726

28-
// stores a snapshot of state into the past array for UNDO
27+
// stores a snapshot of state into the past array for UNDO. snapShotFunc is also invoked for nestable elements in DirectChildHTMLNestable.tsx
2928
const snapShotFunc = () => {
3029
// make a deep clone of state
3130
const deepCopiedState = JSON.parse(JSON.stringify(state));

app/src/components/main/CanvasContainer.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ function CanvasContainer() {
99
border: '2px Solid grey',
1010
};
1111

12-
function onChangeHandler(event) {
13-
console.log('working', event.target);
14-
}
15-
1612
return (
1713
<div style={canvasContainerStyle}>
1814
<Canvas />

app/src/components/main/DirectChildHTMLNestable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ function DirectChildHTMLNestable({
1717
}: ChildElement) {
1818
const [state, dispatch] = useContext(StateContext);
1919
const ref = useRef(null);
20-
// takes a snapshot of state to be used in UNDO and REDO cases
20+
21+
// takes a snapshot of state to be used in UNDO and REDO cases. snapShotFunc is also invoked in Canvas.tsx
2122
const snapShotFunc = () => {
2223
//makes a deep clone of state
2324
const deepCopiedState = JSON.parse(JSON.stringify(state));

app/src/components/top/NavBar.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ import createModal from '../right/createModal';
3232
import StateContext from '../../context/context';
3333
import logo from '../../public/icons/win/logo.png';
3434

35-
36-
// ROUTING TO DASHBOARD
37-
3835
// NavBar text and button styling
3936
const useStyles = makeStyles((theme: Theme) => createStyles({
4037
root: {

app/src/index.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,14 @@ import SignUp from './components/login/SignUp.tsx';
1515
import FBPassWord from './components/login/FBPassWord.tsx';
1616
import Tutorial from './tutorial/Tutorial.tsx';
1717
import TutorialPage from './tutorial/TutorialPage.tsx';
18-
19-
20-
/*
21-
* Dashboard
22-
*/
23-
// import TestDashboard from './Dashboard/FormsContainer.ts';
2418
import ProjectDashboard from './Dashboard/ProjectContainer.tsx';
25-
2619
import styles from './Dashboard/styles.css';
2720

2821
const client = new ApolloClient({
2922
uri: 'http://localhost:5000/graphql',
3023
cache: new InMemoryCache()
3124
});
3225

33-
/*
34-
*
35-
*/
36-
37-
3826
const PrivateRoute = ({ component: Component, ...rest }) => (
3927
<Route
4028
{...rest}
@@ -48,7 +36,6 @@ const PrivateRoute = ({ component: Component, ...rest }) => (
4836
/>
4937
);
5038

51-
5239
ReactDOM.render(
5340
<ApolloProvider client={client}>
5441
<Router>

app/src/reducers/componentReducer.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,6 @@ const reducer = (state: State, action: Action) => {
328328
if (directParent && directParent.name === 'separator')
329329
nextTopSeparatorId = manageSeparators.handleSeparators(addChildArray, 'add');
330330
components[canvasFocus.componentId-1].children = addChildArray;
331-
332-
// const realPast = [];
333331

334332
parentComponent.code = generateCode(
335333
components,
@@ -653,8 +651,9 @@ const reducer = (state: State, action: Action) => {
653651
//the children array of the focused component will equal the last element of the future array
654652
state.components[focusIndex].children = state.components[focusIndex].future[state.components[focusIndex].future.length - 1]
655653
//the last element of the future array gets pushed into the past
654+
const poppedEl = state.components[focusIndex].future.pop();
656655
//the last element of the future array gets popped out
657-
state.components[focusIndex].past.push(state.components[focusIndex].future.pop())
656+
state.components[focusIndex].past.push(poppedEl);
658657

659658
// generate code for the Code Preview
660659
state.components.forEach((el, i) => {

app/src/tutorial/Canvas.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,3 @@ const Canvas: React.FC<{
6565
};
6666

6767
export default Canvas;
68-

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "reactype",
3-
"version": "5.0.0",
3+
"version": "6.0.0",
44
"description": "Prototyping tool for React/Typescript Applications.",
55
"private": true,
66
"main": "app/electron/main.js",
@@ -40,7 +40,7 @@
4040
"scripts": {
4141
"postinstall": "ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true electron-builder install-app-deps",
4242
"dev-server": "cross-env NODE_ENV=development webpack-dev-server --config ./webpack.development.js",
43-
"dev": "concurrently --success first \"cross-env NODE_ENV=development webpack-dev-server --config ./webpack.development.js\" \"cross-env NODE_ENV=development electron .\" \"npm run server\" ",
43+
"dev": "concurrently --success first \"cross-env NODE_ENV=development webpack-dev-server --config ./webpack.development.js\" \"cross-env NODE_ENV=development electron .\" \"npm run server\" -k",
4444
"p": "concurrently --success first \"npm run dev-server\" \"cross-env NODE_ENV=production electron .\" \"nodemon server/server.js\" -k",
4545
"prod-build": "cross-env NODE_ENV=production npx webpack --mode=production --config ./webpack.production.js",
4646
"prod": "npm run prod-build && electron . --no-sandbox",
@@ -51,9 +51,7 @@
5151
"dist-windows": "npm run prod-build && electron-builder --windows",
5252
"dist-all": "npm run prod-build && electron-builder --mac --linux --windows",
5353
"test": " concurrently \"npm run dev-server\" \"cross-env NODE_ENV=test jest --verbose \"",
54-
"k-test": "concurrently \"npm run dev-server\" \"cross-env NODE_ENV=test jest users.test.js --detectOpenHandles \"",
55-
"server": "cross-env NODE_ENV=development nodemon server/server.js",
56-
"electron": "cross-env NODE_ENV=development electron ."
54+
"server": "cross-env NODE_ENV=development nodemon server/server.js"
5755
},
5856
"repository": {
5957
"type": "git",

server/graphQL/resolvers/query.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,8 @@ const Project = {
4040
});
4141
}
4242
}
43-
// The nested query in the Apollo Server example only works if we nest the comment document directly inside the project document, not applicable in to our
44-
// implementation. Since we can just retrieve the comments for each project using the projectId as the filter, we just need to retrive all the comments and parse them to each
45-
// project in the return statement
46-
47-
// First step is to retrieve all the Comments using await and save them to an array
48-
// Next, in the map loop below, filter our the comments for each project
49-
// NOTE: There is probably better way to do this, but this will work for now and we can improve it later on
43+
5044
const comCollection = await Comments.find({});
51-
// console.log('comCollection', comCollection);
5245

5346
if (resp) {
5447
return resp.map(proj => ({
@@ -59,7 +52,7 @@ const Project = {
5952
likes: proj.likes,
6053
published: proj.published,
6154
createdAt: proj.createdAt,
62-
comments: comCollection.filter(commentDoc => commentDoc.projectId.toString() === proj._id.toString()), // here we should filter the comments for each proj and return it here
55+
comments: comCollection.filter(commentDoc => commentDoc.projectId.toString() === proj._id.toString()), // here we should filter the comments for each proj and return it here
6356
}));
6457
}
6558
// resp is null, return error message

server/models/reactypeModels.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,11 @@ const projectSchema = new Schema({
8888
}, { minimize: false });
8989
// option 'minimize' prevent Mongoose from removing empty 'style' value in the copy
9090

91-
// Test schema for implementing GraphQL
92-
const testSchema = new Schema({
93-
name: String,
94-
likes: Number,
95-
});
96-
const Tests = mongoose.model('Tests', testSchema);
97-
/* *********************************************** */
98-
9991
const Users = mongoose.model('Users', userSchema);
10092
const Comments = mongoose.model('Comments', commentsSchema);
10193
const Sessions = mongoose.model('Sessions', sessionSchema);
10294
const Projects = mongoose.model('Projects', projectSchema);
10395

10496
module.exports = {
105-
Users, Comments, Sessions, Projects, Tests,
97+
Users, Comments, Sessions, Projects,
10698
};

webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ module.exports = {
66
// since JS can be written for both server / browser, the "target" specifies what environment webpack should write for
77
target: 'web', // Our app can run without electron
88
// The entry is where webpack begins assembling the dependency tree
9-
entry: ['./app/src/index.js'],
9+
entry: ['./app/src/index.js'], // The entry point of our app; these entry points can be named and we can also have multiple if we'd like to split the webpack bundle into smaller files to improve script loading speed between multiple pages of our app
10+
// the output is only created on npm run-prod-build
1011
output: {
1112
path: path.resolve(__dirname, 'app/dist'), // Where all the output files get dropped after webpack is done with them
1213
filename: 'bundle.js' // The name of the webpack bundle that's generated

0 commit comments

Comments
 (0)