Skip to content

Commit

Permalink
infos
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiazlin committed Nov 16, 2024
1 parent 6dbcf33 commit f84c207
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 23 deletions.
10 changes: 5 additions & 5 deletions src/components/Dashboard/MathScreen/MathScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const MathScreen = ({
title="Average Math Accuracy"
hoverable={true}
percentageChange={true}
info="Vidushi"
info="Number correct on first attempt divided by total"
data={accuracyData}
fullWidth
yLabel=""
Expand All @@ -76,23 +76,23 @@ const MathScreen = ({
title="Average Math Difficulty"
hoverable={true}
percentageChange={true}
info="Vidushi"
info=""
data={difficultyData}
fullWidth
gridLines
/>
<BarChart
width={325}
height={175}
title="Average Questions Answered per Session sdsdsdsdshdajsdhj asj djas dhj "
title="Average Questions Answered per Session"
data={numQuestionData}
hoverable
percentageChange
yLabel=""
// yLabel="Questions"
fullWidth
gridLines
info="test"
info=""
/>
<BarChart
width={325}
Expand All @@ -103,7 +103,7 @@ const MathScreen = ({
percentageChange
fullWidth
gridLines
info="Test"
info="In seconds"
/>
</div>
<div className={styles.textStatsWithHeader}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
font-size: 29.705px;
font-style: normal;
}

.infoBox {
font-family: var(--font-poppins);
font-size: 12px;
font-style: normal;
}
}

.bottomContainer {
Expand Down
49 changes: 47 additions & 2 deletions src/components/Dashboard/OverallDashboard/OverallDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import {
QuestionIcon as QI,
BarChartIcon,
} from "@src/app/icons";
import { CSSProperties } from "react";
import { CSSProperties, useState, useRef, useEffect } from "react";
import { DateRangeEnum, Days } from "@/common_utils/types";
import { D3Data } from "@src/utils/types";
import Chip from "@src/components/Chip/Chip";
import ActiveIndicatorBox from "@src/components/ActiveIndicatorBox/ActiveIndicatorBox";
import DateSelector from "@src/components/DateSelector/DateSelector";
import PopupModal from "@src/components/Graphs/PopupModal/PopupModal";
import { BarChart, SmallDataBox, WeeklyProgress } from "../../Graphs";
import styles from "./OverallDashboard.module.scss";

Expand Down Expand Up @@ -54,6 +55,26 @@ function formatDate(date: Date) {
}

export default function OverallDashboard(params: Params) {
const [infoPopup, setInfoPopup] = useState(false);
const infoButtonRef = useRef(null);
const [popupX, setPopupX] = useState<number | null>(null);
const [popupY, setPopupY] = useState<number | null>(null);

useEffect(() => {
const onScroll = () => setInfoPopup(false);
// clean up code
window.removeEventListener("scroll", onScroll);
window.addEventListener("scroll", onScroll, { passive: true });

if (infoButtonRef.current) {
const rect: Element = infoButtonRef.current;
const newTop = rect.getBoundingClientRect().y + 30;
setPopupY(newTop);
const left = rect.getBoundingClientRect().x;
setPopupX(left);
}
}, [setPopupX, setPopupY, setInfoPopup]);

return (
<div className={styles.OverallDashboard} style={params.style}>
<div className={styles.titleRow}>
Expand All @@ -74,7 +95,31 @@ export default function OverallDashboard(params: Params) {
active={params.active}
style={{ marginLeft: "17px", marginRight: "10px" }}
/>
<IGI />
<div
className={styles.infoBox}
onMouseEnter={() => {
setInfoPopup(true);
}}
onMouseLeave={() => {
setInfoPopup(false);
}}
ref={infoButtonRef}
style={{ position: "relative" }}
>
<IGI />
<PopupModal
show={infoPopup}
info={
"Active means a user has completed at least two sessions each week for the past two weeks."
}
style={{
position: "fixed",
top: `${popupY}px`,
zIndex: 500,
left: `${popupX}px`,
}}
/>
</div>
<div className={styles.dateSelector}>
<DateSelector
selectedValue={params.menuState[0]}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Dashboard/ReadingScreen/ReadingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ export default function ReadingScreen({
<LineChart
width={325}
height={185}
title="Average Reading Rate (Words/Min)"
title="Average Reading Rate"
hoverable={true}
percentageChange={true}
info="Vidushi"
info="Words/Min"
data={readingRate}
fullWidth
gridLines
Expand All @@ -113,7 +113,7 @@ export default function ReadingScreen({
percentageChange
fullWidth
gridLines
info="Hey this is just some info I thought you will find interesting."
info="In seconds"
/>
</div>
<div className={styles.textStats}>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Dashboard/TriviaScreen/TriviaScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function TriviaScreen({
title="Average Trivia Accuracy"
hoverable={true}
percentageChange={true}
info="Vidushi"
info="Number of self-reported correct answers"
data={accuracyData}
fullWidth
gridLines
Expand All @@ -80,6 +80,7 @@ export default function TriviaScreen({
width={325}
height={175}
title="Average Time Spent per Question"
info="In seconds"
data={timeData}
hoverable
percentageChange
Expand Down
4 changes: 1 addition & 3 deletions src/components/Dashboard/WritingScreen/WritingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export default function WritingScreen({
// { text: "sessions completed without writing", color: "#FF9FB3" },
// { text: "sessions completed with writing", color: "#008AFC" },
// ]}
info="Some really extremely interesting information about stacked bar chart."
hoverable
percentageChange
fullWidth
Expand All @@ -76,14 +75,13 @@ export default function WritingScreen({
percentageChange
fullWidth
gridLines
info="Some info for testing purposes in bar chart"
/>
<BarChart
width={325}
height={185}
title="Average Time Spent Per Prompt"
data={avgTime}
info="Some info for testing purposes in bar chart"
info="In seconds"
hoverable
percentageChange
fullWidth
Expand Down
2 changes: 2 additions & 0 deletions src/components/DateSelector/DateSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function DateSelector({
border: "none",
width: "130px",
textAlign: "center",
backgroundColor: "white",
}}
sx={{
"&.MuiOutlinedInput-root": {
Expand All @@ -48,6 +49,7 @@ function DateSelector({
fontSize: "12px",
fontFamily: poppins500.style.fontFamily,
}}
defaultBackgroundColor="#ffffff"
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const GroupMathScreen = ({
title="Average Math Accuracy"
hoverable={true}
percentageChange={true}
info="Vidushi"
info="Number correct on first attempt divided by total"
data={accuracyData}
fullWidth
gridLines
Expand All @@ -71,7 +71,7 @@ const GroupMathScreen = ({
title="Average Math Difficulty"
hoverable={true}
percentageChange={true}
info="Vidushi"
info=""
data={difficultyData}
fullWidth
gridLines
Expand All @@ -91,6 +91,7 @@ const GroupMathScreen = ({
width={325}
height={175}
title="Average Time Spent per Question"
info="In seconds"
data={timeData}
hoverable
percentageChange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ export default function GroupReadingScreen({
<LineChart
width={325}
height={185}
title="Average Reading Rate (Words/Min)"
title="Average Reading Rate"
hoverable={true}
percentageChange={true}
info="Vidushi"
info="Words/Min"
data={readingRate}
fullWidth
gridLines
Expand All @@ -115,7 +115,7 @@ export default function GroupReadingScreen({
percentageChange
fullWidth
gridLines
info="Hey this is just some info I thought you will find interesting."
info="In seconds"
/>
</div>
<div className={styles.textStats}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function GroupTriviaScreen({
title="Average Trivia Accuracy"
hoverable={true}
percentageChange={true}
info="Vidushi"
info="Number of self-reported correct answers"
data={accuracyData}
fullWidth
gridLines
Expand All @@ -77,6 +77,7 @@ export default function GroupTriviaScreen({
width={325}
height={175}
title="Average Time Spent per Question"
info="In seconds"
data={timeData}
hoverable
percentageChange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default function GroupWritingScreen({
{ text: "sessions completed without writing", color: "#FF9FB3" },
{ text: "sessions completed with writing", color: "#008AFC" },
]}
info="Some really extremely interesting information about stacked bar chart."
hoverable
percentageChange
fullWidth
Expand All @@ -70,14 +69,13 @@ export default function GroupWritingScreen({
percentageChange
fullWidth
gridLines
info="Some info for testing purposes in bar chart"
/>
<BarChart
width={325}
height={185}
title="Average Time Spent Per Prompt"
data={avgTimeData}
info="Some info for testing purposes in bar chart"
info="In seconds"
hoverable
percentageChange
fullWidth
Expand Down

0 comments on commit f84c207

Please sign in to comment.