Skip to content

Commit 34b180a

Browse files
committed
Merge branch 'ahsan-ben-branch' of https://github.com/oslabs-beta/ReacType into ahsan-ben-branch
2 parents 138fa34 + 8600eeb commit 34b180a

File tree

7 files changed

+34
-15
lines changed

7 files changed

+34
-15
lines changed

app/electron/main.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async function createWindow() {
6666
// enable devtools when in development mode
6767
devTools: true,
6868
// crucial security feature - blocks rendering process from having access to node modules
69-
nodeIntegration: false,
69+
nodeIntegration: true,
7070
// web workers will not have access to node
7171
nodeIntegrationInWorker: false,
7272
// disallow experimental feature to allow node.js support in sub-frames (i-frames/child windows)
@@ -76,10 +76,10 @@ async function createWindow() {
7676
// Electron API only available from preload, not loaded page
7777
contextIsolation: true,
7878
// disables remote module. critical for ensuring that rendering process doesn't have access to node functionality
79-
enableRemoteModule: false,
79+
enableRemoteModule: true,
8080
// path of preload script. preload is how the renderer page will have access to electron functionality
8181
preload: path.join(__dirname, 'preload.js'),
82-
nativeWindowOpen: true
82+
nativeWindowOpen: true,
8383
}
8484
});
8585

@@ -391,11 +391,11 @@ ipcMain.on('github', event => {
391391
height: 600,
392392
title: 'Github Oauth',
393393
webPreferences: {
394-
nodeIntegration: false,
394+
nodeIntegration: true,
395395
nodeIntegrationInWorker: false,
396396
nodeIntegrationInSubFrames: false,
397397
contextIsolation: true,
398-
enableRemoteModule: false,
398+
enableRemoteModule: true,
399399
zoomFactor: 1.0
400400
}
401401
});
@@ -470,11 +470,11 @@ ipcMain.on('tutorial', event => {
470470
minWidth: 661,
471471
title: 'Tutorial',
472472
webPreferences: {
473-
nodeIntegration: false,
473+
nodeIntegration: true,
474474
nodeIntegrationInWorker: false,
475475
nodeIntegrationInSubFrames: false,
476476
contextIsolation: true,
477-
enableRemoteModule: false,
477+
enableRemoteModule: true,
478478
zoomFactor: 1.0
479479
}
480480
});

app/electron/menu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ var MenuBuilder = function(mainWindow, appName) {
3939
minWidth: 665,
4040
title: 'Tutorial',
4141
webPreferences: {
42-
nodeIntegration: false,
42+
nodeIntegration: true,
4343
nodeIntegrationInWorker: false,
4444
nodeIntegrationInSubFrames: false,
4545
contextIsolation: true,
46-
enableRemoteModule: false,
46+
enableRemoteModule: true,
4747
zoomFactor: 1.0,
4848
devTools: false
4949
}

app/src/components/StateManagement/CreateTab/components/TableParentProps.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const TableParentProps = props => {
5757
<Button
5858
style={{ width: `${3}px`, color: 'black'}}
5959
onClick={() => {
60-
addParentProps(params.row, params.id - 1);
60+
addPassedInProps(params.row, params.id - 1);
6161
}}
6262
>
6363
<AddIcon style={{ width: `${15}px` }} />
@@ -67,7 +67,7 @@ const TableParentProps = props => {
6767
}
6868
}
6969
];
70-
const addParentProps = (parentComponentProps, rowId) => {
70+
const addPassedInProps = (parentComponentProps, rowId) => {
7171
// get the current focused component
7272
// remove the state that the button is clicked
7373
// send a dispatch to rerender the table

app/src/components/StateManagement/CreateTab/components/TableStateProps.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const TableStateProps = props => {
5454
<Button
5555
style={{ width: `${3}px`, color: 'black'}}
5656
onClick={() => {
57-
deleteState(params.id, params.row.key);
57+
deleteState(params.id, params.key);
5858
}}
5959
>
6060
<ClearIcon style={{ width: `${15}px` }} />
@@ -73,7 +73,7 @@ const TableStateProps = props => {
7373
);
7474
dispatch({
7575
type: 'DELETE STATE',
76-
payload: { stateProps: filtered, rowId: selectedId}
76+
payload: { stateProps: filtered, rowId: selectedId }
7777
});
7878
};
7979

app/src/components/right/LoginButton.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ export default function LoginButton() {
2121
// };
2222

2323
const handleLogout = () => {
24-
document.cookie = "SSID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"
24+
// document.cookie = "ssid=; expires=Thu, 01 Jan 1970 00:00:00 UTC;"
25+
// console.log(document.cookie)
26+
//localStorage.clear();
27+
window.localStorage.clear();
28+
//window.api.delCookie();
2529
//const navigate = useNavigate();
2630
//navigate('/');
2731
window.location.href = 'http://localhost:8080/#/login';
32+
window.api.delCookie();
2833
// window.location.reload();
2934
}
3035
if (state.isLoggedIn) {

app/src/reducers/componentReducer.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,20 @@ const reducer = (state: State, action: Action) => {
818818
);
819819
currComponent.stateProps = action.payload.stateProps;
820820
currComponent.useStateCodes = updateUseStateCodes(currComponent);
821+
821822
components.forEach((component) => {
823+
824+
825+
//find all instances of state within child elements and delete state
826+
827+
828+
if (component.name !== 'App') {
829+
component.passedInProps.forEach((prop, i) => {
830+
if(prop.id === action.payload.rowId) {
831+
component.passedInProps.splice(i,1);
832+
}
833+
});
834+
}
822835
// curr component = where you are deleting from state from, also is the canvas focus
823836
// curr component id = providerId
824837
// we then iterate through the rest of the components

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"scripts": {
5959
"postinstall": "set ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true electron-builder install-app-deps",
6060
"dev-server": "cross-env NODE_ENV=development webpack-dev-server --config ./webpack.development.js",
61-
"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",
61+
"dev": "concurrently -k \"cross-env NODE_ENV=development webpack-dev-server --config ./webpack.development.js\" \"cross-env NODE_ENV=development nodemon server/server.js --open\"",
62+
"electron-dev": "cross-env NODE_ENV=development electron .",
6263
"prod-build": "cross-env NODE_ENV=production npx webpack --mode=production --config ./webpack.production.js",
6364
"prod": "npm run prod-build && electron . --no-sandbox",
6465
"pack": "electron-builder --dir",

0 commit comments

Comments
 (0)