diff --git a/.gitignore b/.gitignore index 0d46e7cf5..7c69e53d7 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,5 @@ Thumbs.db *.env *.env.* !.env.example + +vite.config.*.timestamp* \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 9481e77ed..e26f0b3f7 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,5 @@ # Add files here to ignore them from prettier formatting /dist -/coverage \ No newline at end of file +/coverage +/.nx/cache +/.nx/workspace-data \ No newline at end of file diff --git a/apps/backend/project.json b/apps/backend/project.json index fdcdef2c6..9e8aeb44d 100644 --- a/apps/backend/project.json +++ b/apps/backend/project.json @@ -3,6 +3,7 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "apps/backend/src", "projectType": "application", + "tags": [], "targets": { "build": { "executor": "@nx/webpack:webpack", @@ -39,7 +40,7 @@ } }, "lint": { - "executor": "@nx/linter:eslint", + "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": ["apps/backend/**/*.ts"] @@ -67,6 +68,5 @@ "forwardAllArgs": false } } - }, - "tags": [] + } } diff --git a/apps/frontend/.eslintrc.json b/apps/frontend/.eslintrc.json index a39ac5d05..9ad716b6b 100644 --- a/apps/frontend/.eslintrc.json +++ b/apps/frontend/.eslintrc.json @@ -1,6 +1,10 @@ { "extends": ["plugin:@nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], + "ignorePatterns": [ + "!**/*", + "**/vite.config.*.timestamp*", + "**/vitest.config.*.timestamp*" + ], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/apps/frontend/project.json b/apps/frontend/project.json index 28802cc86..8647692ab 100644 --- a/apps/frontend/project.json +++ b/apps/frontend/project.json @@ -3,6 +3,7 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "apps/frontend/src", "projectType": "application", + "tags": [], "targets": { "build": { "executor": "@nx/vite:build", @@ -54,7 +55,7 @@ } }, "test": { - "executor": "@nx/vite:test", + "executor": "@nx/vitest:test", "outputs": ["{options.reportsDirectory}"], "options": { "passWithNoTests": true, @@ -62,7 +63,7 @@ } }, "lint": { - "executor": "@nx/linter:eslint", + "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": ["apps/frontend/**/*.{ts,tsx,js,jsx}"] @@ -82,6 +83,5 @@ "forwardAllArgs": false } } - }, - "tags": [] + } } diff --git a/apps/frontend/src/app.tsx b/apps/frontend/src/app.tsx index bdeddb963..62fb319d2 100644 --- a/apps/frontend/src/app.tsx +++ b/apps/frontend/src/app.tsx @@ -7,7 +7,7 @@ import PantryPastOrders from '@containers/pantryPastOrders'; import Pantries from '@containers/pantries'; import Orders from '@containers/orders'; import PantryDashboard from '@containers/pantryDashboard'; -import { submitFoodRequestFormModal } from '@components/forms/requestFormModal'; +import submitFoodRequestFormModal from '@components/forms/requestFormModal'; import { submitDeliveryConfirmationFormModal } from '@components/forms/deliveryConfirmationModal'; import FormRequests from '@containers/FormRequests'; import PantryApplication from '@containers/pantryApplication'; @@ -164,7 +164,7 @@ const router = createBrowserRouter([ loader: pantryIdLoader, }, { - path: '/donation-mangement', + path: '/donation-management', element: ( diff --git a/apps/frontend/src/components/forms/requestFormModal.tsx b/apps/frontend/src/components/forms/requestFormModal.tsx index f54e625ed..7f691fb80 100644 --- a/apps/frontend/src/components/forms/requestFormModal.tsx +++ b/apps/frontend/src/components/forms/requestFormModal.tsx @@ -11,15 +11,21 @@ import { Field, CloseButton, } from '@chakra-ui/react'; -import { Form, ActionFunction, ActionFunctionArgs } from 'react-router-dom'; -import { FoodRequest, FoodTypes, RequestSize } from '../../types/types'; +import { + CreateFoodRequestBody, + FoodRequest, + FoodTypes, + RequestSize, +} from '../../types/types'; import { ChevronDownIcon } from 'lucide-react'; +import apiClient from '@api/apiClient'; interface FoodRequestFormModalProps { previousRequest?: FoodRequest; isOpen: boolean; onClose: () => void; pantryId: number; + onSuccess: () => void; } const FoodRequestFormModal: React.FC = ({ @@ -27,6 +33,7 @@ const FoodRequestFormModal: React.FC = ({ isOpen, onClose, pantryId, + onSuccess, }) => { const [selectedItems, setSelectedItems] = useState([]); const [requestedSize, setRequestedSize] = useState(''); @@ -45,6 +52,26 @@ const FoodRequestFormModal: React.FC = ({ } }, [isOpen, previousRequest]); + const handleSubmit = async () => { + const foodRequestData: CreateFoodRequestBody = { + pantryId, + requestedSize: requestedSize as RequestSize, + requestedItems: selectedItems, + additionalInformation: additionalNotes || '', + dateReceived: null, + feedback: null, + photos: [], + }; + + try { + await apiClient.createFoodRequest(foodRequestData); + onClose(); + onSuccess(); + } catch (error) { + alert('Failed to submit request. Please try again.'); + } + }; + return ( = ({ : `Please keep in mind that we may not be able to accommodate specific food requests at all times, but we will do our best to match your preferences.`} -
{ - if (selectedItems.length === 0) { - e.preventDefault(); - alert('Please select at least one food type'); - } - if (requestedSize === '') { - e.preventDefault(); - alert('Please select a requested size.'); - } - }} - > - + Size of Shipment -