Skip to content

Commit ca27ae5

Browse files
author
Rachel Kucharski
committed
all files converted to typescript
2 parents 6648e11 + 29c124a commit ca27ae5

File tree

14 files changed

+105
-71
lines changed

14 files changed

+105
-71
lines changed

app/src/components/main/DemoRender.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ const DemoRender = (): JSX.Element => {
2828
const html = `
2929
<html>
3030
<head>
31+
<link
32+
rel="stylesheet"
33+
href="./fake.css"
34+
/>
3135
</head>
3236
<body>
3337
<div id="app">

app/src/components/main/fake.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.test {
2+
color: red !important
3+
}
4+
.MuiBox-root {
5+
color: red
6+
}
7+
css-0 {
8+
color: red
9+
}
10+
11+
#rend1 {
12+
color: red !important
13+
}

app/src/components/right/ExportButton.tsx

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ export default function ExportButton() {
1515
const state = useSelector((store: RootState) => store.appState);
1616

1717
const genOptions: string[] = [
18-
'Export components',
19-
'Export components with application files'
18+
'Export components'
2019
];
21-
let genOption = 0;
2220

2321
// Closes out the open modal
2422
const closeModal = () => setModal('');
@@ -29,7 +27,7 @@ export default function ExportButton() {
2927
{genOptions.map((option: string, i: number) => (
3028
<ListItem
3129
key={i}
32-
onClick={() => chooseGenOptions(i)}
30+
onClick={() => chooseGenOptions()}
3331
style={{
3432
border: '1px solid #3f51b5',
3533
marginBottom: '2%',
@@ -39,32 +37,19 @@ export default function ExportButton() {
3937
<ListItemText primary={option} style={{ textAlign: 'center' }} />
4038
</ListItem>
4139
))}
42-
<ListItem>
43-
<input type="checkbox" id="tests" name="tests"></input>
44-
<label for="tests">Include Tests</label>
45-
</ListItem>
4640
</List>
4741
);
48-
let testchecked = 0;
49-
// helper function called by showGenerateAppModal
50-
// this function will prompt the user to choose an app directory once they've chosen their export option
51-
const chooseGenOptions = (genOpt: number) => {
52-
// set export option: 0 --> export only components, 1 --> export full project
53-
genOption = genOpt;
54-
55-
//This is exclusive to the electron app
56-
// window.api.chooseAppDir();
57-
// testchecked = document.getElementById('tests').checked;
42+
43+
const chooseGenOptions = () => {
5844
zipFiles(state);
59-
6045
closeModal();
6146
};
6247

6348
setModal(
6449
createModal({
6550
closeModal,
6651
children,
67-
message: 'Choose export preference:',
52+
message: 'Click to download in zip file:',
6853
primBtnLabel: null,
6954
primBtnAction: null,
7055
secBtnAction: null,
@@ -100,17 +85,10 @@ export default function ExportButton() {
10085
);
10186
}
10287

103-
//The below code is exclusive to the Electron App's export function
104-
105-
// import React, { useState, useCallback, useEffect } from 'react';
106-
// import List from '@mui/material/List';
107-
// import ListItem from '@mui/material/ListItem';
108-
// import ListItemText from '@mui/material/ListItemText';
109-
// import GetAppIcon from '@mui/icons-material/GetApp';
110-
// import Button from '@mui/material/Button';
111-
// import exportProject from '../../utils/exportProject.util';
112-
// import createModal from './createModal';
113-
// import { useSelector } from 'react-redux';
88+
//The below code is exclusive to ReacType's Electron App
89+
//If you would like to deploy the app, please comment out the exportButton function above and uncomment the code below
90+
91+
11492
// export default function ExportButton() {
11593
// const [modal, setModal] = useState(null);
11694
// const state = useSelector(store => store.appState)

app/src/index.js renamed to app/src/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ import {
77
} from 'react-router-dom';
88
import 'babel-polyfill';
99
import React from 'react';
10-
import store from './redux/store.ts';
10+
import store from './redux/store';
1111
import { Provider } from 'react-redux';
1212
import ReactDOM from 'react-dom';
1313
import Cookies from 'js-cookie';
14-
import App from './components/App.tsx';
15-
import SignIn from './components/login/SignIn.tsx';
16-
import SignUp from './components/login/SignUp.tsx';
17-
import FBPassWord from './components/login/FBPassWord.tsx';
18-
import Tutorial from './tutorial/Tutorial.tsx';
19-
import TutorialPage from './tutorial/TutorialPage.tsx';
20-
import ProjectDashboard from './Dashboard/ProjectContainer.tsx';
14+
import App from './components/App';
15+
import SignIn from './components/login/SignIn';
16+
import SignUp from './components/login/SignUp';
17+
import FBPassWord from './components/login/FBPassWord';
18+
import Tutorial from './tutorial/Tutorial';
19+
import TutorialPage from './tutorial/TutorialPage';
20+
import ProjectDashboard from './Dashboard/ProjectContainer';
2121

2222
const client = new ApolloClient({
2323
uri: 'https://reactype-caret.herokuapp.com/graphql',

app/src/interfaces/Interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface ChildElement {
3434
export interface Component {
3535
id: number;
3636
name: string;
37-
style: {backgroundColor: string};
37+
style: {};
3838
attributes?: object;
3939
events: object;
4040
code: string;

app/src/reducers.js

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

app/src/redux/reducers/rootReducer.js renamed to app/src/redux/reducers/rootReducer.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { combineReducers } from '@reduxjs/toolkit';
22

33
// Need to import each slice which will be combined in the rootReducer
4-
import darkModeReducer from './slice/darkModeSlice.ts';
5-
import codePreviewReducer from './slice/codePreviewSlice.ts';
6-
import contextReducer from './slice/contextReducer.ts';
7-
import appStateReducer from './slice/appStateSlice.ts';
8-
import styleReducer from './slice/styleSlice.ts';
9-
import roomCodeReducer from './slice/roomCodeSlice.ts';
4+
import darkModeReducer from './slice/darkModeSlice';
5+
import codePreviewReducer from './slice/codePreviewSlice';
6+
import contextReducer from './slice/contextReducer';
7+
import appStateReducer from './slice/appStateSlice';
8+
import styleReducer from './slice/styleSlice';
9+
import roomCodeReducer from './slice/roomCodeSlice';
1010

1111
const rootReducer = combineReducers({
1212
// Add desired slices here
File renamed without changes.
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
const { v4: uuidv4 } = require('uuid');
2+
// const Buffer = require('buffer');
3+
4+
5+
// const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
6+
// module.exports = buf;
27

38
// Generate an arbitrary number
49
// this arbitrary number will be used in CspHtmlWebpackPlugin and HtmlWebpackPlugin configuration in webpack
5-
module.exports = function() {
10+
module.exports = function () {
611
return new Buffer.from(uuidv4()).toString('base64');
712
};

package-lock.json

Lines changed: 54 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
"babel-polyfill": "^6.26.0",
148148
"bcryptjs": "^2.4.3",
149149
"body-parser": "^1.20.2",
150+
"buffer": "^6.0.3",
150151
"cookie-parser": "^1.4.6",
151152
"cors": "^2.8.5",
152153
"d3": "^7.6.1",

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
// since JS can be written for both server / browser, the "target" specifies what environment webpack should write for
1616
target: 'web', // Our app can run without electron
1717
// The entry is where webpack begins assembling the dependency tree
18-
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
18+
entry: ['./app/src/index.tsx'], // 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
1919
// the output is only created on npm run-prod-build
2020
output: {
2121
path: path.resolve(__dirname, 'app/dist'), // Where all the output files get dropped after webpack is done with them

webpack.development.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
33
const merge = require('webpack-merge');
44
const base = require('./webpack.config');
55
const path = require('path');
6-
const nonce = require('./app/src/utils/createNonce')();
6+
const nonce = require('./app/src/utils/createNonce.ts')();
77
const { DEV_PORT } = require('./config');
88

99
// merges webpack.config.js with development specific configs

webpack.production.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
33
const merge = require('webpack-merge');
44
const base = require('./webpack.config');
55
const path = require('path');
6-
const nonce = require('./app/src/utils/createNonce')();
6+
const nonce = require('./app/src/utils/createNonce.ts')();
77

88
// merges webpack.config.js with production specific configs
99
module.exports = merge(base, {

0 commit comments

Comments
 (0)