diff --git a/src/app/moods/info/page.tsx b/src/app/moods/info/page.tsx index 5c956dfa..34917eb8 100644 --- a/src/app/moods/info/page.tsx +++ b/src/app/moods/info/page.tsx @@ -97,10 +97,10 @@ export default function MoodsInfoPage() { layout="responsive" /> - Learn More Here + Learn more about the Eisenhower Matrix ) : ( @@ -146,7 +146,7 @@ export default function MoodsInfoPage() { alt="Image of an Eisenhower Matrix" layout="responsive" /> -
+

Three-Dimensional Model of Emotions (Lovheim, 2011)

Eight basic emotions are ordered into each corner of a cube. @@ -158,6 +158,12 @@ export default function MoodsInfoPage() { relabelled as their emotional state. Disgust refers to the feeling of having had enough, and has been relabelled content.)

+ + Learn more about the Three-Dimensional Model Of Emotions +
)} diff --git a/src/app/needs/info/page.tsx b/src/app/needs/info/page.tsx index 8fd30bc5..3a1713f2 100644 --- a/src/app/needs/info/page.tsx +++ b/src/app/needs/info/page.tsx @@ -65,7 +65,7 @@ export default function NeedsInfoPage() { className="text-twd-text-link" href="https://journals.sagepub.com/doi/10.1177/21582440221096139" > - Learn More Here + See paper on the effects of Non Violent Communication Program on Nursing Students

diff --git a/src/app/needs/next-actions/components/NextActionsDisplay.tsx b/src/app/needs/next-actions/components/NextActionsDisplay.tsx index 9c9bbfe3..3a18b571 100644 --- a/src/app/needs/next-actions/components/NextActionsDisplay.tsx +++ b/src/app/needs/next-actions/components/NextActionsDisplay.tsx @@ -32,17 +32,20 @@ export interface NextActionDocument { export default function NextActionsDisplay() { const database = useDatabase(); const [highlightedNeeds, setHighlightedNeeds] = useState([]); - const [relatedNextActions, setRelatedNextActions] = useState([]); + const [relatedNextActions, setRelatedNextActions] = useState< + NextActionDocument[] + >([]); const [chainEnd, setChainEnd] = useState(0); const [actionState, setActionState] = useState(0); - useEffect(() => { /* Fetch Data */ + useEffect(() => { + /* Fetch Data */ async function fetchData() { const needsDocs = await database.getFromDb("needs"); - const allNeeds = needsDocs.map(doc => doc.toJSON() as NeedDocument); + const allNeeds = needsDocs.map((doc) => doc.toJSON() as NeedDocument); const now = new Date(); - const filteredNeeds = allNeeds.filter(need => { + const filteredNeeds = allNeeds.filter((need) => { const expiry = new Date(need.selectedExpiry); return expiry > now && need.priority && need.priority.order > 0; }); @@ -52,15 +55,13 @@ export default function NextActionsDisplay() { const nextActionsDocs = await database.getFromDb("next_actions"); const allNextActions = nextActionsDocs.map( - doc => doc.toJSON() as NextActionDocument + (doc) => doc.toJSON() as NextActionDocument ); - const highlightedNeedIds = new Set(filteredNeeds.map( - need => need.id - )); + const highlightedNeedIds = new Set(filteredNeeds.map((need) => need.id)); - const filteredNextActions = allNextActions.filter( - action => highlightedNeedIds.has(action.need) + const filteredNextActions = allNextActions.filter((action) => + highlightedNeedIds.has(action.need) ); setRelatedNextActions(filteredNextActions); @@ -73,20 +74,23 @@ export default function NextActionsDisplay() { if (highlightedNeeds.length === 0) return []; const needsWithPriority = highlightedNeeds.filter( - need => need.priority && need.priority.order + (need) => need.priority && need.priority.order ); - const sortedNeeds = needsWithPriority.sort((a, b) => - a.priority!.order - b.priority!.order + const sortedNeeds = needsWithPriority.sort( + (a, b) => a.priority!.order - b.priority!.order ); - const groupsMap: Record = {}; + const groupsMap: Record< + number, + { + priority: { + order: number; + name: string; + }; + needs: NeedDocument[]; + } + > = {}; for (const need of sortedNeeds) { const order = need.priority!.order; @@ -94,7 +98,7 @@ export default function NextActionsDisplay() { if (!groupsMap[order]) { groupsMap[order] = { priority: need.priority!, - needs: [] + needs: [], }; } @@ -105,7 +109,7 @@ export default function NextActionsDisplay() { }, [highlightedNeeds]); const getActionsForNeed = (needId: string) => { - return relatedNextActions.filter(action => action.need === needId); + return relatedNextActions.filter((action) => action.need === needId); }; const onToggleAction = async (action: NextActionDocument) => { @@ -115,7 +119,7 @@ export default function NextActionsDisplay() { if (highlighted) { const updatedTimestamps = [...action.selectedTimestamps]; updatedTimestamps.pop(); - + await database.updateDocument( collectionName, action.id, @@ -132,10 +136,15 @@ export default function NextActionsDisplay() { } else { // Highlight action: // Add new selectedTimestamp - const updatedTimestamps = [...action.selectedTimestamps, new Date().toISOString()]; + const updatedTimestamps = [ + ...action.selectedTimestamps, + new Date().toISOString(), + ]; // Find the parent need to copy its selectedExpiry - const parentNeed = highlightedNeeds.find((need) => need.id === action.need); + const parentNeed = highlightedNeeds.find( + (need) => need.id === action.need + ); if (!parentNeed) { console.error("Parent need not found for action:", action); return; @@ -156,7 +165,7 @@ export default function NextActionsDisplay() { ); } - setChainEnd(prev => prev + 1); + setChainEnd((prev) => prev + 1); }; const handleAddAction = async (newAction: string, need: NeedDocument) => { @@ -168,48 +177,51 @@ export default function NextActionsDisplay() { selectedTimestamps: [], selectedExpiry: new Date().toISOString(), timestamp: new Date().toISOString(), - } + }; try { await database.addToDb("next_actions", newActionDocument); console.log(`Action Created: ${newActionDocument.name}`); } catch (error) { console.error("Error creating Action:", error); } - - setActionState(prev => prev + 1); + + setActionState((prev) => prev + 1); } }; - + return (

- { priorityGroups.length === 0 ? - (

- You have no unmet needs selected. Review which needs might be unmet before we can recommend next actions to meet them. -

) : - (priorityGroups.map((group, i) => ( + {priorityGroups.length === 0 ? ( +

+ You have no unmet needs selected. Review which needs might be unmet + before we can recommend next actions to meet them. +

+ ) : ( + priorityGroups.map((group, i) => (

{changeCase(group.priority.name, "sentence")}

- + {group.needs.map((need) => { const actions = getActionsForNeed(need.id); return ( -
-

- To meet a need for {changeCase(need.name, "lower")}, which actions can you take next? +
+

+ To meet a need for {changeCase(need.name, "lower")}, which + actions can you take next?

- { actions.length > 0 ? ( + {actions.length > 0 ? ( No next actions available for this need.

- ) - } -
+ )} +

); })}
- ))) - } + )) + )}
); -} \ No newline at end of file +} diff --git a/src/app/needs/next-actions/components/NextActionsSection.tsx b/src/app/needs/next-actions/components/NextActionsSection.tsx index ad6d2958..8f7cacca 100644 --- a/src/app/needs/next-actions/components/NextActionsSection.tsx +++ b/src/app/needs/next-actions/components/NextActionsSection.tsx @@ -24,51 +24,58 @@ export default function NextActionsSection({ const [newAction, setNewAction] = useState(""); const handleInputChange = (e: React.ChangeEvent) => { - setNewAction(e.target.value) + setNewAction(e.target.value); }; const handleSubmitAction = async () => { await handleAddAction(newAction, need); setModalOpen(false); - } + }; - return ( <> -
- {actions.map((action) => { - const highlighted = new Date(action.selectedExpiry) > new Date(); + return ( + <> +
+ {actions.map((action) => { + const highlighted = new Date(action.selectedExpiry) > new Date(); - return ( -
+ +
- { - setNewAction(""); - setModalOpen(false); - }, - }} - /> - ); -} \ No newline at end of file + { + setNewAction(""); + setModalOpen(false); + }, + }} + /> + + ); +} diff --git a/src/app/toolkit/info/categories-info/page.tsx b/src/app/toolkit/info/categories-info/page.tsx index af64c228..ad5ca5a5 100644 --- a/src/app/toolkit/info/categories-info/page.tsx +++ b/src/app/toolkit/info/categories-info/page.tsx @@ -31,7 +31,7 @@ export default function CategoriesInfoPage() { {/* Subheader */}

- Filter by categories you might find helpful or add your own: + Filter by tags you might find helpful or add your own:

{/* Scrollable Categories */} @@ -69,9 +69,9 @@ export default function CategoriesInfoPage() { ))}

- Add your own category + Add your own tag

-

Adding your own categories can help you organise in the best way for you.

+

Adding your own tags can help you organise in the best way for you.

diff --git a/src/app/toolkit/info/page.tsx b/src/app/toolkit/info/page.tsx index 17d3ccb3..aab2f83c 100644 --- a/src/app/toolkit/info/page.tsx +++ b/src/app/toolkit/info/page.tsx @@ -57,7 +57,7 @@ export default function ToolkitInfoPage() {
- Go to Categories + Go to Tabs
diff --git a/src/lib/db/seed/toolkit.ts b/src/lib/db/seed/toolkit.ts index 7df3e2e0..80b7d5d5 100644 --- a/src/lib/db/seed/toolkit.ts +++ b/src/lib/db/seed/toolkit.ts @@ -14,22 +14,22 @@ export const categories = [ export const toolkit = [ { id: uuidv4(), - name: "Listen to my favourite music", - categories: ["Replace", "Barrier"], + name: "Listen to your favourite music", + categories: ["Distract", "Change state"], checked: false, - infoUrl: "https://google.com/music", + infoUrl: "https://open.spotify.com/", imageUrl: - "https://daily.jstor.org/wp-content/uploads/2023/01/good_times_with_bad_music_1050x700.jpg", + "https://media.discordapp.net/attachments/1310562134932979735/1318576041073315900/received_950544553601344.jpg?ex=6762d322&is=676181a2&hm=c11e753161510ab37001c9057d18856b24402bde95c4d7808b97b5616dd4a53a&=&format=webp&width=936&height=936", timestamp: new Date().toISOString(), }, { id: uuidv4(), name: "Breathing exercises", - categories: ["Distract"], + categories: ["Change state"], checked: false, - infoUrl: "https://www.youtube.com/watch?v=DbDoBzGY3vo", + infoUrl: "https://youtu.be/i5apnLrzaT4?si=e_D3D5e-orQWUfLw", imageUrl: - "https://www.bhf.org.uk/-/media/images/information-support/heart-matters/2023/december/wellbeing/deep-breathing-620x400.png?h=400&w=620&rev=4506ebd34dab4476b56c225b6ff3ad60&hash=B3CFFEEE704E4432D101432CEE8B2766", + "https://media.discordapp.net/attachments/1310562134932979735/1318576040750088252/received_1503272180337642.jpg?ex=6762d322&is=676181a2&hm=df31873554df20b51e5c40e2e27306c7b4a459337353576f400237d4160a7434&=&format=webp&width=936&height=936", timestamp: new Date().toISOString(), }, { @@ -37,19 +37,19 @@ export const toolkit = [ name: "Call a friend", categories: ["Distract", "Change state"], checked: false, - infoUrl: "https://example.com/call", + infoUrl: "", imageUrl: - "https://t4.ftcdn.net/jpg/04/63/63/59/360_F_463635935_IweuYhCqZRtHp3SLguQL8svOVroVXvvZ.jpg", + "https://media.discordapp.net/attachments/1310562134932979735/1318576040041381908/received_960755905929645.jpg?ex=6762d321&is=676181a1&hm=c4b3219ff3bca866b47cd013f616879809317d954b5b4019a466a7117b129065&=&format=webp&width=936&height=936", timestamp: new Date().toISOString(), }, { id: uuidv4(), name: "Drink water", - categories: ["Distract", "Change state"], + categories: ["Replace", "Distract", "Change state"], checked: false, - infoUrl: "https://example.com/call", + infoUrl: "https://www.medicalnewstoday.com/articles/290814", imageUrl: - "https://content.health.harvard.edu/wp-content/uploads/2023/07/b8a1309a-ba53-48c7-bca3-9c36aab2338a.jpg", + "https://media.discordapp.net/attachments/1310562134932979735/1318576040418742355/received_570339555846105.jpg?ex=6762d321&is=676181a1&hm=0c2bd8744d116ac1e455da589d769eb018bbeb5bd22894012d6fa71e7745e250&=&format=webp&width=936&height=936", timestamp: new Date().toISOString(), }, ]; diff --git a/src/ui/shared/InfoButton.tsx b/src/ui/shared/InfoButton.tsx index 5a698acb..41bc88af 100644 --- a/src/ui/shared/InfoButton.tsx +++ b/src/ui/shared/InfoButton.tsx @@ -1,7 +1,6 @@ "use client"; import { useState, useEffect, useRef } from "react"; import { useRouter } from "next/navigation"; -import { InformationCircleIcon } from "@heroicons/react/24/outline"; import Button from "./Button"; interface QuestionMarkButtonProps { @@ -49,7 +48,11 @@ export default function InfoButton({ onClick={togglePopup} className="flex items-center justify-center w-8 h-8 border-2 border-twd-background rounded-full text-white font-bold transition" > - + {/* */} + + + + {isPopupOpen && (