Cart fixes (backend), adjusted header, added footer, mobile formatting updates

This commit is contained in:
augmentedpotato
2026-04-14 05:24:40 -06:00
parent 5bd1933ea6
commit 4c3c11995a
14 changed files with 776 additions and 107 deletions

View File

@@ -15,7 +15,6 @@ export default function AdoptPage() {
const [pets, setPets] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [health, setHealth] = useState(null);
const [search, setSearch] = useState("");
const [query, setQuery] = useState("");
@@ -26,16 +25,9 @@ export default function AdoptPage() {
// Species options come from a dedicated fetch (only store-filtered, no species filter)
const [speciesOptions, setSpeciesOptions] = useState([]);
// ---------- health check ----------
useEffect(() => {
fetch(`${API_BASE}/api/v1/health`)
.then((res) => (res.ok ? setHealth("online") : setHealth("error")))
.catch(() => setHealth("offline"));
}, []);
useEffect(() => {
setSelectedSpecies("");
const params = new URLSearchParams({ status: "Available", page: "0", size: String(PAGE_SIZE) });
const params = new URLSearchParams({ page: "0", size: String(PAGE_SIZE) });
if (selectedStoreId) params.set("storeId", String(selectedStoreId));
fetch(`${API_BASE}/api/v1/pets?${params}`)
@@ -62,7 +54,6 @@ export default function AdoptPage() {
page: String(page),
size: String(PAGE_SIZE),
sort: "id,asc",
status: "Available",
});
if (query) params.set("q", query);
if (selectedSpecies) params.set("species", selectedSpecies);
@@ -161,15 +152,6 @@ export default function AdoptPage() {
Clear Filters
</button>
)}
<span
className={`backend-status backend-status--${health ?? "checking"}`}
title={
health === "online" ? "Backend online" :
health === "offline" ? "Backend offline" :
health === "error" ? "Backend error" : "Checking…"
}
/>
</div>
</section>
@@ -180,13 +162,7 @@ export default function AdoptPage() {
<div className="adopt-error-box">
<p className="adopt-error-title">Failed to load pets</p>
<code className="adopt-error-detail">{error}</code>
<p className="adopt-error-hint">
{health === "offline"
? "The Spring Boot backend is not reachable. Make sure it is running in IntelliJ on port 8080."
: health === "error"
? "The backend responded with an error. Check the IntelliJ Run console for stack traces."
: "The backend is reachable but the /pets endpoint failed. Check the IntelliJ Run console."}
</p>
<p className="adopt-error-hint">Make sure the backend is running and try again.</p>
</div>
)}