Skip to content

Commit

Permalink
Merge branch 'main' into style/animations
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcasstlesjones committed Dec 18, 2024
2 parents 6c5035b + 305c934 commit 63f335a
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 11 deletions.
57 changes: 49 additions & 8 deletions src/app/moods/components/Cube.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -90,36 +91,76 @@ export default function Cube({ neuroState }: CubeProps) {
/>

<button
className="absolute left-1/2 top-[122px] transform -translate-x-28 z-20 w-20 h-6"
className={clsx(
"",
isPriorityMatrix
? "hidden"
: "absolute left-1/2 top-[122px] transform -translate-x-28 z-20 w-20 h-6"
)}
onClick={() => handleTooltip("fight/flight")}
></button>
<button
className="absolute left-1/2 top-[122px] transform translate-x-14 z-20 w-14 h-6"
className={clsx(
"",
isPriorityMatrix
? "hidden"
: "absolute left-1/2 top-[122px] transform translate-x-14 z-20 w-14 h-6"
)}
onClick={() => handleTooltip("interest")}
></button>
<button
className="absolute left-1/2 top-[327px] transform -translate-x-28 z-20 w-16 h-6"
className={clsx(
"",
isPriorityMatrix
? "hidden"
: "absolute left-1/2 top-[327px] transform -translate-x-28 z-20 w-16 h-6"
)}
onClick={() => handleTooltip("distress")}
></button>
<button
className="absolute left-1/2 top-[327px] transform translate-x-16 z-20 w-12 h-6"
className={clsx(
"",
isPriorityMatrix
? "hidden"
: "absolute left-1/2 top-[327px] transform translate-x-16 z-20 w-12 h-6"
)}
onClick={() => handleTooltip("relief")}
></button>

<button
className="absolute left-1/2 top-[180px] transform -translate-x-20 z-20 w-16 h-6"
className={clsx(
"",
isPriorityMatrix
? "hidden"
: "absolute left-1/2 top-[180px] transform -translate-x-20 z-20 w-16 h-6"
)}
onClick={() => handleTooltip("freeze")}
></button>
<button
className="absolute left-1/2 top-[180px] transform translate-x-6 z-20 w-10 h-6"
className={clsx(
"",
isPriorityMatrix
? "hidden"
: "absolute left-1/2 top-[180px] transform translate-x-6 z-20 w-10 h-6"
)}
onClick={() => handleTooltip("joy")}
></button>
<button
className="absolute left-1/2 top-[267px] transform -translate-x-16 z-20 w-10 h-6"
className={clsx(
"",
isPriorityMatrix
? "hidden"
: "absolute left-1/2 top-[267px] transform -translate-x-16 z-20 w-10 h-6"
)}
onClick={() => handleTooltip("guilt")}
></button>
<button
className="absolute left-1/2 top-[267px] transform translate-x-3 z-20 w-16 h-6"
className={clsx(
"",
isPriorityMatrix
? "hidden"
: "absolute left-1/2 top-[267px] transform translate-x-3 z-20 w-16 h-6"
)}
onClick={() => handleTooltip("content")}
></button>

Expand Down
9 changes: 6 additions & 3 deletions src/app/moods/components/MoodsDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 = () => {
Expand Down Expand Up @@ -85,6 +85,7 @@ export default function MoodsDisplay() {

database.addToDb("mood_records", submitObj);
setModalOpen(true);
setHasSaved(true);
};

const forwardButton = {
Expand Down Expand Up @@ -121,7 +122,9 @@ export default function MoodsDisplay() {
<Button
label="Go to Insights"
className="mt-2 px-3 py-1 bg-gray-700 text-white rounded"
onClick={() => setInsightsModalOpen(true)}
onClick={() =>
hasSaved ? router.push("/insights") : setInsightsModalOpen(true)
}
/>
</div>

Expand Down

0 comments on commit 63f335a

Please sign in to comment.