diff --git a/backend/__pycache__/utils.cpython-311.pyc b/backend/__pycache__/utils.cpython-311.pyc index ce4b1eb..30a1767 100644 Binary files a/backend/__pycache__/utils.cpython-311.pyc and b/backend/__pycache__/utils.cpython-311.pyc differ diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 8c985ba..1bb4c94 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -15,6 +15,7 @@ import AllApplicantsPage from "./pages/AllApplicantsPage"; import PetCreatePage from "./pages/PetCreatePage"; import ApplicantDetailPage from "./pages/ApplicantDetailPage"; import { JSX } from "react"; +import ApplicantsPage from "./pages/AllApplicantsPage"; function ProtectedRoute({ children }: { children: JSX.Element }) { const isLoggedIn = localStorage.getItem("loggedIn") === "true"; @@ -50,6 +51,7 @@ export default function App() { } /> } /> } /> + } /> } /> diff --git a/frontend/src/components/PAOLayout.tsx b/frontend/src/components/PAOLayout.tsx index 587ff8c..857b986 100644 --- a/frontend/src/components/PAOLayout.tsx +++ b/frontend/src/components/PAOLayout.tsx @@ -16,8 +16,6 @@ export default function PAOLayout() { {menuOpen && (
- - diff --git a/frontend/src/pages/AllApplicantsPage.tsx b/frontend/src/pages/AllApplicantsPage.tsx index 0f9ec75..47628dd 100644 --- a/frontend/src/pages/AllApplicantsPage.tsx +++ b/frontend/src/pages/AllApplicantsPage.tsx @@ -1,75 +1,60 @@ -import React, { useEffect, useState } from "react"; -import { useNavigate, useParams } from "react-router-dom"; +import { useEffect, useState } from "react"; +import { useNavigate } from "react-router-dom"; type Applicant = { + id: number; name: string; + location: string; + email: string; reason: string; + care: string; + home: string; + pet_id: number; }; -export default function ApplicantsPage() { - const { id } = useParams(); - const navigate = useNavigate(); +export default function AllApplicantsPage() { const [applicants, setApplicants] = useState([]); - const [menuOpen, setMenuOpen] = useState(true); + const navigate = useNavigate(); useEffect(() => { - fetch(`http://localhost:5000/api/pets/${id}/applicants`) + fetch("http://localhost:5000/api/applicants") .then(res => res.json()) .then(data => setApplicants(data)) - .catch(err => console.error("Failed to load applicants:", err)); - }, [id]); + .catch(err => console.error("Error loading applicants:", err)); + }, []); return ( -
- {/* Sidebar */} -
-
setMenuOpen(!menuOpen)} - > - ☰ -
- {menuOpen && ( -
- - - +
+

All Adoption Applicants

+
+ {applicants.map(app => ( +
+

{app.name}, {app.location}

+

Email: {app.email}

+

Reason: {app.reason}

+
- )} -
- - {/* Main View */} -
-

Applicants for Pet ID: {id}

- {applicants.length === 0 ? ( -

No applications yet.

- ) : ( -
    - {applicants.map((app, idx) => ( -
  • - {app.name} — {app.reason} -
  • - ))} -
- )} + ))}
); } - -const menuBtn: React.CSSProperties = { - background: "#555", - border: "none", - color: "white", - padding: "0.5rem 1rem", - textAlign: "left", - cursor: "pointer", - borderRadius: "4px" -}; diff --git a/frontend/src/pages/ApplicantsPage.tsx b/frontend/src/pages/ApplicantsPage.tsx deleted file mode 100644 index da2ce31..0000000 --- a/frontend/src/pages/ApplicantsPage.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import React, { useEffect, useState } from "react"; -import { useParams } from "react-router-dom"; - -type Applicant = { - name: string; - reason: string; -}; - -export default function ApplicantsPage() { - const { id } = useParams(); - const [applicants, setApplicants] = useState([]); - - useEffect(() => { - fetch(`http://localhost:5000/api/pets/${id}/applicants`) - .then(res => res.json()) - .then(data => setApplicants(data)); - }, [id]); - - return ( -
-

Applicants for Pet ID: {id}

- {applicants.length === 0 ? ( -

No applications yet.

- ) : ( -
    - {applicants.map((app, idx) => ( -
  • - {app.name} — {app.reason} -
  • - ))} -
- )} -
- ); -}