Skip to content

Commit

Permalink
Merge pull request #414 from BIDMCDigitalPsychiatry/funny-memory
Browse files Browse the repository at this point in the history
Game fixes
  • Loading branch information
sarithapillai8 authored Nov 6, 2024
2 parents ed695af + 0d806f9 commit 3623b26
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
8 changes: 7 additions & 1 deletion FunnyMemory/src/components/AudioRecorder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@ const AudioRecorder = ({ ...props }) => {
};

useEffect(() => {
console.log("transcript", transcript);
console.log("transcript", transcript)
if (transcript && transcript != "") {
setRecordedText(transcript);
}
}, [transcript]);

useEffect(()=>{
setTimeout(()=>{
stopHandle();
},180000)
},[])

const handleListing = () => {
setIsListening(true);
SpeechRecognition.startListening({
Expand Down
20 changes: 18 additions & 2 deletions FunnyMemory/src/components/GameBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,23 @@ const GameBoard = ({ ...props }: any) => {
setShowImage(true);
};

const sendGameResult = () => {
console.log("routes", routes);

const sendGameResult = () => {
console.log("result", JSON.stringify({
duration: new Date().getTime() - startTime,
static_data: Object.assign(staticdata ?? {}, {
image_exposure_time: imageExposureTime,
learning_trials: numberOfTrials,
delay_time: delayBeforeRecall,
number_of_correct_pairs_recalled: pairsIdentified,
number_of_correct_items_recalled: itemsIdentified,
number_of_correct_recognized: itemRecognized,
number_of_correct_force_choice: correctChoice,
}),
temporal_slices: JSON.parse(JSON.stringify(routes)),
timestamp: new Date().getTime(),
}))
parent.postMessage(
JSON.stringify({
duration: new Date().getTime() - startTime,
Expand Down Expand Up @@ -388,7 +404,7 @@ const GameBoard = ({ ...props }: any) => {
return (
<>
<div className="game_board">
<div className="timer-div">{getPhaseTitle()}</div>
{getPhaseTitle() != "" && <div className="timer-div">{getPhaseTitle()}</div>}
{renderContent()}
</div>
<Backdrop className="backdrop" open={loading}>
Expand Down
2 changes: 1 addition & 1 deletion FunnyMemory/src/containers/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ input[type=checkbox] {
text-align: left;
width: 100%;
max-width: 650px;
margin: 0 auto ;
margin: 0 auto 30px ;
}
.marginTop10{
margin-top: 12px;
Expand Down
29 changes: 22 additions & 7 deletions Survey/src/components/SurveyQuestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import emoji from "remark-emoji"
import gfm from "remark-gfm"
import { useSnackbar } from "notistack"
import ConfirmationDialog from "./ConfirmationDialog"
import zIndex from "@material-ui/core/styles/zIndex"
const GreenCheckbox = withStyles({
root: {
color: "#2F9D7E",
Expand Down Expand Up @@ -224,14 +225,20 @@ const useStyles = makeStyles((theme) => ({
},
matrix : {
"& td" :{
paddingLeft : "0px !important",
paddingRight : "0px !important",
paddingLeft : "3px !important",
paddingRight : "3px !important",
width: "3%"
},
"& tr" : {
padding:"25px 0",
},
"& p" : {marginTop : "0px !important", marginBottom : "3px !important"}
"& p" : {marginTop : "0px !important", marginBottom : "3px !important"},
"& tr td:first-child": {
position: "sticky",
left: 0,
background: "#fff",
zIndex: 1
}
},
backdrop: {
zIndex: theme.zIndex.drawer + 1,
Expand Down Expand Up @@ -374,7 +381,12 @@ const useStyles = makeStyles((theme) => ({
listSelected: {
background: "#E7F8F2 !important",
},
surveyQuestionNav: { textAlign: "center", position: "fixed", width: "100%", bottom: 70 },
surveyQuestionNav: { textAlign: "center", position: "fixed", width: "100%", bottom: 75,
[`${theme.breakpoints.down('md')} and (orientation: landscape)`]: {
position: "relative",
bottom: 30,
}
},
surveyQuestionAlign: {
textAlign: "center",
"& blockquote": { borderLeft: "5px solid #ccc", margin: "1.5em 10px", padding: "0.5em 10px" },
Expand Down Expand Up @@ -408,7 +420,8 @@ const useStyles = makeStyles((theme) => ({

chatDrawerCustom: { minWidth: 411 },
questionScroll: {
marginTop: 30,
marginTop: 30,
overflow: "auto",
[theme.breakpoints.down("xs")]: {
overflow: "auto",
},
Expand All @@ -434,6 +447,7 @@ const useStyles = makeStyles((theme) => ({

mrgBtm: { marginBottom: 15 },
countlabel: { left: "calc(-50% - -8px)" },

}))
function range(start, stop, step = 1) {
return [...Array(stop - start).keys()].map((v, i) =>
Expand Down Expand Up @@ -1005,11 +1019,12 @@ function Matrix({ x, responses, onResponse, activityId, total,index, idx,startTi
{(x.questions || []).map((question, qindex) => (
<TableRow style={{ borderBottom: "1px solid rgba(224, 224, 224, 1)"}}>
<TableCell className={classes.required} style={{minWidth:"30%", maxWidth:"150px"}}>
<ReactMarkdown children={`${t(question.text)}`} allowDangerousHtml={true} plugins={[gfm, emoji]} renderers={{ link: LinkRenderer, span: (props) => {
<ReactMarkdown children={ question.required
?`${t(question.text)}<span> *</span>`:`${t(question.text)}`} allowDangerousHtml={true} plugins={[gfm, emoji]} renderers={{ link: LinkRenderer, span: (props) => {
return <sub>{props?.children}</sub>;
}, sup: (props) => {
return <sup>{props.children}</sup>;
}}} /> {!!question.required && <span> *</span>}
}}} />
</TableCell>
{(Array.isArray(x.options) && (x.options || []).length > 0) ?(
x.type === "list" ||x.type === "boolean" || x.type === "likert" ? (
Expand Down

0 comments on commit 3623b26

Please sign in to comment.