Skip to content

Commit d5d638f

Browse files
Francisca105nalves599
authored andcommitted
Enhance VenueStands component to support company filtering and highlight selected stands; update CompanyStand styles for consistency; add Venue link to Sidebar
1 parent a247a5c commit d5d638f

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

src/app/(authenticated)/venue/VenueStands.tsx

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
2222

2323
// Extract the 'day' parameter from the URL search parameters
2424
const dayParam = searchParams.get("day");
25+
const companyParam = searchParams.get("company");
2526
const [showingDay, setShowingDay] = useState<string | null>(null);
2627

2728
const standPositions: Record<number, { x: number; y: number }> = {
@@ -56,7 +57,7 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
5657
new Set(
5758
companies
5859
.flatMap((company) => company.stands || [])
59-
.map((stand) => stand.date)
60+
.map((stand) => stand.date.split("T")[0])
6061
)
6162
).sort();
6263
};
@@ -66,7 +67,7 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
6667
const companiesForSelectedDay = useMemo(() => {
6768
if (!showingDay) return [];
6869
return companies.filter((company) =>
69-
company.stands?.some((stand) => stand.date === showingDay)
70+
company.stands?.some((stand) => stand.date.split("T")[0] === showingDay)
7071
);
7172
}, [companies, showingDay]);
7273

@@ -76,7 +77,8 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
7677
return (
7778
companiesForSelectedDay.find((company) =>
7879
company.stands?.some(
79-
(stand) => stand.date === showingDay && stand.standId === standId
80+
(stand) =>
81+
stand.date.split("T")[0] === showingDay && stand.standId === standId
8082
)
8183
) || null
8284
);
@@ -86,7 +88,9 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
8688
if (!showingDay) return [];
8789
return companies.flatMap(
8890
(company) =>
89-
company.stands?.filter((stand) => stand.date === showingDay) || []
91+
company.stands?.filter(
92+
(stand) => stand.date.split("T")[0] === showingDay
93+
) || []
9094
);
9195
}, [companies, showingDay]);
9296

@@ -111,6 +115,10 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
111115
}
112116
}, [dayParam, sortedDays]);
113117

118+
const isStandHighlighted = (company: Company | null) => {
119+
return company?.id === companyParam;
120+
};
121+
114122
return (
115123
<div className="w-full space-y-8">
116124
<GridList>
@@ -136,14 +144,18 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
136144

137145
{/* Company Stands */}
138146
<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+
})}
147159
</g>
148160
</svg>
149161
</ZoomSvg>

src/app/(authenticated)/venue/stands/CompanyStand.tsx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const CompanyStand: React.FC<StandProps> = ({
2828
className={`
2929
transition-all duration-200 ease-in-out
3030
${company ? "cursor-pointer hover:opacity-80" : "cursor-default"}
31-
${isSelected ? "opacity-70" : "opacity-100"}
31+
opacity-100
3232
`}
3333
>
3434
{/* Base stand rectangle */}
@@ -38,7 +38,7 @@ const CompanyStand: React.FC<StandProps> = ({
3838
width="26"
3939
height="26"
4040
fill={isSelected ? "#E5E7EB" : "white"}
41-
stroke={isSelected ? "#9CA3AF" : "black"}
41+
stroke="black"
4242
strokeWidth={isSelected ? "2" : "1"}
4343
className="transition-all duration-200"
4444
/>
@@ -64,7 +64,7 @@ const CompanyStand: React.FC<StandProps> = ({
6464
fontSize="6"
6565
className={`
6666
${company ? "font-medium" : "font-normal"}
67-
${isSelected ? "fill-gray-600" : "fill-black"}
67+
${isSelected ? "fill-black" : "fill-black"}
6868
`}
6969
>
7070
{company.name}
@@ -82,20 +82,6 @@ const CompanyStand: React.FC<StandProps> = ({
8282
{standNumber}
8383
</text>
8484
)}
85-
86-
{/* Optional highlight effect for selected state */}
87-
{isSelected && (
88-
<rect
89-
x={position.x - 1}
90-
y={position.y - 1}
91-
width="28"
92-
height="28"
93-
fill="none"
94-
stroke="#4F46E5"
95-
strokeWidth="2"
96-
className="pointer-events-none"
97-
/>
98-
)}
9985
</g>
10086
</a>
10187
);

src/components/Toolbar/Sidebar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ export default function Sidebar({ show, onClose }: SidebarProps) {
4949
<Link href="/companies" onClick={onClose}>
5050
Companies
5151
</Link>
52+
<Link href="/venue" onClick={onClose}>
53+
Venue
54+
</Link>
5255
</div>
5356
<div></div>
5457
</div>

0 commit comments

Comments
 (0)