diff --git a/src/Components/CareRequestForm/CareRequestForm.js b/src/Components/CareRequestForm/CareRequestForm.js index 45996a6..fa5b385 100644 --- a/src/Components/CareRequestForm/CareRequestForm.js +++ b/src/Components/CareRequestForm/CareRequestForm.js @@ -1,14 +1,17 @@ import React, { useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import '../CareRequestForm/CareRequestForm.scss'; +import '../CareRequestForm/CareRequestForm.scss'; +import { useMutation } from '@apollo/client'; +import { CREATE_AID_REQUEST } from '../../apollo-client/mutations'; -function CareRequestForm() { - const navigate = useNavigate(); - const [formData, setFormData] = useState({ - aidType: '', - description: '', - // more fields ? - }); + function CareRequestForm({ organizationId }) { + const navigate = useNavigate(); + const [formData, setFormData] = useState({ + aidType: '', + description: '', + }); + + const [createAidRequest, { loading, error }] = useMutation(CREATE_AID_REQUEST); const handleChange = (e) => { const { name, value } = e.target; @@ -19,14 +22,17 @@ function CareRequestForm() { }; const handleSubmit = (e) => { - e.preventDefault(); - // Here we should add the logic to send data to the server - // For now, we'll just log the formData and navigate to a different page - console.log(formData); - - // After submitting, navigate to a different page, mayby the dashboard or a success page? - navigate('/success'); - }; + e.preventDefault(); + createAidRequest({ variables: { ...formData, organizationId } }) + .then(() => { + navigate('/organization-dashboard'); + }) + .catch((err) => { + console.error('Error creating aid request:', err); + alert('Failed to create aid request. Please try again.'); + }); + }; + return (
diff --git a/src/Components/Homepage/Homepage.js b/src/Components/Homepage/Homepage.js index 3986d06..678a9e1 100644 --- a/src/Components/Homepage/Homepage.js +++ b/src/Components/Homepage/Homepage.js @@ -54,9 +54,9 @@ function Homepage() {

Our Mission

-

Our mission at Refuge is to ensure that refugees, asylum seekers, and migrants, wherever they may be, have access to trusted services and accurate information right at their fingertips.

+

Our mission at Refugee Aid is to ensure that refugees, asylum seekers, and migrants, wherever they may be, have access to trusted services and accurate information right at their fingertips.

Article 14 of the UN Declaration of Human Rights promises that all individuals have "the right to seek and enjoy asylum from persecution in other countries."

-

At Refuge, we are dedicated to helping people realize and exercise this right, no matter where they are in their journey.

+

At Refugee Aid, we are dedicated to helping people realize and exercise this right, no matter where they are in their journey.

We do everything within our power and capabilities to transform the fear in the hearts of those in need into hope.

{!showVideo && (
diff --git a/src/Components/NavBar/NavBar.js b/src/Components/NavBar/NavBar.js index 271794b..42c18a8 100644 --- a/src/Components/NavBar/NavBar.js +++ b/src/Components/NavBar/NavBar.js @@ -1,6 +1,6 @@ import { useState } from 'react'; import { NavLink } from 'react-router-dom'; -import logoImage from '../../images/refuge.png'; +import logoImage from '../../images/refugee-aid.PNG'; import './NavBar.scss'; import PropTypes from 'prop-types'; diff --git a/src/Components/NavBar/NavBar.scss b/src/Components/NavBar/NavBar.scss index 9ce1d2b..a27df08 100644 --- a/src/Components/NavBar/NavBar.scss +++ b/src/Components/NavBar/NavBar.scss @@ -36,6 +36,7 @@ body { transition: transform 0.3s ease; position: relative; top: -7px; + border-radius: 50%; &:hover { transform: scale(1.3); diff --git a/src/apollo-client/mutations.js b/src/apollo-client/mutations.js index e08f0c2..c430472 100644 --- a/src/apollo-client/mutations.js +++ b/src/apollo-client/mutations.js @@ -12,3 +12,17 @@ export const UPDATE_AID_REQUEST = gql` } } `; + +export const CREATE_AID_REQUEST = gql` + mutation createAidRequest($aidType: String!, $description: String!, $organizationId: ID!) { + createAidRequest(aidType: $aidType, description: $description, organizationId: $organizationId) { + id + aidType + description + organization { + id + name + } + } + } +`; diff --git a/src/images/refugee-aid.PNG b/src/images/refugee-aid.PNG new file mode 100644 index 0000000..76ce6f4 Binary files /dev/null and b/src/images/refugee-aid.PNG differ