Skip to content

Commit

Permalink
#57 twilio video
Browse files Browse the repository at this point in the history
  • Loading branch information
Nandu-D committed Jul 23, 2020
2 parents c8b2b20 + d4aaafe commit a6f0ff8
Show file tree
Hide file tree
Showing 19 changed files with 31,980 additions and 103 deletions.
18 changes: 17 additions & 1 deletion client/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,26 @@
}

video {
right: 0;
}

/* makeStyles-screen-23:nth-child(odd) > video {
object-fit: contain;
max-width: 200px !important;
max-height: 200px !important;
z-index: 9;
}
makeStyles-screen-23:nth-child(even) > video {
object-fit: contain;
max-width: 400px !important;
z-index: 5;
} */

/* video {
max-width: 200px !important;
max-height: 200px !important;
} */

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
Expand Down
74 changes: 67 additions & 7 deletions client/src/components/CustomTables.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState, useContext, useEffect } from "react";

import { makeStyles } from "@material-ui/core/styles";
import {
Grid,
Expand Down Expand Up @@ -27,7 +26,6 @@ const pastPracticeTableStyles = makeStyles({
});

function formatAMPM(date) {
console.log("date: " + date);
let hours = date.getHours();
let minutes = date.getMinutes();
const amPm = hours >= 12 ? "PM" : "AM";
Expand All @@ -39,7 +37,7 @@ function formatAMPM(date) {
}

function formatDate(unformattedDate) {
//Thursday , April 30, 2020
//Format : "Thursday , April 30, 2020"
const year = unformattedDate.getFullYear();
const date = unformattedDate.getDate();
const months = [
Expand Down Expand Up @@ -69,31 +67,93 @@ function formatDate(unformattedDate) {
];
const dayIndex = unformattedDate.getDay();
const dayName = days[dayIndex];
//Thursday , April 30, 2020
return dayName + " , " + monthName + " " + date + ", " + year;
}

export function PastPracticeTable(props) {
const classes = pastPracticeTableStyles();
const location = useLocation();
const [completedInterviewsList, setCompletedInterviewsList] = useState([]);
const [inLobby, setInLobby] = useState(true);
const { user } = useContext(UserContext);
useEffect(() => {
fetch("interviews/completed")
.then((result) => result.json())
.then((data) => {
data.forEach((element) => {
let startDate = new Date(element.startTime);
let endDate = new Date(element.endTime);
const startDate = new Date(element.startTime);
const endDate = new Date(element.endTime);
element.heldOnDate = formatDate(startDate);
element.heldOnTime =
formatAMPM(startDate) + " - " + formatAMPM(endDate);
const {
codingRating,
communicationRating,
} = extractCodingAndCommunicationRating(element, user.id);
element.codingRating = codingRating;
element.communicationRating = communicationRating;
setCompletedInterviewsList((prevArray) => [...prevArray, element]);
});
})
.catch((err) => console.error(err));
}, [location.pathname]);

const extractCodingAndCommunicationRating = (interview, userId) => {
let codingRating, communicationRating;
const participants = interview.participants;
if (participants) {
participants.forEach((participant) => {
if (participant.user && participant.user === userId) {
if (
participant.feedbackReceived &&
participant.feedbackReceived.review
) {
const review = participant.feedbackReceived.review;
const {
communicationSkills,
codeEfficiency,
codeOrganization,
debuggingSkills,
problemSolvingSkills,
speed,
} = review;
communicationRating = convertReviewPointsToScore(
communicationSkills
);
const codeRatingAverage =
(convertReviewPointsToScore(codeEfficiency) +
convertReviewPointsToScore(codeOrganization) +
convertReviewPointsToScore(debuggingSkills) +
convertReviewPointsToScore(problemSolvingSkills) +
convertReviewPointsToScore(speed)) /
5;
codingRating = codeRatingAverage;
}
}
});
}
return {
codingRating: codingRating,
communicationRating: communicationRating,
};
};

const convertReviewPointsToScore = (reviewPoint) => {
switch (reviewPoint) {
case "needs improvement":
return 1;
case "satisfactory":
return 2;
case "good":
return 3;
case "great":
return 4;
case "excellent":
return 5;
default:
return undefined;
}
};

function RatingComponent(props) {
const isRatingProvided = props.isRatingProvided;
const value = props.value;
Expand Down
3 changes: 2 additions & 1 deletion client/src/dialogs/feedback/AnythingElseDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const AnythingElseDialog = ({ onClose, onSubmitClick, match }) => {
if (result.anythingElse) {
setAnswerText(result.anythingElse);
}
});
})
.catch((err) => {});
}, [match.params.id]);

