From a4a483161591639a4363ae48b344e6882a1c6a1e Mon Sep 17 00:00:00 2001 From: augmentedpotato Date: Tue, 14 Apr 2026 13:31:56 -0600 Subject: [PATCH] Removed addresses, adjusted contact page --- .../backend/controller/StoreController.java | 2 - .../backend/security/SecurityConfig.java | 1 + web/app/contact/page.js | 97 ++++++++++--------- web/app/globals.css | 35 ++++++- web/components/Footer.js | 1 - 5 files changed, 86 insertions(+), 50 deletions(-) diff --git a/backend/src/main/java/com/petshop/backend/controller/StoreController.java b/backend/src/main/java/com/petshop/backend/controller/StoreController.java index 0c4a70c0..7dfb2b01 100644 --- a/backend/src/main/java/com/petshop/backend/controller/StoreController.java +++ b/backend/src/main/java/com/petshop/backend/controller/StoreController.java @@ -23,7 +23,6 @@ public class StoreController { } @GetMapping - @PreAuthorize("isAuthenticated()") public ResponseEntity> getAllStores( @RequestParam(required = false) String q, Pageable pageable) { @@ -31,7 +30,6 @@ public class StoreController { } @GetMapping("/{id}") - @PreAuthorize("isAuthenticated()") public ResponseEntity getStoreById(@PathVariable Long id) { return ResponseEntity.ok(storeService.getStoreById(id)); } diff --git a/backend/src/main/java/com/petshop/backend/security/SecurityConfig.java b/backend/src/main/java/com/petshop/backend/security/SecurityConfig.java index fae6deda..d5a38e47 100644 --- a/backend/src/main/java/com/petshop/backend/security/SecurityConfig.java +++ b/backend/src/main/java/com/petshop/backend/security/SecurityConfig.java @@ -63,6 +63,7 @@ public class SecurityConfig { .requestMatchers(HttpMethod.GET, "/api/v1/products/**").permitAll() .requestMatchers(HttpMethod.GET, "/api/v1/services/**").permitAll() .requestMatchers(HttpMethod.GET, "/api/v1/categories/**").permitAll() + .requestMatchers(HttpMethod.GET, "/api/v1/stores/**").permitAll() .requestMatchers(HttpMethod.GET, "/api/v1/dropdowns/pet-species").permitAll() .requestMatchers(HttpMethod.GET, "/api/v1/dropdowns/pet-breeds").permitAll() .requestMatchers(HttpMethod.GET, "/api/v1/dropdowns/stores").permitAll() diff --git a/web/app/contact/page.js b/web/app/contact/page.js index 85fba175..19295ebd 100644 --- a/web/app/contact/page.js +++ b/web/app/contact/page.js @@ -1,31 +1,24 @@ -const LOCATIONS = [ - { - name: "Downtown Branch", - address: "123 Main St", - phone: "(123) 456-7890", - email: "downtown@petshop.com", - }, - { - name: "North Branch", - address: "456 North Ave", - phone: "(987) 654-3210", - email: "north@petshop.com", - }, - { - name: "West Side Store", - address: "789 West Blvd", - phone: "(555) 123-4567", - email: "westside@petshop.com", - }, -]; +"use client"; -const PERSONNEL = [ - { name: "John Doe", role: "Store Manager" }, - { name: "Sara Smith", role: "Staff" }, - { name: "Michael Johnson", role: "Grooming Team" }, -]; +import { useState, useEffect } from "react"; export default function ContactPage() { + const [locations, setLocations] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + const params = new URLSearchParams({ page: "0", size: "100", sort: "storeName,asc" }); + fetch(`/api/v1/stores?${params}`) + .then((res) => { + if (!res.ok) throw new Error(`HTTP ${res.status}`); + return res.json(); + }) + .then((data) => setLocations(data.content ?? [])) + .catch((err) => setError(err.message)) + .finally(() => setLoading(false)); + }, []); + return (
@@ -44,28 +37,40 @@ export default function ContactPage() {

Store Locations

-
- {LOCATIONS.map((location) => ( -
-

{location.name}

-

{location.address}

-

{location.phone}

-

{location.email}

-
- ))} -
-
-
-

Store Personnel

-
- {PERSONNEL.map((person) => ( -
-

{person.name}

-

{person.role}

-
- ))} -
+ {loading &&

Loading locations...

} + + {error &&

Failed to load locations: {error}

} + + {!loading && !error && locations.length === 0 && ( +

No store locations found.

+ )} + + {!loading && !error && locations.length > 0 && ( +
+ {locations.map((location) => ( +
+
+ {location.storeName} { + e.currentTarget.onerror = null; + e.currentTarget.src = "/images/pet-placeholder.png"; + }} + /> +
+
+

{location.storeName}

+

{location.address}

+

{location.phone}

+

{location.email}

+
+
+ ))} +
+ )}
diff --git a/web/app/globals.css b/web/app/globals.css index 4932c2b5..4f0ee3ee 100644 --- a/web/app/globals.css +++ b/web/app/globals.css @@ -38,7 +38,7 @@ body { align-items: center; flex-wrap: wrap; min-height: 70px; - border-radius: 0px 0px 10px 10px; + /* border-radius: 0px 0px 10px 10px; */ } /* Add padding to body to account for fixed header */ @@ -758,6 +758,39 @@ body { margin-bottom: 0.5rem; } +.location-card { + padding: 0; + overflow: hidden; +} + +.location-card-image-wrapper { + width: 100%; + aspect-ratio: 16 / 9; + overflow: hidden; + background: #eee; +} + +.location-card-image { + width: 100%; + height: 100%; + object-fit: cover; +} + +.location-card-body { + padding: 1rem; +} + +.location-card-body h3 { + margin-top: 0; + margin-bottom: 0.5rem; +} + +.location-card-body p { + margin: 0.25rem 0; + font-size: 0.9rem; + color: #555; +} + .products-hero { text-align: center; padding: 4rem 2rem 3rem; diff --git a/web/components/Footer.js b/web/components/Footer.js index 0ef31e65..47976ce5 100644 --- a/web/components/Footer.js +++ b/web/components/Footer.js @@ -43,7 +43,6 @@ export default function Footer() {
  • (403) 123-4567
  • support@leonspetstore.com
  • -
  • 123 Street Street, Calgary, Alberta, Canada