From dca51a239bea913cb00934a624de07d9443ae3a5 Mon Sep 17 00:00:00 2001 From: Catherine Molina Betancourt Date: Tue, 18 Nov 2025 14:49:40 -0800 Subject: [PATCH 1/6] feat/communityForum --- src/App.css | 2 +- src/components/Button.jsx | 101 ++++++----- src/components/DailySummary.jsx | 46 +++-- src/components/DailyTrackerBar.jsx | 2 +- src/components/Dashboard/DashboardTile.jsx | 91 +++++----- src/components/Dashboard/TaskModal.jsx | 159 ++++++++++------- src/components/MobileMenu.jsx | 16 +- src/components/Navbar.jsx | 4 +- src/data/questions.js | 191 ++++++++++++++++++++- src/index.css | 2 +- src/main.jsx | 6 +- src/pages/Community.jsx | 53 +++++- src/pages/Dashboard.jsx | 125 +++++++------- src/pages/ForumResponses.jsx | 100 +++++++++++ src/pages/Home.jsx | 15 +- src/pages/Login.jsx | 2 +- src/pages/Onboarding.jsx | 66 +++---- src/pages/journal.jsx | 32 +++- 18 files changed, 720 insertions(+), 293 deletions(-) create mode 100644 src/pages/ForumResponses.jsx diff --git a/src/App.css b/src/App.css index c829a2b..c03681c 100644 --- a/src/App.css +++ b/src/App.css @@ -17,4 +17,4 @@ button.active { } button.active:hover { background-color: var(--color-persianblue); -} \ No newline at end of file +} diff --git a/src/components/Button.jsx b/src/components/Button.jsx index fdda22f..c077c74 100644 --- a/src/components/Button.jsx +++ b/src/components/Button.jsx @@ -2,53 +2,68 @@ import { useNavigate } from 'react-router-dom'; import { tv } from 'tailwind-variants/lite'; const buttonVariants = tv({ - // base styles for all buttons - base: 'font-poppins flex items-center justify-center drop-shadow-[0_4px_4px_rgba(0,0,0,0.25)]', - // all button variants - variants: { - size: { - sm: 'h-12 w-[162px] text-base font-semibold rounded-lg lg:h-14 lg:w-[220px] lg:text-xl', - md: 'h-11 w-[218px] text-base font-semibold rounded-lg lg:h-14 lg:w-[286px] lg:text-xl xl:h-16 xl:w-[327px] xl:text-2xl', - lg: 'h-11 w-[345px] text-base font-medium rounded-md lg:w-[501px]', - circ: 'h-11 w-11 text-2xl rounded-full' - }, - color: { - primary: 'bg-eerie text-white border-1 border-eerie', - secondary: 'bg-white text-eerie border-1 border-eerie', - gradient: 'bg-gradient-to-b from-electricgreen to-persianblue text-white' - } + // base styles for all buttons + base: 'font-poppins flex items-center justify-center drop-shadow-[0_4px_4px_rgba(0,0,0,0.25)]', + // all button variants + variants: { + size: { + sm: 'h-12 w-[162px] text-base font-semibold rounded-lg lg:h-14 lg:w-[220px] lg:text-xl', + md: 'h-11 w-[218px] text-base font-semibold rounded-lg lg:h-14 lg:w-[286px] lg:text-xl xl:h-16 xl:w-[327px] xl:text-2xl', + lg: 'h-11 w-[345px] text-base font-medium rounded-md lg:w-[501px]', + circ: 'h-11 w-11 text-2xl rounded-full', }, - // default button styles if no specified props - defaultVariants: { - size: 'sm', - color: 'primary' + color: { + primary: 'bg-eerie text-white border-1 border-eerie', + secondary: 'bg-white text-eerie border-1 border-eerie', + gradient: 'bg-gradient-to-b from-electricgreen to-persianblue text-white', }, - // conditional style cases for specific prop combinations - compoundVariants: [ - // remove drop shadow and lower font weight for user selection button - { - color: 'secondary', - size: 'md', - className: 'drop-shadow-none !font-normal' - } - ] + }, + // default button styles if no specified props + defaultVariants: { + size: 'sm', + color: 'primary', + }, + // conditional style cases for specific prop combinations + compoundVariants: [ + // remove drop shadow and lower font weight for user selection button + { + color: 'secondary', + size: 'md', + className: 'drop-shadow-none !font-normal', + }, + ], }); -export default function Button({ size, color, label, onClick, isActive, to, ...props }) { - let navigate = useNavigate(); +export default function Button({ + size, + color, + label, + onClick, + isActive, + to, + ...props +}) { + let navigate = useNavigate(); - function handleClick(){ - if (to){ - navigate(to); - } else { - onClick(); - } + function handleClick() { + if (to) { + navigate(to); + } else { + onClick(); } + } - return ( - - ); -} \ No newline at end of file + return ( + + ); +} diff --git a/src/components/DailySummary.jsx b/src/components/DailySummary.jsx index 11229f1..e545f9c 100644 --- a/src/components/DailySummary.jsx +++ b/src/components/DailySummary.jsx @@ -10,24 +10,40 @@ const DailySummary = ({ onClose, day, question, - initialComment, + initialComment, // Ahora puede ser un objeto: { comment: '...', optOut: false } onSave, }) => { const max_chars = 500; - const [comment, setComment] = useState(initialComment || ''); + + // Si initialComment existe, usa sus propiedades. Si no, usa valores por defecto. + const initialCommentObject = initialComment || {}; + const [comment, setComment] = useState(initialCommentObject.comment || ''); + + // AJUSTE CLAVE: Nuevo estado para Opt-out + const [isOptedOut, setIsOptedOut] = useState( + initialCommentObject.optOut || false + ); + const remainingChars = max_chars - comment.length; useEffect(() => { - setComment(initialComment || ''); + // Actualiza el estado cuando cambian las props + const updatedCommentObject = initialComment || {}; + setComment(updatedCommentObject.comment || ''); + setIsOptedOut(updatedCommentObject.optOut || false); }, [initialComment, day]); const handleSave = () => { - onSave(day, comment); + // AJUSTE CLAVE: Pasar el estado de isOptedOut a onSave + onSave(day, comment, isOptedOut); onClose(); }; const handleCancel = () => { - setComment(initialComment || ''); + // Restablecer al estado inicial + const updatedCommentObject = initialComment || {}; + setComment(updatedCommentObject.comment || ''); + setIsOptedOut(updatedCommentObject.optOut || false); onClose(); }; @@ -79,13 +95,21 @@ const DailySummary = ({ -
- + setIsOptedOut(e.target.checked)} + className="h-4 w-4 text-green border-eerie rounded focus:ring-persianblue" + /> +
diff --git a/src/components/DailyTrackerBar.jsx b/src/components/DailyTrackerBar.jsx index 7c112e7..3c7e91d 100644 --- a/src/components/DailyTrackerBar.jsx +++ b/src/components/DailyTrackerBar.jsx @@ -9,7 +9,7 @@ const DailyTrackerBar = ({ day, isCompleted, onClick, isDisabled, isOpen }) => { aria-hidden="true" /> ) : ( -