From 35095b49bc67337219385623705af0eb6c2f4793 Mon Sep 17 00:00:00 2001 From: Marcos Frony Date: Tue, 2 Sep 2025 17:04:06 -0700 Subject: [PATCH 1/2] Fix bugs on src/app/page.tsx --- src/app/page.tsx | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 11a598f..5dedb4d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,9 +2,21 @@ import { useEffect, useState } from "react"; +interface Advocate { + id: number; + firstName: string; + lastName: string; + city: string; + degree: string; + specialties: string[]; + yearsOfExperience: number; + phoneNumber: number; + createdAt?: string; +} + export default function Home() { - const [advocates, setAdvocates] = useState([]); - const [filteredAdvocates, setFilteredAdvocates] = useState([]); + const [advocates, setAdvocates] = useState([]); + const [filteredAdvocates, setFilteredAdvocates] = useState([]); useEffect(() => { console.log("fetching advocates..."); @@ -16,10 +28,13 @@ export default function Home() { }); }, []); - const onChange = (e) => { + const onChange = (e: React.ChangeEvent) => { const searchTerm = e.target.value; - document.getElementById("search-term").innerHTML = searchTerm; + const searchTermElement = document.getElementById("search-term"); + if (searchTermElement) { + searchTermElement.innerHTML = searchTerm; + } console.log("filtering advocates..."); const filteredAdvocates = advocates.filter((advocate) => { @@ -28,8 +43,8 @@ export default function Home() { advocate.lastName.includes(searchTerm) || advocate.city.includes(searchTerm) || advocate.degree.includes(searchTerm) || - advocate.specialties.includes(searchTerm) || - advocate.yearsOfExperience.includes(searchTerm) + advocate.specialties.some(specialty => specialty.includes(searchTerm)) || + advocate.yearsOfExperience.toString().includes(searchTerm) ); }); @@ -75,8 +90,8 @@ export default function Home() { {advocate.city} {advocate.degree} - {advocate.specialties.map((s) => ( -
{s}
+ {advocate.specialties.map((s: string, index: number) => ( +
{s}
))} {advocate.yearsOfExperience} From ae97ee5bea3a000ae215652a1468a1ca7e47a5f8 Mon Sep 17 00:00:00 2001 From: Marcos Frony Date: Tue, 2 Sep 2025 17:16:02 -0700 Subject: [PATCH 2/2] Added a tr between thead and th --- src/app/page.tsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 5dedb4d..c25281f 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -58,11 +58,11 @@ export default function Home() { return (
-

Solace Advocates

+

Solace Advocates



-

Search

+

Search

Searching for:

@@ -73,13 +73,15 @@ export default function Home() {
- - - - - - - + + + + + + + + + {filteredAdvocates.map((advocate) => {
First NameLast NameCityDegreeSpecialtiesYears of ExperiencePhone Number
First NameLast NameCityDegreeSpecialtiesYears of ExperiencePhone Number