Skip to content

Commit dca886d

Browse files
authored
Merge pull request #20 from oslabs-beta/dev
Merging Dev into Main
2 parents b27068f + 4a36db5 commit dca886d

File tree

86 files changed

+5744
-5747
lines changed

Some content is hidden

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

86 files changed

+5744
-5747
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ server/RootCA.srl
498498

499499

500500
# End of https://www.gitignore.io/api/node,linux,macos,windows,visualstudio,yarn
501+
501502
/test-results/
502503
/playwright-report/
503504
/playwright/.cache/

.travis.yml

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

__tests__/playwright/example.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { test, expect } from '@playwright/test';
1+
// import { test, expect } from '@playwright/test';
22

3-
test('has title', async ({ page }) => {
4-
await page.goto('https://app.reactype.dev/#/');
3+
// test('has title', async ({ page }) => {
4+
// await page.goto('https://app.reactype.dev/#/');
55

6-
// Expect a title "to contain" a substring.
7-
await expect(page).toHaveTitle('ReacType');
8-
});
6+
// // Expect a title "to contain" a substring.
7+
// await expect(page).toHaveTitle('ReacType');
8+
// });
99

10-
test('get started link', async ({ page }) => {
11-
await page.goto('https://playwright.dev/');
10+
// test('get started link', async ({ page }) => {
11+
// await page.goto('https://playwright.dev/');
1212

13-
// Click the get started link.
14-
await page.getByRole('link', { name: 'Get started' }).click();
13+
// // Click the get started link.
14+
// await page.getByRole('link', { name: 'Get started' }).click();
1515

16-
// Expects the URL to contain intro.
17-
await expect(page).toHaveURL(/.*intro/);
18-
});
16+
// // Expects the URL to contain intro.
17+
// await expect(page).toHaveURL(/.*intro/);
18+
// });

__tests__/projects.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
const { Mongoose } = require('mongoose');
66
const request = require('supertest');
77
// initializes the project to be sent to server/DB
8-
import mockData from '../mockData'
9-
import app from ('../server/server');
10-
const http = require('http')
11-
const {state, projectToSave } = mockData
8+
import mockData from '../mockData';
9+
import app from '../server/server';
10+
const http = require('http');
11+
const { state, projectToSave } = mockData;
1212

