Skip to content

Commit 243719e

Browse files
committed
cleaned up codebase
1 parent d0f7662 commit 243719e

File tree

110 files changed

+216
-1279
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+216
-1279
lines changed

.dockerignore

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

Dockerfile

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

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 ReacType
3+
Copyright (c) 2022 ReacType
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/team-reactype/ReacType/pulls)
77
![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)
8-
![Version 9.0.0]
8+
![Version 10.0.0]
99

1010
**ReacType** is a rapid prototyping tool for developers employing **React** component architecture alongside the comprehensive type-checking of **TypeScript**.
1111
In other words, **you can draw prototypes and export React / TypeScript code!**
@@ -16,7 +16,7 @@ Download for [MacOS](https://github.com/team-reactype/ReacType/releases), [Windo
1616

1717
- **Mac users**: After opening the dmg and dragging ReacType into your Applications folder, ctrl+click the icon and select 'Open' from the context menu to run the app. This extra step is necessary since we don't have an Apple developer license yet.
1818

19-
- **Windows users**: Install the application by running ReacType Setup 9.0.0.exe.
19+
- **Windows users**: Install the application by running ReacType Setup 10.0.0.exe.
2020

2121
- **Linux users**: Run the application as a super user in order to read and write files.
2222

__tests__/BottomTabs.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import BottomTabs from '../app/src/components/bottom/BottomTabs';
66
import StateContext from '../app/src/context/context';
77
import initialState from '../app/src/context/initialState';
88
import reducer from '../app/src/reducers/componentReducer';
9-
109
function Test() {
1110
const [state, dispatch] = useReducer(reducer, initialState);
1211
return (
@@ -15,7 +14,6 @@ function Test() {
1514
</StateContext.Provider>
1615
)
1716
}
18-
1917
test('Bottom Panel Contains Two Tabs: Code Preview and Component Tree', () => {
2018
render(<Test/>);
2119
expect(screen.getAllByRole('tab')).toHaveLength(2);

__tests__/HTMLPanel.test.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ import '@testing-library/jest-dom';
33
import { DndProvider } from 'react-dnd';
44
import { HTML5Backend } from 'react-dnd-html5-backend';
55
import { render, fireEvent, cleanup, screen } from '@testing-library/react';
6-
76
import StateContext from '../app/src/context/context';
87
import initialState from '../app/src/context/initialState';
98
import reducer from '../app/src/reducers/componentReducer';
109
import HTMLPanel from '../app/src/components/left/HTMLPanel';
11-
12-
1310
function Test() {
1411
const [state, dispatch] = useReducer(reducer, initialState);
1512
return (
@@ -20,8 +17,6 @@ function Test() {
2017
</DndProvider>
2118
)
2219
}
23-
24-
2520
test('Renders HTMLPanel component properly', () => {
2621
render(
2722
<Test/>
@@ -44,15 +39,12 @@ test('Adds new custom element', () => {
4439
render(
4540
<Test/>
4641
);
47-
4842
fireEvent.change(screen.getAllByRole('textbox')[0], {
4943
target: { value: 'Testing' }
5044
});
5145
fireEvent.change(screen.getAllByRole('textbox')[1], {
5246
target: { value: 'Testing' }
5347
});
54-
5548
fireEvent.click(screen.getByDisplayValue('Add Element'));
56-
5749
expect(screen.getByText('Testing')).toBeInTheDocument();
5850
});

__tests__/componentReducer.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,25 +218,19 @@ describe('Testing componentReducer functionality', () => {
218218
expect(state.components[focusIndex].future.length).toEqual(1);
219219
})
220220
});
221-
222-
223221
// TEST 'REDO'
224222
describe('REDO reducer', () => {
225223
it('should remove the last element from the future array and push it to the past array', () => {
226224
const focusIndex = state.canvasFocus.componentId - 1;
227-
228225
const actionRedo: Action = {
229226
type: 'REDO',
230227
payload: {},
231228
};
232229
state = reducer(state, actionRedo);
233-
234230
expect(state.components[focusIndex].future.length).toEqual(0);
235231
expect(state.components[focusIndex].past.length).toEqual(1);
236232
})
237233
});
238-
239-
240234
// TEST 'RESET STATE'
241235
describe('RESET STATE reducer', () => {
242236
it('should reset project to initial state', () => {

__tests__/gql.projects.test.js renamed to __tests__/gql.projects.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ const { Mongoose } = require('mongoose');
22
const request = require('supertest');
33
const http = require('http');
44
const app = require('../server/server.js');
5-
65
const mock = require('../mockData');
7-
86
// tests user signup and login routes
97
describe('GraphQL tests', () => {
108
let server;
@@ -14,17 +12,14 @@ describe('GraphQL tests', () => {
1412
const makeCopyUserIdTest = '604333d10004ad51c899e250';
1513
const makeCopyUsernameTest = 'test1';
1614
let makeCopyProjId = '';
17-
1815
beforeAll((done) => {
1916
server = http.createServer(app);
2017
server.listen(done);
2118
});
22-
2319
afterAll((done) => {
2420
Mongoose.disconnect();
2521
server.close(done);
2622
});
27-
2823
// GraphQL Query
2924
describe('Testing GraphQL query', () => {
3025
it('getAllProjects should return more than 1 project by default', () => request(server)
@@ -35,7 +30,6 @@ describe('GraphQL tests', () => {
3530
})
3631
.expect(200)
3732
.then(res => expect(res.body.data.getAllProjects.length).toBeGreaterThanOrEqual(1)));
38-
3933
it('getAllProjects should return projects that matches the provided userId', () => request(server)
4034
.post('/graphql')
4135
.set('Content-Type', 'application/json')
@@ -48,7 +42,6 @@ describe('GraphQL tests', () => {
4842
.expect(200)
4943
.then(res => expect(res.body.data.getAllProjects[0].userId).toBe('604d21b2b61a1c95f2dc9105')));
5044
});
51-
5245
// GraphQL Mutation
5346
describe('Testing GraphQL mutation', () => {
5447
// Add likes
@@ -64,7 +57,6 @@ describe('GraphQL tests', () => {
6457
})
6558
.expect(200)
6659
.then(res => expect(res.body.data.addLike.likes).toBe(testNum)));
67-
6860
// Publish project
6961
it('Should set the "published" on the project document to TRUE', () => request(server)
7062
.post('/graphql')
@@ -78,7 +70,6 @@ describe('GraphQL tests', () => {
7870
})
7971
.expect(200)
8072
.then(res => expect(res.body.data.publishProject.published).toBe(true)));
81-
8273
it('Should set the "published" on the project document to FALSE', () => request(server)
8374
.post('/graphql')
8475
.set('Content-Type', 'application/json')
@@ -91,7 +82,6 @@ describe('GraphQL tests', () => {
9182
})
9283
.expect(200)
9384
.then(res => expect(res.body.data.publishProject.published).toBe(false)));
94-
9585
// Make copy
9686
it('Should make a copy of an existing project and change the userId and userName', () => request(server)
9787
.post('/graphql')
File renamed without changes.
File renamed without changes.
File renamed without changes.

app/electron/main.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,10 @@ let menuBuilder;
4949
async function createWindow() {
5050
// install react dev tools if we are in development mode
5151
if (isDev) {
52-
// await installExtension([REACT_DEVELOPER_TOOLS])
53-
// .then(name => console.log(`Added Extension: ${name}`))
54-
// .catch(err => console.log('An error occurred: ', err));
5552
} else {
5653
// this will happen before creating the browser window. it returns a Boolean whether the protocol of scheme 'app://' was successfully registered and a file (index-prod.html) was sent as the response
5754
protocol.registerBufferProtocol(Protocol.scheme, Protocol.requestHandler);
5855
}
59-
6056
// Create the browser window.
6157
win = new BrowserWindow({
6258
// full screen
@@ -69,7 +65,6 @@ async function createWindow() {
6965
// the browser window will not display initially as it's loading
7066
// once the browser window renders, a function is called below that hides the splash screen and displays the browser window
7167
show: false,
72-
// icon: path.join(__dirname, '../src/public/icons/png/256x256.png'),
7368
webPreferences: {
7469
zoomFactor: 0.7,
7570
// enable devtools when in development mode
@@ -106,9 +101,6 @@ async function createWindow() {
106101
website: 'www.reactype.io',
107102
text: 'Initializing ...',
108103
});
109-
110-
111-
112104
// Load app
113105
if (isDev) {
114106
// load app from web-dev server

app/electron/menu.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ var MenuBuilder = function(mainWindow, appName) {
6464

6565
let defaultTemplate = function() {
6666
return [
67-
// { role: "appMenu" }
6867
...(isMac
6968
? [
7069
{

app/src/Dashboard/NavbarDash.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ const useStyles = makeStyles((theme: Theme) => createStyles({
4242
justifyContent: 'center',
4343
},
4444
}));
45-
4645
// sorting options
4746
const sortMethods = ['RATING', 'DATE', 'USER'];
48-
4947
// Drop down menu button for SORT PROJECTS
5048
const StyledMenu = withStyles({
5149
paper: {
@@ -66,7 +64,6 @@ const StyledMenu = withStyles({
6664
{...props}
6765
/>
6866
));
69-
7067
const StyledMenuItem = withStyles(theme => ({
7168
root: {
7269
'&:focus': {
@@ -76,30 +73,22 @@ const StyledMenuItem = withStyles(theme => ({
7673
}
7774
}
7875
}))(MenuItem);
79-
8076
// TO DO: set types of props validation
8177
export default function NavBar(props) {
8278
// TO DO: import setStyle
8379
const classes = useStyles();
8480
const { style, setStyle } = useContext(styleContext);
85-
8681
const toggling = () => setIsOpen(!isOpen);
87-
8882
// toggle to open and close dropdown sorting menu
8983
const [isOpen, setIsOpen] = useState(false);
90-
9184
// State for sort projects button
9285
const [anchorEl, setAnchorEl] = React.useState(null);
93-
94-
9586
const handleClick = event => {
9687
setAnchorEl(event.currentTarget);
9788
};
98-
9989
const handleClose = () => {
10090
setAnchorEl(null);
10191
};
102-
10392
return (
10493
<div className={classes.root} style={style}>
10594
<AppBar position='static'>
@@ -108,10 +97,7 @@ export default function NavBar(props) {
10897
<Typography variant="h6" style={{ marginLeft: '1rem' }} className={classes.title}>
10998
ReacType
11099
</Typography>
111-
112-
{/* ==========================================Sort by Button================================================== */}
113-
114-
<div style ={ { textDecoration: 'none' } }>
100+
<div style ={ { textDecoration: 'none' } }>
115101
<Button
116102
variant='contained'
117103
color='primary'
@@ -166,9 +152,7 @@ export default function NavBar(props) {
166152
}}
167153
>
168154
{props.isThemeLight ? 'Dark Mode' : 'Light Mode'}
169-
</Button>
170-
{/* ====================================Home Button============================================== */}
171-
155+
</Button>
172156
<div>
173157
<Link to='/' style={{textDecoration: 'none'}}>
174158
<Button

0 commit comments

Comments
 (0)