@@ -22,6 +22,7 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
22
22
23
23
// Extract the 'day' parameter from the URL search parameters
24
24
const dayParam = searchParams . get ( "day" ) ;
25
+ const companyParam = searchParams . get ( "company" ) ;
25
26
const [ showingDay , setShowingDay ] = useState < string | null > ( null ) ;
26
27
27
28
const standPositions : Record < number , { x : number ; y : number } > = {
@@ -56,7 +57,7 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
56
57
new Set (
57
58
companies
58
59
. flatMap ( ( company ) => company . stands || [ ] )
59
- . map ( ( stand ) => stand . date )
60
+ . map ( ( stand ) => stand . date . split ( "T" ) [ 0 ] )
60
61
)
61
62
) . sort ( ) ;
62
63
} ;
@@ -66,7 +67,7 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
66
67
const companiesForSelectedDay = useMemo ( ( ) => {
67
68
if ( ! showingDay ) return [ ] ;
68
69
return companies . filter ( ( company ) =>
69
- company . stands ?. some ( ( stand ) => stand . date === showingDay )
70
+ company . stands ?. some ( ( stand ) => stand . date . split ( "T" ) [ 0 ] === showingDay )
70
71
) ;
71
72
} , [ companies , showingDay ] ) ;
72
73
@@ -76,7 +77,8 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
76
77
return (
77
78
companiesForSelectedDay . find ( ( company ) =>
78
79
company . stands ?. some (
79
- ( stand ) => stand . date === showingDay && stand . standId === standId
80
+ ( stand ) =>
81
+ stand . date . split ( "T" ) [ 0 ] === showingDay && stand . standId === standId
80
82
)
81
83
) || null
82
84
) ;
@@ -86,7 +88,9 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
86
88
if ( ! showingDay ) return [ ] ;
87
89
return companies . flatMap (
88
90
( company ) =>
89
- company . stands ?. filter ( ( stand ) => stand . date === showingDay ) || [ ]
91
+ company . stands ?. filter (
92
+ ( stand ) => stand . date . split ( "T" ) [ 0 ] === showingDay
93
+ ) || [ ]
90
94
) ;
91
95
} , [ companies , showingDay ] ) ;
92
96
@@ -111,6 +115,10 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
111
115
}
112
116
} , [ dayParam , sortedDays ] ) ;
113
117
118
+ const isStandHighlighted = ( company : Company | null ) => {
119
+ return company ?. id === companyParam ;
120
+ } ;
121
+
114
122
return (
115
123
< div className = "w-full space-y-8" >
116
124
< GridList >
@@ -136,14 +144,18 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
136
144
137
145
{ /* Company Stands */ }
138
146
< g id = "stands" >
139
- { standsForSelectedDay . map ( ( stand ) => (
140
- < CompanyStand
141
- key = { `stand-${ stand . standId } ` }
142
- stand = { stand }
143
- company = { getCompanyAtPosition ( stand . standId ) }
144
- standPositions = { standPositions }
145
- />
146
- ) ) }
147
+ { standsForSelectedDay . map ( ( stand ) => {
148
+ const company = getCompanyAtPosition ( stand . standId ) ;
149
+ return (
150
+ < CompanyStand
151
+ key = { `stand-${ stand . standId } ` }
152
+ stand = { stand }
153
+ company = { company }
154
+ standPositions = { standPositions }
155
+ isSelected = { isStandHighlighted ( company ) }
156
+ />
157
+ ) ;
158
+ } ) }
147
159
</ g >
148
160
</ svg >
149
161
</ ZoomSvg >
0 commit comments