web issue fixes
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
import { useState, useEffect, useCallback, useRef } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useAuth } from "@/context/AuthContext";
|
||||
|
||||
@@ -339,6 +340,7 @@ function AppointmentsPage() {
|
||||
const adoptionStoreName = searchParams.get("storeName") || "";
|
||||
|
||||
const didPreselectRef = useRef(false);
|
||||
const errorRef = useRef(null);
|
||||
|
||||
// Adoption-mode URL verification
|
||||
const [adoptionVerified, setAdoptionVerified] = useState(!adoptionMode);
|
||||
@@ -364,6 +366,12 @@ function AppointmentsPage() {
|
||||
const [error, setError] = useState(null);
|
||||
const [success, setSuccess] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (error && errorRef.current) {
|
||||
errorRef.current.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
}
|
||||
}, [error]);
|
||||
|
||||
const [appointments, setAppointments] = useState([]);
|
||||
const [loadingAppointments, setLoadingAppointments] = useState(false);
|
||||
|
||||
@@ -779,7 +787,7 @@ const canBookAppointments = user?.role === "CUSTOMER" || user?.role === "ADMIN";
|
||||
<form className="appt-form" onSubmit={handleSubmit}>
|
||||
<h2 className="appt-form-title">{adoptionMode ? "New Adoption" : "New Appointment"}</h2>
|
||||
|
||||
{error && <div className="appt-error">{error}</div>}
|
||||
{error && <div className="appt-error" ref={errorRef}>{error}</div>}
|
||||
|
||||
{adoptionMode && adoptionVerifyLoading && (
|
||||
<p className="appt-loading">Verifying pet details…</p>
|
||||
@@ -805,7 +813,10 @@ const canBookAppointments = user?.role === "CUSTOMER" || user?.role === "ADMIN";
|
||||
<div className="appt-label">
|
||||
<span>Select Your Pet</span>
|
||||
{eligiblePets.length === 0 ? (
|
||||
<p className="appt-no-slots">You have no adopted pets available for appointments.</p>
|
||||
<p className="appt-no-slots">
|
||||
You have no adopted pets available.{" "}
|
||||
<Link href="/profile">Add a pet on your profile page.</Link>
|
||||
</p>
|
||||
) : (
|
||||
<div className="appt-pets-grid">
|
||||
{eligiblePets.map((p) => (
|
||||
|
||||
@@ -265,6 +265,7 @@ function ChatPage() {
|
||||
const isHuman = conversation?.mode === "HUMAN";
|
||||
const hasStaff = !!conversation?.staffId;
|
||||
const isClosed = conversation?.status === "CLOSED";
|
||||
const hasStaffMessage = messages.some((m) => m.senderId !== user?.id);
|
||||
|
||||
const staffStatusLabel = isClosed
|
||||
? "Conversation closed"
|
||||
@@ -322,7 +323,7 @@ function ChatPage() {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{!hasStaff && !isClosed && (
|
||||
{!hasStaff && !hasStaffMessage && !isClosed && (
|
||||
<div style={s.waitingBanner}>
|
||||
<span style={s.waitingSpinner} />
|
||||
A support agent will be with you shortly. You can send messages while you wait.
|
||||
|
||||
@@ -2,6 +2,15 @@
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
function getStoreImage(store) {
|
||||
if (store.imageUrl) return store.imageUrl;
|
||||
const name = store.storeName?.toLowerCase() ?? "";
|
||||
if (name.includes("downtown")) return "/stores/downtown.webp";
|
||||
if (name.includes("north")) return "/stores/north.webp";
|
||||
if (name.includes("west")) return "/stores/west.webp";
|
||||
return "/images/pet-placeholder.png";
|
||||
}
|
||||
|
||||
export default function ContactPage() {
|
||||
const [locations, setLocations] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -52,7 +61,7 @@ export default function ContactPage() {
|
||||
<article key={location.storeId} className="info-mini-card location-card">
|
||||
<div className="location-card-image-wrapper">
|
||||
<img
|
||||
src={location.imageUrl || "/images/pet-placeholder.png"}
|
||||
src={getStoreImage(location)}
|
||||
alt={location.storeName}
|
||||
className="location-card-image"
|
||||
onError={(e) => {
|
||||
|
||||
@@ -12,12 +12,6 @@
|
||||
--font-mono: var(--font-geist-mono);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background: #0a0a0a;
|
||||
--foreground: #ededed;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
|
||||
Reference in New Issue
Block a user