1313
// save and get projects endpoint testing
1414
describe('Project endpoints tests', () => {

app/src/Dashboard/ProjectContainer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { theme1, theme2 } from '../public/styles/theme';
1313

1414

1515
declare module '@mui/styles/defaultTheme' {
16-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
1716
interface DefaultTheme extends Theme {}
1817
}
1918

app/src/components/App.tsx

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
setInitialState,
66
toggleLoggedIn
77
} from '../redux/reducers/slice/appStateSlice';
8-
//redux toolkit addition
98
import { useDispatch, useSelector } from 'react-redux';
109

1110
import AppContainer from '../containers/AppContainer';
@@ -17,34 +16,34 @@ import localforage from 'localforage';
1716
import { saveProject } from '../helperFunctions/projectGetSaveDel';
1817

1918
// Intermediary component to wrap main App component with higher order provider components
20-
export const App = (): JSX.Element => {
21-
const state = useSelector((store: RootState) => store.appState);
22-
23-
const [toggleAttempt, setToggleAttempt] = useState(false);
19+
export const App: React.FC = (): JSX.Element => {
20+
// const state = useSelector((store: RootState) => store.appState);
21+
2422
const dispatch = useDispatch();
2523
// checks if user is signed in as guest or actual user and changes loggedIn boolean accordingly
2624
useEffect(() => {
2725
if (window.localStorage.getItem('ssid') !== 'guest') {
2826
dispatch(toggleLoggedIn(true));
2927
}
30-
//setToggleAttempt(!toggleAttempt);
3128
}, []);
3229

33-
// following useEffect runs on first mount
30+
// FOR LOCAL FORAGE: still trying to get this to work
31+
32+
// // following useEffect runs on first mount
3433
// useEffect(() => {
35-
// // console.log('cookies.get in App', Cookies.get())
34+
// console.log('cookies.get in App', Cookies.get());
3635
// // if user is a guest, see if a project exists in localforage and retrieve it
37-
// // v17 May not currently work yet
36+
// // v17: May not currently work yet
3837
// if (!state.isLoggedIn) {
3938
// localforage.getItem('guestProject').then((project) => {
4039
// // if project exists, use dispatch to set initial state to that project
40+
// console.log('local forage get project', project);
4141
// if (project) {
4242
// dispatch(setInitialState(project));
4343
// }
4444
// });
4545
// } else {
4646
// // otherwise if a user is logged in, use a fetch request to load user's projects from DB
47-
4847
// let userId;
4948
// if (Cookies.get('ssid')) {
5049
// userId = Cookies.get('ssid');
@@ -63,24 +62,26 @@ export const App = (): JSX.Element => {
6362
// });
6463
// }
6564
// }, []);
65+
66+
// // New project save configuration to optimize server load and minimize Ajax requests
6667
// useEffect(() => {
6768
// // provide config properties to legacy projects so new edits can be auto saved
68-
// // if (state.config === undefined) {
69-
// // state.config = { saveFlag: true, saveTimer: false };
70-
// // }
71-
// // New project save configuration to optimize server load and minimize Ajax requests
69+
// if (state.config === undefined) {
70+
// state.config = { saveFlag: true, saveTimer: false };
71+
// }
72+
7273
// if (state.config.saveFlag) {
73-
// // state.config.saveFlag = false;
74-
// // state.config.saveTimer = true;
75-
// // dispatch(configToggle())
74+
// state.config.saveFlag = false;
75+
// state.config.saveTimer = true;
76+
// //dispatch(configToggle());
7677

7778
// let userId;
7879
// if (Cookies.get('ssid')) {
7980
// userId = Cookies.get('ssid');
8081
// } else {
8182
// userId = window.localStorage.getItem('ssid');
8283
// }
83-
// // if (state.isLoggedIn === false) {
84+
8485
// if (!state.isLoggedIn) {
8586
// localforage.setItem('guestProject', state);
8687
// } else if (state.name !== '') {
@@ -95,19 +96,16 @@ export const App = (): JSX.Element => {
9596
// }, 15000);
9697
// }
9798
// }, [state]);
98-
// uncomment below to log state
9999

100100
return (
101101
<div className="app">
102-
103-
<header
104-
style={{ height: '40px', width: '100%', backgroundColor: 'white' }}
105-
>
106-
ReacType
107-
</header>
102+
<header
103+
style={{ height: '40px', width: '100%', backgroundColor: 'white' }}
104+
>
105+
ReacType
106+
</header>
108107

109-
<AppContainer />
110-
108+
<AppContainer />
111109
</div>
112110
);
113111
};

app/src/components/ContextAPIManager/AssignTab/components/ComponentDropDrown.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ const ComponentDropDown = ({
1212
componentInput,
1313
setComponentInput
1414
}) => {
15-
const { state, isDarkMode } = useSelector((store: RootState) => ({
16-
state: store.appState,
17-
isDarkMode: store.darkMode.isDarkMode
15+
const { state } = useSelector((store: RootState) => ({
16+
state: store.appState
1817
}));
19-
const color = isDarkMode ? 'white' : 'black';
18+
2019
const onChange = (event, newValue) => {
2120
if (typeof newValue === 'string') {
2221
setComponentInput({
@@ -36,7 +35,6 @@ const ComponentDropDown = ({
3635
};
3736

3837
const filterOptions = (options, params) => {
39-
// setBtnDisabled(true);
4038
const filtered = filter(options, params);
4139
const { inputValue } = params;
4240
// Suggest the creation of a new contextInput
@@ -46,8 +44,6 @@ const ComponentDropDown = ({
4644
inputValue,
4745
name: `Add "${inputValue}"`
4846
});
49-
50-
// setBtnDisabled(false);
5147
}
5248

5349
return filtered;
@@ -67,7 +63,7 @@ const ComponentDropDown = ({
6763
};
6864

6965
const renderOption = (props, option) => (
70-
<li style={{ color: 'black', backgroundColor: 'none'}} {...props}>
66+
<li style={{ color: 'black', backgroundColor: 'none' }} {...props}>
7167
{option.name}
7268
</li>
7369
);

app/src/components/ContextAPIManager/AssignTab/components/ContextDropDown.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import React, { Fragment, useState, useEffect } from 'react';
22
import TextField from '@mui/material/TextField';
33
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
44
import Box from '@mui/material/Box';
5-
import { useSelector } from 'react-redux';
6-
import { RootState } from '../../../../redux/store';
5+
76

87
const filter = createFilterOptions();
98

@@ -15,10 +14,6 @@ const ContextDropDown = ({
1514
}) => {
1615
const { allContext } = contextStore;
1716

18-
const isDarkMode = useSelector(
19-
(store: RootState) => store.darkMode.isDarkMode
20-
);
21-
const color = isDarkMode ? 'white' : 'black';
2217
const onChange = (event, newValue) => {
2318
if (typeof newValue === 'string') {
2419
setContextInput({
@@ -38,7 +33,6 @@ const ContextDropDown = ({
3833
};
3934

4035
const filterOptions = (options, params) => {
41-
// setBtnDisabled(true);
4236
const filtered = filter(options, params);
4337
const { inputValue } = params;
4438
// Suggest the creation of a new contextInput
@@ -48,8 +42,6 @@ const ContextDropDown = ({
4842
inputValue,
4943
name: `Add "${inputValue}"`
5044
});
51-
52-
// setBtnDisabled(false);
5345
}
5446

5547
return filtered;

app/src/components/ContextAPIManager/AssignTab/components/ContextTable.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ const rows = [
4545
createData('Cupcake', 305, 3.7, 67, 4.3),
4646
createData('Gingerbread', 356, 16.0, 49, 3.9)
4747
];
48-
{
49-
/* <Table style={{ width: 400, margin: 'auto' }}></Table> */
50-
}
48+
5149
export default function ContextTable() {
5250
return (
5351
<TableContainer component={Paper}>

app/src/components/ContextAPIManager/ContextManager.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useContext } from 'react';
1+
import React, { useContext } from 'react';
22
import { makeStyles } from '@mui/styles';
33
import Box from '@mui/material/Box';
44
import Tab from '@mui/material/Tab';
@@ -9,39 +9,40 @@ import TabPanel from '@mui/lab/TabPanel';
99
import CreateContainer from './CreateTab/CreateContainer';
1010
import AssignContainer from './AssignTab/AssignContainer';
1111
import DisplayContainer from './DisplayTab/DisplayContainer';
12-
import { useSelector } from 'react-redux'
12+
import { useSelector } from 'react-redux';
1313
import { RootState } from '../../redux/store';
1414

15-
1615
const useStyles = makeStyles({
1716
contextContainer: {
1817
backgroundColor: '#191919',
19-
height: 'fit-content',
18+
height: 'fit-content'
2019
}
2120
});
2221

2322
const ContextManager = (props): JSX.Element => {
24-
const { isDarkMode, style } = useSelector((store:RootState) => ({
25-
isDarkMode: store.darkMode.isDarkMode,
23+
const { style } = useSelector((store: RootState) => ({
2624
style: store.styleSlice
2725
}));
2826
const classes = useStyles();
2927
const [value, setValue] = React.useState<string>('1');
30-
28+
3129
const handleChange = (event: React.SyntheticEvent, newValue: string) => {
3230
setValue(newValue);
3331
};
3432

35-
const background_Color = isDarkMode ? '#21262b' : 'white'
36-
const color = isDarkMode ? 'white' : 'white'
33+
const color = 'white';
3734

3835
return (
3936
<React.Fragment>
4037
<div className={classes.contextContainer} style={style.style}>
4138
<Box sx={{ width: '100%', typography: 'body1' }}>
4239
<TabContext value={value}>
4340
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
44-
<TabList onChange={handleChange} centered={true} sx={{color:color}}>
41+
<TabList
42+
onChange={handleChange}
43+
centered={true}
44+
sx={{ color: color }}
45+
>
4546
<Tab style={{ color: color }} label="Create/Edit" value="1" />
4647
<Tab style={{ color: color }} label="Assign" value="2" />
4748
<Tab style={{ color: color }} label="Display" value="3" />
@@ -63,4 +64,4 @@ const ContextManager = (props): JSX.Element => {
6364
);
6465
};
6566

66-
export default ContextManager;
67+
export default ContextManager;

app/src/components/ContextAPIManager/CreateTab/components/AddContextForm.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ const AddContextForm = ({
2525
const { allContext } = contextStore;
2626
const [btnDisabled, setBtnDisabled] = useState(false);
2727
const [open, setOpen] = useState(false);
28-
const { state, isDarkMode } = useSelector((store: RootState) => ({
29-
isDarkMode: store.darkMode.isDarkMode,
30-
state: store.appState
31-
}));
32-
const color = isDarkMode ? 'black' : 'white';
28+
// const { state } = useSelector((store: RootState) => ({
29+
// state: store.appState
30+
// }));
31+
32+
const color = 'white';
3333

3434
//handler for submitting new context for creation
3535
const handleSubmit = () => {
@@ -67,7 +67,7 @@ const AddContextForm = ({
6767
const contexts = allContext.length ? (
6868
allContext.map((context, index) => {
6969
return (
70-
<MenuItem style={{ color: '#383838'}} value={context.name} key={index}>
70+
<MenuItem style={{ color: '#383838' }} value={context.name} key={index}>
7171
{context.name}
7272
</MenuItem>
7373
);
@@ -99,7 +99,7 @@ const AddContextForm = ({
9999
/>
100100
<Snackbar
101101
open={open && !errorStatus}
102-
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
102+
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
103103
autoHideDuration={3000}
104104
onClose={handleClose}
105105
>
@@ -129,7 +129,7 @@ const AddContextForm = ({
129129
<Select
130130
required
131131
sx={{ width: 425 }}
132-
style={{ border: '1px solid #0099e6', color: color}}
132+
style={{ border: '1px solid #0099e6', color: color }}
133133
value={currentContext}
134134
label="Select Context"
135135
MenuProps={{ disablePortal: true }}

0 commit comments

Comments
 (0)