const onTextInputChange = (value) => {
Expand Down
6 changes: 4 additions & 2 deletions client/src/dialogs/feedback/OverallDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ const OverallDialog = ({ onClose, onNextQuestionClick, match }) => {
if (result.overallScore) {
setCurrentRadioButtonSelection(result.overallScore);
}
});
})
.catch((err) => {});
}, [match.params.id]);

const handleClose = () => {
Expand All @@ -72,7 +73,8 @@ const OverallDialog = ({ onClose, onNextQuestionClick, match }) => {
};

const handleRadioButtonClick = (e) => {
setCurrentRadioButtonSelection(e.target.value.toString());
if (e.target.value)
setCurrentRadioButtonSelection(e.target.value.toString());
};

const nextButtonClick = () => {
Expand Down
3 changes: 2 additions & 1 deletion client/src/dialogs/feedback/RecommendationsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const RecommendationsDialog = ({
if (result.recommendations) {
setAnswerText(result.recommendations);
}
});
})
.catch((err) => {});
}, [match.params.id]);

const handleClose = () => {
Expand Down
16 changes: 9 additions & 7 deletions client/src/dialogs/feedback/ReviewDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ const ReviewDialog = ({
setProblemSolvingSelection(review.problemSolvingSkills);
}
}
});
})
.catch((err) => {});
}, [match.params.id]);

const handleClose = () => {
Expand Down Expand Up @@ -158,27 +159,28 @@ const ReviewDialog = ({
};

const communicationSkillsOnChange = (e) => {
setCommunicationSkillsSelection(e.target.value.toString());
if (e.target.value)
setCommunicationSkillsSelection(e.target.value.toString());
};

const codeEfficiencyOnChange = (e) => {
setCodeEfficiencySelection(e.target.value.toString());
if (e.target.value) setCodeEfficiencySelection(e.target.value.toString());
};

const codeOrganizationOnChange = (e) => {
setCodeOrganizationSelection(e.target.value.toString());
if (e.target.value) setCodeOrganizationSelection(e.target.value.toString());
};

const speedOnChange = (e) => {
setSpeedSelection(e.target.value.toString());
if (e.target.value) setSpeedSelection(e.target.value.toString());
};

const debuggingSkillsOnChange = (e) => {
setDebuggingSkillsSelection(e.target.value.toString());
if (e.target.value) setDebuggingSkillsSelection(e.target.value.toString());
};

const problemSolvingOnChange = (e) => {
setProblemSolvingSelection(e.target.value.toString());
if (e.target.value) setProblemSolvingSelection(e.target.value.toString());
};

const handleSnackbarOpen = (message, severity = "error") => {
Expand Down
3 changes: 2 additions & 1 deletion client/src/dialogs/feedback/StrengthsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const StrengthsDialog = ({
if (result.strengths) {
setAnswerText(result.strengths);
}
});
})
.catch((err) => {});
}, [match.params.id]);

const handleClose = () => {
Expand Down
3 changes: 2 additions & 1 deletion client/src/dialogs/feedback/WeaknessesDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const WeaknessesDialog = ({
if (result.weaknesses) {
setAnswerText(result.weaknesses);
}
});
})
.catch((err) => {});
}, [match.params.id]);

const handleClose = () => {
Expand Down
Loading

0 comments on commit a6f0ff8

Please sign in to comment.