From 357fac2d56229c4d6910cf6a2f843c6ade93de22 Mon Sep 17 00:00:00 2001 From: augmentedpotato Date: Sun, 19 Apr 2026 08:25:14 -0600 Subject: [PATCH] Mobile UI for ai chat, fixed backend issue --- .../repository/AppointmentRepository.java | 2 +- web/app/ai-chat/page.js | 32 ++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/backend/src/main/java/com/petshop/backend/repository/AppointmentRepository.java b/backend/src/main/java/com/petshop/backend/repository/AppointmentRepository.java index 59243df2..b23b1902 100644 --- a/backend/src/main/java/com/petshop/backend/repository/AppointmentRepository.java +++ b/backend/src/main/java/com/petshop/backend/repository/AppointmentRepository.java @@ -53,7 +53,7 @@ public interface AppointmentRepository extends JpaRepository List findByPet_Id(Long petId); - @Query("SELECT a FROM Appointment a JOIN FETCH a.service WHERE a.pet.petId = :petId AND a.appointmentDate = :date AND LOWER(a.appointmentStatus) NOT IN ('cancelled', 'missed')") + @Query("SELECT a FROM Appointment a JOIN FETCH a.service WHERE a.pet.id = :petId AND a.appointmentDate = :date AND LOWER(a.appointmentStatus) NOT IN ('cancelled', 'missed')") List findByPetIdAndAppointmentDate(@Param("petId") Long petId, @Param("date") LocalDate date); List findByAppointmentDateAndAppointmentStatusIgnoreCase(LocalDate date, String status); diff --git a/web/app/ai-chat/page.js b/web/app/ai-chat/page.js index 13ed9ae4..b6ac0816 100644 --- a/web/app/ai-chat/page.js +++ b/web/app/ai-chat/page.js @@ -68,11 +68,23 @@ function AttachmentPreview({ url, name, token }) { ); } +function useIsMobile() { + const [isMobile, setIsMobile] = useState(false); + useEffect(() => { + const check = () => setIsMobile(window.innerWidth < 640); + check(); + window.addEventListener("resize", check); + return () => window.removeEventListener("resize", check); + }, []); + return isMobile; +} + function AiChatPage() { const { user, token, loading: authLoading } = useAuth(); const router = useRouter(); const searchParams = useSearchParams(); const conversationIdParam = searchParams.get("id"); + const isMobile = useIsMobile(); const [conversation, setConversation] = useState(null); const [messages, setMessages] = useState([]); @@ -496,8 +508,8 @@ function AiChatPage() {
-
-
+
+
All Conversations
@@ -552,7 +564,7 @@ function AiChatPage() {
-
+
{!conversation ? (
🐾
@@ -568,7 +580,7 @@ function AiChatPage() {
) : (
-
+
{isEscalated ? "👤" : "🐾"}
@@ -581,14 +593,14 @@ function AiChatPage() {
-
+
{!isEscalated && !isClosed && ( - )} {!isClosed && ( - )} @@ -790,7 +802,6 @@ const s = { padding: "1.5rem 1rem 2rem", }, sidebar: { - width: 230, flexShrink: 0, background: "white", borderRadius: 16, @@ -798,8 +809,7 @@ const s = { display: "flex", flexDirection: "column", overflow: "hidden", - maxHeight: "calc(100vh - 220px)", - minHeight: 300, + minHeight: 200, }, sidebarHeader: { display: "flex", @@ -899,7 +909,7 @@ const s = { display: "flex", flexDirection: "column", height: "calc(100vh - 220px)", - minHeight: 450, + minHeight: 400, }, chatHeader: { display: "flex",