From c7d91d4874ff5d039cc9e6175aff8dc26962e054 Mon Sep 17 00:00:00 2001 From: maxitect Date: Tue, 17 Dec 2024 20:50:10 +0000 Subject: [PATCH 1/2] fix: hide mood tooltips when priority matrix is set --- src/app/moods/components/Cube.tsx | 57 ++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/src/app/moods/components/Cube.tsx b/src/app/moods/components/Cube.tsx index 3b519195..966474d9 100644 --- a/src/app/moods/components/Cube.tsx +++ b/src/app/moods/components/Cube.tsx @@ -10,6 +10,7 @@ import quadrants from "./data/quadrants.json"; import labelsMood from "./data/labels_mood.json"; import labelsPriority from "./data/labels_priority.json"; import moodTooltips from "./data/mood_tooltips.json"; +import clsx from "clsx"; // Cube quadrants and labels order (in quadrants.json/labels.json): // Bottom-front-left @@ -90,36 +91,76 @@ export default function Cube({ neuroState }: CubeProps) { /> From d9d7b366a33409cf2f29ae3f095643381996e754 Mon Sep 17 00:00:00 2001 From: maxitect Date: Tue, 17 Dec 2024 20:50:44 +0000 Subject: [PATCH 2/2] fix: conditional modal to save before going to insights in MoodsDisplay.tsx --- src/app/moods/components/MoodsDisplay.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/moods/components/MoodsDisplay.tsx b/src/app/moods/components/MoodsDisplay.tsx index 469af27d..9a36701d 100644 --- a/src/app/moods/components/MoodsDisplay.tsx +++ b/src/app/moods/components/MoodsDisplay.tsx @@ -2,7 +2,6 @@ import Cube from "./Cube"; import SliderBox from "./SliderBox"; -// import MoodButtons from "./MoodButtons"; import { useDatabase } from "@/context/DatabaseContext"; import { useState } from "react"; import { Datum } from "plotly.js"; @@ -26,13 +25,14 @@ export default function MoodsDisplay() { serotonin: 1, adrenaline: 1, }); + const [hasSaved, setHasSaved] = useState(false); const handleChange = (value: number | number[], chem: string) => { setNeuroState((prev) => ({ ...prev, [chem]: value, })); - console.log(neuroState); + setHasSaved(false); }; const submitMood = () => { @@ -85,6 +85,7 @@ export default function MoodsDisplay() { database.addToDb("mood_records", submitObj); setModalOpen(true); + setHasSaved(true); }; const forwardButton = { @@ -121,7 +122,9 @@ export default function MoodsDisplay() {