diff --git a/package-lock.json b/package-lock.json index 0993541..e791ce8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -64,6 +64,7 @@ "integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.3", @@ -951,6 +952,7 @@ "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.14.6.tgz", "integrity": "sha512-4uyt8BOrBsSq6i4yiOV/gG6BnnrvTeyymlNcaN/dKvyU1GoolxAafvIvaNP1RCGPlNab3OuE4MKUQuv2lH+PLQ==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@firebase/component": "0.7.0", "@firebase/logger": "0.5.0", @@ -1017,6 +1019,7 @@ "resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.5.6.tgz", "integrity": "sha512-YYGARbutghQY4zZUWMYia0ib0Y/rb52y72/N0z3vglRHL7ii/AaK9SA7S/dzScVOlCdnbHXz+sc5Dq+r8fwFAg==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@firebase/app": "0.14.6", "@firebase/component": "0.7.0", @@ -1032,7 +1035,8 @@ "version": "0.9.3", "resolved": "https://registry.npmjs.org/@firebase/app-types/-/app-types-0.9.3.tgz", "integrity": "sha512-kRVpIl4vVGJ4baogMDINbyrIOtOxqhkZQg4jTq3l8Lw6WSk0xfpEYzezFu+Kl4ve4fbPl79dvwRtaFqAC/ucCw==", - "license": "Apache-2.0" + "license": "Apache-2.0", + "peer": true }, "node_modules/@firebase/auth": { "version": "1.11.1", @@ -1483,6 +1487,7 @@ "integrity": "sha512-0AZUyYUfpMNcztR5l09izHwXkZpghLgCUaAGjtMwXnCg3bj4ml5VgiwqOMOxJ+Nw4qN/zJAaOQBcJ7KGkWStqQ==", "hasInstallScript": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "tslib": "^2.1.0" }, @@ -2328,6 +2333,7 @@ "integrity": "sha512-6mDvHUFSjyT2B2yeNx2nUgMxh9LtOWvkhIU3uePn2I2oyNymUAX1NIsdgviM4CH+JSrp2D2hsMvJOkxY+0wNRA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "csstype": "^3.0.2" } @@ -2369,6 +2375,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2520,6 +2527,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.8.9", "caniuse-lite": "^1.0.30001746", @@ -2797,6 +2805,7 @@ "integrity": "sha512-XyLmROnACWqSxiGYArdef1fItQd47weqB7iwtfr9JHwRrqIXZdcFMvvEcL9xHCmL0SNsOvF0c42lWyM1U5dgig==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -3858,6 +3867,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -3884,6 +3894,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -3965,6 +3976,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.0.tgz", "integrity": "sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -3974,6 +3986,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.0.tgz", "integrity": "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ==", "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -4247,7 +4260,8 @@ "version": "4.1.14", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.14.tgz", "integrity": "sha512-b7pCxjGO98LnxVkKjaZSDeNuljC4ueKUddjENJOADtubtdo8llTaJy7HwBMeLNSSo2N5QIAgklslK1+Ir8r6CA==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/tapable": { "version": "2.3.0", @@ -4374,6 +4388,7 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.9.tgz", "integrity": "sha512-4nVGliEpxmhCL8DslSAUdxlB6+SMrhB0a1v5ijlh1xB1nEPuy1mxaHxysVucLHuWryAxLWg6a5ei+U4TLn/rFg==", "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", 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..242f07c 100644 --- a/src/components/DailySummary.jsx +++ b/src/components/DailySummary.jsx @@ -1,6 +1,5 @@ //react import { useState, useEffect } from 'react'; -import { Link } from 'react-router-dom'; // component import Button from './Button'; @@ -14,20 +13,31 @@ const DailySummary = ({ onSave, }) => { const max_chars = 500; - const [comment, setComment] = useState(initialComment || ''); + + const initialCommentObject = initialComment || {}; + const [comment, setComment] = useState(initialCommentObject.comment || ''); + + const [isOptedOut, setIsOptedOut] = useState( + initialCommentObject.optOut || false + ); + const remainingChars = max_chars - comment.length; useEffect(() => { - setComment(initialComment || ''); + const updatedCommentObject = initialComment || {}; + setComment(updatedCommentObject.comment || ''); + setIsOptedOut(updatedCommentObject.optOut || false); }, [initialComment, day]); const handleSave = () => { - onSave(day, comment); + onSave(day, comment, isOptedOut); onClose(); }; const handleCancel = () => { - setComment(initialComment || ''); + const updatedCommentObject = initialComment || {}; + setComment(updatedCommentObject.comment || ''); + setIsOptedOut(updatedCommentObject.optOut || false); onClose(); }; @@ -46,8 +56,9 @@ const DailySummary = ({ Day {day} Summary -
{question}
- + +{question}
+