diff --git a/backend/app/graphql/meal_request.py b/backend/app/graphql/meal_request.py index c1cea863..0dbdff37 100644 --- a/backend/app/graphql/meal_request.py +++ b/backend/app/graphql/meal_request.py @@ -140,7 +140,6 @@ def mutate( print("requestor id is", requestor_id) - # TODO: Re-enable this check if ( requestor_role != "Admin" and meal_request.donation_info["donor"]["id"] != requestor_id diff --git a/backend/app/resources/meal_request_dto.py b/backend/app/resources/meal_request_dto.py index c77a9871..8dd315fc 100644 --- a/backend/app/resources/meal_request_dto.py +++ b/backend/app/resources/meal_request_dto.py @@ -49,17 +49,18 @@ def validate(self): validate_user(self.requestor, "requestor", error_list) - # if type(self.status) is not str: - # error_list.append("The status supplied is not a string.") + if type(self.status) is not str: + error_list.append( + f"The status supplied was type {type(self.status)}, but expected a string." + ) if self.status not in MEAL_STATUSES_STRINGS: - # TODO: revisit this - pass - # error_list.append( - # "The status {self_status} is not one of {valid_statuses}".format( - # self_status=self.status, valid_statuses=", ".join(MEAL_STATUSES) - # ) - # ) + error_list.append( + "The status {self_status} is not one of {valid_statuses}".format( + self_status=self.status, + valid_statuses=", ".join(MEAL_STATUSES_STRINGS), + ) + ) if type(self.drop_off_datetime) is not datetime.datetime: error_list.append( diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 94c5361f..5d0c9a41 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -21,6 +21,7 @@ "@react-oauth/google": "^0.5.0", "@rjsf/bootstrap-4": "^2.5.1", "@rjsf/core": "^2.5.1", + "@sentry/cli": "^2.33.0", "@sentry/react": "^8.20.0", "@table-library/react-table-library": "^4.1.4", "@tanstack/react-table": "^8.7.0", @@ -32,9 +33,9 @@ "jose": "^4.11.1", "json-schema": "^0.3.0", "json2csv": "^5.0.6", - "react": "^18.2.0", + "react": "^18.3.1", "react-bootstrap": "^1.5.2", - "react-dom": "^18.2.0", + "react-dom": "^18.3.1", "react-icons": "^5.0.1", "react-json-schema": "^1.2.2", "react-jsonschema-form": "^1.8.1", @@ -4922,6 +4923,142 @@ "node": ">=14.18" } }, + "node_modules/@sentry/cli": { + "version": "2.33.1", + "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-2.33.1.tgz", + "integrity": "sha512-dUlZ4EFh98VFRPJ+f6OW3JEYQ7VvqGNMa0AMcmvk07ePNeK/GicAWmSQE4ZfJTTl80ul6HZw1kY01fGQOQlVRA==", + "hasInstallScript": true, + "dependencies": { + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.7", + "progress": "^2.0.3", + "proxy-from-env": "^1.1.0", + "which": "^2.0.2" + }, + "bin": { + "sentry-cli": "bin/sentry-cli" + }, + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@sentry/cli-darwin": "2.33.1", + "@sentry/cli-linux-arm": "2.33.1", + "@sentry/cli-linux-arm64": "2.33.1", + "@sentry/cli-linux-i686": "2.33.1", + "@sentry/cli-linux-x64": "2.33.1", + "@sentry/cli-win32-i686": "2.33.1", + "@sentry/cli-win32-x64": "2.33.1" + } + }, + "node_modules/@sentry/cli-darwin": { + "version": "2.33.1", + "resolved": "https://registry.npmjs.org/@sentry/cli-darwin/-/cli-darwin-2.33.1.tgz", + "integrity": "sha512-+4/VIx/E1L2hChj5nGf5MHyEPHUNHJ/HoG5RY+B+vyEutGily1c1+DM2bum7RbD0xs6wKLIyup5F02guzSzG8A==", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm": { + "version": "2.33.1", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm/-/cli-linux-arm-2.33.1.tgz", + "integrity": "sha512-zbxEvQju+tgNvzTOt635le4kS/Fbm2XC2RtYbCTs034Vb8xjrAxLnK0z1bQnStUV8BkeBHtsNVrG+NSQDym2wg==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm64": { + "version": "2.33.1", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.33.1.tgz", + "integrity": "sha512-DbGV56PRKOLsAZJX27Jt2uZ11QfQEMmWB4cIvxkKcFVE+LJP4MVA+MGGRUL6p+Bs1R9ZUuGbpKGtj0JiG6CoXw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-i686": { + "version": "2.33.1", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-i686/-/cli-linux-i686-2.33.1.tgz", + "integrity": "sha512-g2LS4oPXkPWOfKWukKzYp4FnXVRRSwBxhuQ9eSw2peeb58ZIObr4YKGOA/8HJRGkooBJIKGaAR2mH2Pk1TKaiA==", + "cpu": [ + "x86", + "ia32" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-x64": { + "version": "2.33.1", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-x64/-/cli-linux-x64-2.33.1.tgz", + "integrity": "sha512-IV3dcYV/ZcvO+VGu9U6kuxSdbsV2kzxaBwWUQxtzxJ+cOa7J8Hn1t0koKGtU53JVZNBa06qJWIcqgl4/pCuKIg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-i686": { + "version": "2.33.1", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-i686/-/cli-win32-i686-2.33.1.tgz", + "integrity": "sha512-F7cJySvkpzIu7fnLKNHYwBzZYYwlhoDbAUnaFX0UZCN+5DNp/5LwTp37a5TWOsmCaHMZT4i9IO4SIsnNw16/zQ==", + "cpu": [ + "x86", + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-x64": { + "version": "2.33.1", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-x64/-/cli-win32-x64-2.33.1.tgz", + "integrity": "sha512-8VyRoJqtb2uQ8/bFRKNuACYZt7r+Xx0k2wXRGTyH05lCjAiVIXn7DiS2BxHFty7M1QEWUCMNsb/UC/x/Cu2wuA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, "node_modules/@sentry/core": { "version": "8.20.0", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.20.0.tgz", @@ -13985,6 +14122,44 @@ "tslib": "^2.0.3" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", @@ -16043,6 +16218,14 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "license": "MIT" }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/promise": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/promise/-/promise-8.3.0.tgz", @@ -16111,6 +16294,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", @@ -16232,10 +16420,9 @@ } }, "node_modules/react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", - "license": "MIT", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "dependencies": { "loose-envify": "^1.1.0" }, @@ -16380,16 +16567,15 @@ } }, "node_modules/react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", - "license": "MIT", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "dependencies": { "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" + "scheduler": "^0.23.2" }, "peerDependencies": { - "react": "^18.2.0" + "react": "^18.3.1" } }, "node_modules/react-dom-factories": { @@ -17407,10 +17593,9 @@ } }, "node_modules/scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", - "license": "MIT", + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", "dependencies": { "loose-envify": "^1.1.0" } diff --git a/frontend/package.json b/frontend/package.json index 6f30a419..43938a19 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -28,9 +28,9 @@ "jose": "^4.11.1", "json-schema": "^0.3.0", "json2csv": "^5.0.6", - "react": "^18.2.0", + "react": "^18.3.1", "react-bootstrap": "^1.5.2", - "react-dom": "^18.2.0", + "react-dom": "^18.3.1", "react-icons": "^5.0.1", "react-json-schema": "^1.2.2", "react-jsonschema-form": "^1.8.1", @@ -109,4 +109,4 @@ "autoprefixer": "10.4.5", "postcss-preset-env": "7.4.4" } -} \ No newline at end of file +} diff --git a/frontend/src/Routes.tsx b/frontend/src/Routes.tsx index 1f13ec9d..b2f7b4b0 100644 --- a/frontend/src/Routes.tsx +++ b/frontend/src/Routes.tsx @@ -13,6 +13,7 @@ import MealDonationForm from "./components/meal_donor/donation_form/MealDonation import * as Paths from "./constants/Routes"; import Dashboard from "./pages/ASPDashboard"; import MealDonorCalendar from "./pages/MealDonorCalendar"; +import MealDonorConfirmation from "./pages/MealDonorConfirmation"; import MealDonorDashboard from "./pages/MealDonorDashboard"; import NotFound from "./pages/NotFound"; import OnboardingRequestsPage from "./pages/OnboardingRequestsPage"; @@ -57,6 +58,10 @@ const Routes = (): React.ReactElement => { path={Paths.MEAL_DONOR_UPCOMING_PAGE} element={} /> + } + /> } diff --git a/frontend/src/assets/confirmation.png b/frontend/src/assets/confirmation.png new file mode 100644 index 00000000..9b6ede1b Binary files /dev/null and b/frontend/src/assets/confirmation.png differ diff --git a/frontend/src/components/asp/requests/CreateMealRequest.tsx b/frontend/src/components/asp/requests/CreateMealRequest.tsx index 4e0e8e19..f27673d7 100644 --- a/frontend/src/components/asp/requests/CreateMealRequest.tsx +++ b/frontend/src/components/asp/requests/CreateMealRequest.tsx @@ -65,7 +65,6 @@ const CreateMealRequest = (): React.ReactElement => { Array(7).fill(false), ); - // TODO: once the last tab is reached, submit the form // Below is a way to get a list of days, i.e. the indexes of the true values in the boolean array const selectedDays = weekdayButtonStates .map((state, i) => (state ? i : -1)) diff --git a/frontend/src/components/asp/requests/SchedulingFormMealInfo.tsx b/frontend/src/components/asp/requests/SchedulingFormMealInfo.tsx index 66a2850f..0e8af4d1 100644 --- a/frontend/src/components/asp/requests/SchedulingFormMealInfo.tsx +++ b/frontend/src/components/asp/requests/SchedulingFormMealInfo.tsx @@ -186,7 +186,7 @@ const SchedulingFormMealInfo: React.FunctionComponent diff --git a/frontend/src/components/asp/requests/SchedulingFormReviewAndSubmit.tsx b/frontend/src/components/asp/requests/SchedulingFormReviewAndSubmit.tsx index e34bbe0a..94b82ff4 100644 --- a/frontend/src/components/asp/requests/SchedulingFormReviewAndSubmit.tsx +++ b/frontend/src/components/asp/requests/SchedulingFormReviewAndSubmit.tsx @@ -1,4 +1,4 @@ -import { gql, useMutation } from "@apollo/client"; +import { gql, useApolloClient, useMutation } from "@apollo/client"; import { Box, Button, @@ -103,6 +103,8 @@ const SchedulingFormReviewAndSubmit: React.FunctionComponent ( -
- ( +
+ + - - {title} - - - - {description} - - -
- ); + {title} + +
+
+); export default TitleSection; diff --git a/frontend/src/components/common/MealRequestCalendarView.tsx b/frontend/src/components/common/MealRequestCalendarView.tsx index 3abbc612..bb1080d0 100644 --- a/frontend/src/components/common/MealRequestCalendarView.tsx +++ b/frontend/src/components/common/MealRequestCalendarView.tsx @@ -40,9 +40,6 @@ import { ErrorMessage } from "../../utils/ErrorUtils"; import { logPossibleGraphQLError } from "../../utils/GraphQLUtils"; import BackgroundImage from "../assets/background.png"; -type ButtonProps = { text: string; path: string }; -type SchoolSidebarProps = { aspId: string; distance: string }; - const GET_MEAL_REQUESTS_BY_ID = gql` query GetMealRequestsByRequestorId( $requestorId: ID! diff --git a/frontend/src/components/donor/NearbySchoolList.tsx b/frontend/src/components/donor/NearbySchoolList.tsx index 0592c65d..b9761ca3 100644 --- a/frontend/src/components/donor/NearbySchoolList.tsx +++ b/frontend/src/components/donor/NearbySchoolList.tsx @@ -53,8 +53,8 @@ const NearbySchoolList = ({ Partner with a school in your community that aligns with your - donation preferences. Only showing schools that are within 100km of - your location and have open meal requests within the next 3 months. + donation preferences. These schools are within 100 km of your + location and have open meal requests within the next 3 months. @@ -68,65 +68,71 @@ const NearbySchoolList = ({ height={{ base: undefined, xl: "80vh" }} width="100%" > - {schools.map((school) => ( - - + No schools available + + ) : ( + schools.map((school) => ( + - {school?.info?.organizationName} - + + {school?.info?.organizationName} + - -
- - {school?.distance} km away - - {school?.info?.organizationName} - - - - - {school?.info?.roleInfo.aspInfo?.numKids} children + +
+ + {school?.distance} km away + + {school?.info?.organizationName} + + + + + {school?.info?.roleInfo.aspInfo?.numKids} children + + + + - - - - -
-
- - ))} +
+
+
+ )) + )} { const location = useLocation(); const searchParams = new URLSearchParams(location.search); const idsParam = searchParams.get("ids"); + const aspId = searchParams.get("aspId"); // Split the idsParam by dot to get an array of ids const ids = idsParam ? idsParam.split(",") : []; @@ -191,6 +192,7 @@ const MealDonationForm = (): React.ReactElement => { onsiteContact={onsiteContacts} requestorId={requestorId} primaryContact={primaryContact} + aspId={aspId || ""} handleBack={() => {}} // Leave like this, gets updated by three-step form /> } diff --git a/frontend/src/components/meal_donor/donation_form/MealDonationFormReviewAndSubmit.tsx b/frontend/src/components/meal_donor/donation_form/MealDonationFormReviewAndSubmit.tsx index 0b6eed6d..e48f6d76 100644 --- a/frontend/src/components/meal_donor/donation_form/MealDonationFormReviewAndSubmit.tsx +++ b/frontend/src/components/meal_donor/donation_form/MealDonationFormReviewAndSubmit.tsx @@ -1,4 +1,4 @@ -import { gql, useMutation } from "@apollo/client"; +import { gql, useApolloClient, useMutation } from "@apollo/client"; import { Box, Button, @@ -31,12 +31,15 @@ import { useNavigate } from "react-router-dom"; import MealDeliveryDetails from "./MealDeliveryDetails"; + +import * as Routes from "../../../constants/Routes"; import { MEAL_DONOR_DASHBOARD_PAGE } from "../../../constants/Routes"; import AuthContext from "../../../contexts/AuthContext"; import { MealRequest } from "../../../types/MealRequestTypes"; import { Contact, OnsiteContact } from "../../../types/UserTypes"; import { logPossibleGraphQLError } from "../../../utils/GraphQLUtils"; import { useGetDefaultPageForUser } from "../../../utils/useGetDefaultPageForUser"; +import useIsMealDonor from "../../../utils/useIsMealDonor"; import OnsiteContactSection from "../../common/OnsiteContactSection"; // Create the GraphQL mutation @@ -75,6 +78,7 @@ type MealDonationFormReviewAndSubmitProps = { // Other required data requestorId: string; primaryContact: Contact; + aspId: string; // Switch tabs handleBack: () => void; @@ -87,6 +91,7 @@ const MealDonationFormReviewAndSubmit: React.FunctionComponent { const [commitToMealRequest] = useMutation<{ @@ -98,7 +103,9 @@ const MealDonationFormReviewAndSubmit: React.FunctionComponent { await setIsSubmitLoading(true); @@ -123,7 +130,17 @@ const MealDonationFormReviewAndSubmit: React.FunctionComponent { } function formatDate(inputDate: string): string { - const date = new Date(inputDate); + const date = new Date(inputDate + "Z"); return date.toDateString(); } @@ -191,10 +191,13 @@ const ASPCalendar = ({ authId }: ASPCalendarProps) => { {currentlyEditingMealRequestId ? ( { + onClose={(meal_request) => { setIsEditModalOpen(false); setCurrentlyEditingMealRequestId(undefined); setShouldRefetchData(true); + if (meal_request !== undefined) { + setSelectedMealRequest(meal_request); + } }} mealRequestId={currentlyEditingMealRequestId} isEditDonation={false} @@ -390,7 +393,7 @@ const ASPCalendar = ({ authId }: ASPCalendarProps) => { - Meal Donor not found yet + No committed meal donor diff --git a/frontend/src/pages/EditMealRequestForm.tsx b/frontend/src/pages/EditMealRequestForm.tsx index a3bafe92..0eec9d1d 100644 --- a/frontend/src/pages/EditMealRequestForm.tsx +++ b/frontend/src/pages/EditMealRequestForm.tsx @@ -30,7 +30,7 @@ import React, { useContext, useEffect, useState } from "react"; import LoadingSpinner from "../components/common/LoadingSpinner"; import OnsiteContactsSection from "../components/common/OnsiteContactSection"; import AuthContext from "../contexts/AuthContext"; -import { MealRequestsData } from "../types/MealRequestTypes"; +import { MealRequest, MealRequestsData } from "../types/MealRequestTypes"; import { Contact, OnsiteContact } from "../types/UserTypes"; import { logPossibleGraphQLError } from "../utils/GraphQLUtils"; import useGetOnsiteContacts from "../utils/useGetOnsiteContacts"; @@ -181,7 +181,7 @@ const EditMealRequestForm = ({ isEditDonation, }: { open: boolean; - onClose: () => void; + onClose: (meal_request : MealRequest | undefined) => void; mealRequestId: string; isEditDonation: boolean; }) => { @@ -263,8 +263,8 @@ const EditMealRequestForm = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [requestorId, mealRequestId, apolloClient]); - const [updateMealRequest] = useMutation(UPDATE_MEAL_REQUEST); - const [updateMealDonation] = useMutation(UPDATE_MEAL_DONATION); + const [updateMealRequest] = useMutation(UPDATE_MEAL_REQUEST); + const [updateMealDonation] = useMutation(UPDATE_MEAL_DONATION); // For validation const validateData = () => { @@ -328,6 +328,7 @@ const EditMealRequestForm = ({ throw new GraphQLError("Failed to update meal request."); } setLoading(false); + onClose(data.updateMealRequest.mealRequest); } catch (e: unknown) { // eslint-disable-next-line no-console logPossibleGraphQLError(e as ApolloError, setAuthenticatedUser); @@ -337,8 +338,8 @@ const EditMealRequestForm = ({ isClosable: true, }); setLoading(false); + onClose(undefined); } - onClose(); } async function submitEditMealDonation() { @@ -376,6 +377,7 @@ const EditMealRequestForm = ({ throw new GraphQLError("Failed to update meal donation information."); } setLoading(false); + onClose(data.updateMealDonation.mealRequest); } catch (e: unknown) { // eslint-disable-next-line no-console logPossibleGraphQLError(e as ApolloError, setAuthenticatedUser); @@ -385,13 +387,13 @@ const EditMealRequestForm = ({ isClosable: true, }); setLoading(false); + onClose(undefined); } - onClose(); } if (isEditDonation) { return ( - + onClose(undefined)}> - + + + + + + ) : ( + + +
+ Confirmation +
+
+ + + + Care Kids ❤️ Swiss Chalet Ottawa! + + + Thank you Swiss Chalet Ottawa for contributing to Care Kid's + mission to provide hot meals to kids! We've got over{" "} + 80 hungry kiddos here, and your generosity has seriously made + a huge difference in their lives. You didn't just fill their + tummies; you put smiles on their faces. Thanks a million for being + awesome and helping us out – we truly appreciate it! + +
+ +
+
+
+
+ )} + + ); +}; + +export default MealDonorConfirmation; diff --git a/frontend/src/pages/OnboardingRequestsPage.tsx b/frontend/src/pages/OnboardingRequestsPage.tsx index 741dd185..a8107e34 100644 --- a/frontend/src/pages/OnboardingRequestsPage.tsx +++ b/frontend/src/pages/OnboardingRequestsPage.tsx @@ -352,12 +352,6 @@ const ASPCard = ({ Number of Kids {onboardingRequest?.info?.roleInfo?.aspInfo?.numKids} - - - - Dietary Restrictions - TODO: ADD DIET HERE - )} {onboardingRequest?.status === OnboardingRequestStatuses.PENDING ? ( @@ -531,14 +525,7 @@ const OnboardingRequestsPage = (): React.ReactElement => { const getTitleSection = (): React.ReactElement => ( - + diff --git a/frontend/src/pages/Settings.tsx b/frontend/src/pages/Settings.tsx index 020f7eac..6766f375 100644 --- a/frontend/src/pages/Settings.tsx +++ b/frontend/src/pages/Settings.tsx @@ -8,7 +8,7 @@ create should be working work on other pages as well */ -import { ApolloError, gql, useMutation, useQuery } from "@apollo/client"; +import { ApolloError, gql, useApolloClient, useMutation, useQuery } from "@apollo/client"; import { Button, Center, @@ -244,6 +244,8 @@ const Settings = (): React.ReactElement => { forgotPassword, { loading: forgotPasswordLoading }, ] = useMutation(FORGOT_PASSWORD); + + const apolloClient = useApolloClient(); // OnsiteContact query @@ -754,6 +756,7 @@ const Settings = (): React.ReactElement => { requestOnsiteContacts.map((obj) => JSON.parse(JSON.stringify(obj))), ); setIsLoading(false); + apolloClient.cache.evict({ fieldName: "getOnsiteContactForUserById" }); } catch (e: unknown) { logPossibleGraphQLError(e as ApolloError, setAuthenticatedUser); setIsLoading(false); diff --git a/frontend/src/types/MealRequestTypes.ts b/frontend/src/types/MealRequestTypes.ts index 63ec7974..f011cf17 100644 --- a/frontend/src/types/MealRequestTypes.ts +++ b/frontend/src/types/MealRequestTypes.ts @@ -57,9 +57,15 @@ export type MealRequestsDonorVariables = { sortByDateDirection?: SortByDateDirection; }; +type UpdateMealRequestType = { + mealRequest : MealRequest +} + export type MealRequestsData = { getMealRequestsByRequestorId: Array; getMealRequestById: MealRequest; getMealRequestsByIds: Array; getMealRequestsByDonorId: Array; + updateMealRequest: UpdateMealRequestType; + updateMealDonation: UpdateMealRequestType; }; diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 7094230d..b2020900 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -2813,45 +2813,45 @@ "@sentry/types" "8.20.0" "@sentry/utils" "8.20.0" -"@sentry/cli-darwin@2.33.0": - version "2.33.0" - resolved "https://registry.yarnpkg.com/@sentry/cli-darwin/-/cli-darwin-2.33.0.tgz#c0f3352a9e58e4f02deca52f0d5a9bd14b3e4a32" - integrity sha512-LQFvD7uCOQ2P/vYru7IBKqJDHwJ9Rr2vqqkdjbxe2YCQS/N3NPXvi3eVM9hDJ284oyV/BMZ5lrmVTuIicf/hhw== - -"@sentry/cli-linux-arm64@2.33.0": - version "2.33.0" - resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.33.0.tgz#14bc2556aa1011b96e7964756f84c4215a087ea7" - integrity sha512-mR2ZhqpU8RBVGLF5Ji19iOmVznk1B7Bzg5VhA8bVPuKsQmFN/3SyqE87IPMhwKoAsSRXyctwmbAkKs4240fxGA== - -"@sentry/cli-linux-arm@2.33.0": - version "2.33.0" - resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-2.33.0.tgz#e00f9698b6c79e064490a32d11ad7d1909a15314" - integrity sha512-gY1bFE7wjDJc7WiNq1AS0WrILqLLJUw6Ou4pFQS45KjaH3/XJ1eohHhGJNy/UBHJ/Gq32b/BA9vsnWTXClZJ7g== - -"@sentry/cli-linux-i686@2.33.0": - version "2.33.0" - resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-2.33.0.tgz#f2475caa9897067f25114aa368e6b3ac11c86652" - integrity sha512-XPIy0XpqgAposHtWsy58qsX85QnZ8q0ktBuT4skrsCrLMzfhoQg4Ua+YbUr3RvE814Rt8Hzowx2ar2Rl3pyCyw== - -"@sentry/cli-linux-x64@2.33.0": - version "2.33.0" - resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-2.33.0.tgz#181936a6f37dd237a2f867c11244b26e2d58d5fa" - integrity sha512-qe1DdCUv4tmqS03s8RtCkEX9vCW2G+NgOxX6jZ5jN/sKDwjUlquljqo7JHUGSupkoXmymnNPm5By3rNr6VyNHg== - -"@sentry/cli-win32-i686@2.33.0": - version "2.33.0" - resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-2.33.0.tgz#3ab02ea0ef159a801701d41e0a16f52d4e751cdb" - integrity sha512-VEXWtJ69C3b+kuSmXQJRwdQ0ypPGH88hpqyQuosbAOIqh/sv4g9B/u1ETHZc+whLdFDpPcTLVMbLDbXTGug0Yg== - -"@sentry/cli-win32-x64@2.33.0": - version "2.33.0" - resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-2.33.0.tgz#fc9ec9b7cbec80d7cd39aaa570b7682399a0b1de" - integrity sha512-GIUKysZ1xbSklY9h1aVaLMSYLsnMSd+JuwQLR+0wKw2wJC4O5kNCPFSGikhiOZM/kvh3GO1WnXNyazFp8nLAzw== +"@sentry/cli-darwin@2.33.1": + version "2.33.1" + resolved "https://registry.npmjs.org/@sentry/cli-darwin/-/cli-darwin-2.33.1.tgz" + integrity sha512-+4/VIx/E1L2hChj5nGf5MHyEPHUNHJ/HoG5RY+B+vyEutGily1c1+DM2bum7RbD0xs6wKLIyup5F02guzSzG8A== + +"@sentry/cli-linux-arm64@2.33.1": + version "2.33.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.33.1.tgz#9ea1718c21ef32ca83b0852ca29fb461fd26d25a" + integrity sha512-DbGV56PRKOLsAZJX27Jt2uZ11QfQEMmWB4cIvxkKcFVE+LJP4MVA+MGGRUL6p+Bs1R9ZUuGbpKGtj0JiG6CoXw== + +"@sentry/cli-linux-arm@2.33.1": + version "2.33.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-2.33.1.tgz#e8a1dca4d008dd6a72ab5935304c104e98e2901c" + integrity sha512-zbxEvQju+tgNvzTOt635le4kS/Fbm2XC2RtYbCTs034Vb8xjrAxLnK0z1bQnStUV8BkeBHtsNVrG+NSQDym2wg== + +"@sentry/cli-linux-i686@2.33.1": + version "2.33.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-2.33.1.tgz#f1fe8dd4d6dde0812a94fba31de8054ddfb7284a" + integrity sha512-g2LS4oPXkPWOfKWukKzYp4FnXVRRSwBxhuQ9eSw2peeb58ZIObr4YKGOA/8HJRGkooBJIKGaAR2mH2Pk1TKaiA== + +"@sentry/cli-linux-x64@2.33.1": + version "2.33.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-2.33.1.tgz#6e086675356a9eb79731bf9e447d078bae1b5adf" + integrity sha512-IV3dcYV/ZcvO+VGu9U6kuxSdbsV2kzxaBwWUQxtzxJ+cOa7J8Hn1t0koKGtU53JVZNBa06qJWIcqgl4/pCuKIg== + +"@sentry/cli-win32-i686@2.33.1": + version "2.33.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-2.33.1.tgz#0e6b36c4a2f5f6e85a59247a123d276b3ef10f1a" + integrity sha512-F7cJySvkpzIu7fnLKNHYwBzZYYwlhoDbAUnaFX0UZCN+5DNp/5LwTp37a5TWOsmCaHMZT4i9IO4SIsnNw16/zQ== + +"@sentry/cli-win32-x64@2.33.1": + version "2.33.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-2.33.1.tgz#2d00b38a2dd9f3355df91825582ada3ea0034e86" + integrity sha512-8VyRoJqtb2uQ8/bFRKNuACYZt7r+Xx0k2wXRGTyH05lCjAiVIXn7DiS2BxHFty7M1QEWUCMNsb/UC/x/Cu2wuA== "@sentry/cli@^2.33.0": - version "2.33.0" - resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-2.33.0.tgz#5de59f829070ab20d360fae25924f39c55afd8ba" - integrity sha512-9MOzQy1UunVBhPOfEuO0JH2ofWAMmZVavTTR/Bo2CkJwI1qjyVF0UKLTXE3l4ujiJnFufOoBsVyKmYWXFerbCw== + version "2.33.1" + resolved "https://registry.npmjs.org/@sentry/cli/-/cli-2.33.1.tgz" + integrity sha512-dUlZ4EFh98VFRPJ+f6OW3JEYQ7VvqGNMa0AMcmvk07ePNeK/GicAWmSQE4ZfJTTl80ul6HZw1kY01fGQOQlVRA== dependencies: https-proxy-agent "^5.0.0" node-fetch "^2.6.7" @@ -2859,13 +2859,13 @@ proxy-from-env "^1.1.0" which "^2.0.2" optionalDependencies: - "@sentry/cli-darwin" "2.33.0" - "@sentry/cli-linux-arm" "2.33.0" - "@sentry/cli-linux-arm64" "2.33.0" - "@sentry/cli-linux-i686" "2.33.0" - "@sentry/cli-linux-x64" "2.33.0" - "@sentry/cli-win32-i686" "2.33.0" - "@sentry/cli-win32-x64" "2.33.0" + "@sentry/cli-darwin" "2.33.1" + "@sentry/cli-linux-arm" "2.33.1" + "@sentry/cli-linux-arm64" "2.33.1" + "@sentry/cli-linux-i686" "2.33.1" + "@sentry/cli-linux-x64" "2.33.1" + "@sentry/cli-win32-i686" "2.33.1" + "@sentry/cli-win32-x64" "2.33.1" "@sentry/core@8.20.0": version "8.20.0" @@ -8118,7 +8118,7 @@ no-case@^3.0.4: node-fetch@^2.6.7: version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: whatwg-url "^5.0.0" @@ -9138,7 +9138,7 @@ process-nextick-args@~2.0.0: progress@^2.0.3: version "2.0.3" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== promise@^8.0.3, promise@^8.1.0: @@ -9183,7 +9183,7 @@ proxy-addr@~2.0.7: proxy-from-env@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + resolved "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== psl@^1.1.33: @@ -9347,13 +9347,13 @@ react-dom-factories@^1.0.2: resolved "https://registry.npmjs.org/react-dom-factories/-/react-dom-factories-1.0.2.tgz" integrity sha512-Bmic2N3oKji7vw9qjDr2dmwHvOATbFSnKy7EH0uT/qjvzIUsiXp6Yquk72LJ3WfMtRnq3ujXMMo7GsJeLPfFWw== -react-dom@^18.2.0: - version "18.2.0" - resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz" - integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== +react-dom@^18.3.1: + version "18.3.1" + resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz" + integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== dependencies: loose-envify "^1.1.0" - scheduler "^0.23.0" + scheduler "^0.23.2" react-element-popper@^2.1.6: version "2.1.6" @@ -9600,10 +9600,10 @@ react-window@1.8.7: "@babel/runtime" "^7.0.0" memoize-one ">=3.1.1 <6" -react@^18.2.0: - version "18.2.0" - resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz" - integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== +react@^18.3.1: + version "18.3.1" + resolved "https://registry.npmjs.org/react/-/react-18.3.1.tgz" + integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ== dependencies: loose-envify "^1.1.0" @@ -9897,10 +9897,10 @@ saxes@^5.0.1: dependencies: xmlchars "^2.2.0" -scheduler@^0.23.0: - version "0.23.0" - resolved "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz" - integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== +scheduler@^0.23.0, scheduler@^0.23.2: + version "0.23.2" + resolved "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz" + integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ== dependencies: loose-envify "^1.1.0" @@ -10605,7 +10605,7 @@ tr46@^2.1.0: tr46@~0.0.3: version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== tryer@^1.0.1: @@ -10943,7 +10943,7 @@ web-vitals@^1.0.1: webidl-conversions@^3.0.0: version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== webidl-conversions@^4.0.2: @@ -11100,7 +11100,7 @@ whatwg-mimetype@^2.3.0: whatwg-url@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== dependencies: tr46 "~0.0.3"