@@ -7,6 +7,7 @@ import { MapPin, Music, Users } from "lucide-react";
77import Image from "next/image" ;
88import { useRouter } from "next/navigation" ;
99import { useEffect , useState } from "react" ;
10+ import { cn } from "@/lib/utils" ;
1011
1112
1213interface UserGridClientProps {
@@ -22,6 +23,9 @@ export default function UserGridClient({ bar }: UserGridClientProps) {
2223 const [ sortBy , setSortBy ] = useState < "newest" | "oldest" | "alphabetical" > ( "newest" ) ;
2324 const [ loading , setLoading ] = useState ( true ) ;
2425
26+ // Determine if bar is out of range
27+ const isOutOfRange = parseFloat ( ( bar . distance || '' ) . replace ( / [ ^ \d . ] / g, '' ) ) > 1 ;
28+
2529 useEffect ( ( ) => {
2630 // Simulate loading data
2731 setLoading ( true ) ;
@@ -188,21 +192,29 @@ export default function UserGridClient({ bar }: UserGridClientProps) {
188192 </ div >
189193
190194 { /* User List */ }
191- < div className = "flex-1 h-full px-0 pt-4 pb-8 overflow-y-auto" >
192- < div className = "flex flex-col gap-4 max-w-lg mx-auto" >
195+ < div className = { "flex-1 h-full px-0 pt-4 pb-8 overflow-y-auto" } >
196+ < div className = { cn (
197+ "flex flex-col gap-4 max-w-lg mx-auto" ,
198+ isOutOfRange && "pointer-events-none"
199+ ) } >
193200 { filteredUsers . map ( ( user ) => (
194201 < div
195202 key = { user . id }
196- className = "bg-card rounded-xl shadow border border-border flex items-center px-4 py-3 gap-3 cursor-pointer hover:bg-muted/60 transition"
197- onClick = { ( ) => router . push ( `/profile/${ user . id } ` ) }
203+ className = { cn (
204+ "bg-card rounded-xl shadow border border-border flex items-center px-4 py-3 gap-3 transition" ,
205+ ! isOutOfRange && "cursor-pointer hover:bg-muted/60"
206+ ) }
207+ onClick = { ( ) => {
208+ if ( ! isOutOfRange ) router . push ( `/profile/${ user . id } ` ) ;
209+ } }
198210 >
199211 { /* Profile Image */ }
200212 < Image
201213 src = { user . avatar || "/default-avatar.png" }
202214 alt = { user . username }
203215 width = { 56 }
204216 height = { 56 }
205- className = "rounded-full object-cover border-2 border-theme-pink flex-shrink-0 w-12 h-12"
217+ className = { cn ( "rounded-full object-cover border-2 border-theme-pink flex-shrink-0 w-12 h-12" , isOutOfRange && "blur-sm" ) }
206218 />
207219 { /* User Info */ }
208220 < div className = "flex-1 min-w-0" >
0 commit comments