Skip to content

Commit

Permalink
Merge pull request #363 from BIDMCDigitalPsychiatry/issue-798
Browse files Browse the repository at this point in the history
dependency fixes
  • Loading branch information
sarithapillai8 authored Feb 20, 2024
2 parents 23c55a4 + fad6944 commit b8d87fe
Show file tree
Hide file tree
Showing 12 changed files with 211 additions and 147 deletions.
12 changes: 12 additions & 0 deletions CatsnDogs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion CatsnDogs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@
"not dead",
"not ie <= 11",
"not op_mini all"
]
],
"devDependencies": {
"@types/react-dom": "^18.2.19"
}
}
54 changes: 5 additions & 49 deletions CatsnDogs/src/components/catsndogs/CatsNDogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,21 @@ import Board from "./Board";

import i18n from "./../../i18n";

import { isUndefined } from "util";

interface AppState {
loaded: boolean;
time: number;
noBack: false;
}

class CatsNDogs extends React.Component<{}, AppState> {
constructor(props: {}) {
class CatsNDogs extends React.Component<any, AppState> {
constructor(props: any) {
super(props);
// const eventMethod = window.addEventListener
// ? "addEventListener"
// : "attachEvent";
// const eventer = window[eventMethod];
// const messageEvent =
// eventMethod === "attachEvent" ? "onmessage" : "message";
let eventMethod;
let eventer;
let messageEvent;

if (typeof window.addEventListener === 'function') {
eventMethod = "addEventListener";
eventer = window[eventMethod];
messageEvent = "message";
} else {
eventMethod = "attachEvent";
eventer = window[eventMethod];
messageEvent = "onmessage";
}
eventer(
messageEvent,
(e: any) => {
const configuration = e.data.configuration;
const configuration = props.data.configuration;
i18n.changeLanguage(!!configuration ? configuration.language : "en-US");
console.log(e.data)
this.setState({ loaded: false, noBack: e.data.noBack, time: new Date().getTime() }, () => {
this.reset(true);
});
},
false
);
this.state = { loaded: true, noBack: props.data.noBack, time: new Date().getTime() };

}

// Reset game board
reset = (loadedVal: boolean) => {
const state = {
loaded: loadedVal,
noBack: this.state.noBack,
time: this.state.time
};

if (isUndefined(this.state)) {
this.state = state;
} else {
this.setState(state);
}
};


// Game render function
render() {
Expand Down
2 changes: 2 additions & 0 deletions CatsnDogs/src/components/catsndogs/box.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ nav a{color: rgba(53,159,254,1); padding: 10px; display: inline-block;}
.home-link{
position: absolute;
right: 0;
margin: 15px;
}

.back-link{
position: absolute;
left: 0;
margin: 15px;
}
.App-header {
height:90px;
Expand Down
25 changes: 18 additions & 7 deletions CatsnDogs/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@ require("react-hot-loader/patch")
import 'bootstrap/dist/css/bootstrap.min.css';

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { AppContainer } from "react-hot-loader";
import CatsNDogs from './components/catsndogs/CatsNDogs';
import './index.css';
import { createRoot } from "react-dom/client";

ReactDOM.render(
<AppContainer>
<CatsNDogs/>
</AppContainer>,
document.getElementById('root') as HTMLElement
);

const eventMethod = "addEventListener"
const eventer = window[eventMethod]
const messageEvent = "message"
eventer(
messageEvent, (e: any) => {
const rootElement = document.getElementById("root") as HTMLElement;

if(!!rootElement) {
const root = createRoot(rootElement);
root.render(<AppContainer>
<CatsNDogs data={e.data}/>
</AppContainer>);
}
},
false
)
2 changes: 1 addition & 1 deletion Emotion_Recognition/src/components/Emotions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const Emotions = ({...props} : any) => {
setEmotions(newArray)
}
useEffect(()=>{
setImage(props.data.image)
setImage(props.data?.image)
setNum(props.level)
initialize(props.data)
},[props.data, props.level])
Expand Down
7 changes: 3 additions & 4 deletions Emotion_Recognition/src/containers/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ const Layout = ({...props} : any) =>{

useEffect(() => {
const configuration = props.data.configuration;
const data = props.data.activity?.settings ? props.data.activity?.settings : null ;
shuffleArray(data)
let data = props.data.activity?.settings ? props.data.activity?.settings : null ;
data = shuffleArray(data ?? [])
i18n.changeLanguage(!!configuration ? configuration.language : "en-US");
const newArray = data?.map ((em: any)=>{

const newArray = data?.map ((em: any) => {
return {
...em,
"selected" : ""
Expand Down
12 changes: 12 additions & 0 deletions JewelsPro/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion JewelsPro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@
"not dead",
"not ie <= 11",
"not op_mini all"
]
],
"devDependencies": {
"@types/react-dom": "^18.2.19"
}
}
Loading

0 comments on commit b8d87fe

Please sign in to comment.