Skip to content

Commit e9023f7

Browse files
committed
fix: filter crashing + unnecessary filter
1 parent ca52257 commit e9023f7

File tree

2 files changed

+18
-349
lines changed

2 files changed

+18
-349
lines changed

client/src/components/filters/FilterComponents.jsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -501,15 +501,18 @@ export const RoomFilter = ({ roomMap, onChange, room }) => {
501501
>
502502
All
503503
</RoundedButton>
504-
{Array.from(roomMap.values()).map((room) => (
505-
<RoundedButton
506-
key={room}
507-
onClick={() => handleRoomChange(room)}
508-
isActive={localRoom === room}
509-
>
510-
{room}
511-
</RoundedButton>
512-
))}
504+
{Array.from(roomMap.values()).map((room) => {
505+
const displayName = typeof room === "string" ? room : room?.name || "";
506+
return (
507+
<RoundedButton
508+
key={displayName}
509+
onClick={() => handleRoomChange(displayName)}
510+
isActive={localRoom === displayName}
511+
>
512+
{displayName}
513+
</RoundedButton>
514+
);
515+
})}
513516
</HStack>
514517
</FormControl>
515518
);

client/src/components/programs/ProgramComponents.jsx

Lines changed: 6 additions & 340 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,346 +1367,12 @@ export const Sessions = ({
13671367
</button>
13681368
)}
13691369

1370-
<Popover onClose={onClose}>
1371-
<PopoverTrigger>
1372-
<Button
1373-
display="flex"
1374-
height="40px"
1375-
width="96px"
1376-
padding="0px 16px"
1377-
justifyContent="center"
1378-
alignItems="center"
1379-
gap="4px"
1380-
borderRadius="6px"
1381-
bg="var(--Secondary-2-Default, #EDF2F7)"
1382-
color="#2D3748"
1383-
fontFamily="Inter"
1384-
fontSize="14px"
1385-
onClick={onOpen}
1386-
border="none"
1387-
>
1388-
<Box
1389-
display="flex"
1390-
flexDirection="row"
1391-
alignItems="center"
1392-
gap="5px"
1393-
>
1394-
<SessionFilter
1395-
sessions={sessions}
1396-
setFilteredSessions={setFilteredSessions}
1397-
rooms={rooms}
1398-
isArchived={isArchived}
1399-
/>
1400-
</Box>
1401-
</Button>
1402-
</PopoverTrigger>
1403-
<Portal>
1404-
<PopoverContent>
1405-
<Box margin="16px">
1406-
<PopoverBody>
1407-
<Box
1408-
display="flex"
1409-
flexDirection="column"
1410-
alignItems="flex-start"
1411-
gap="24px"
1412-
alignSelf="stretch"
1413-
>
1414-
<FormControl id="date">
1415-
<Box
1416-
display="flex"
1417-
flexDirection="column"
1418-
justifyContent="center"
1419-
alignItems="flex-start"
1420-
gap="16px"
1421-
alignSelf="stretch"
1422-
>
1423-
<Box
1424-
display="flex"
1425-
alignItems="center"
1426-
gap="5px"
1427-
alignSelf="stretch"
1428-
>
1429-
<CalendarIcon />
1430-
<Text
1431-
fontWeight="bold"
1432-
color="#767778"
1433-
>
1434-
DATE
1435-
</Text>
1436-
</Box>
1437-
<Box
1438-
display="flex"
1439-
alignItems="center"
1440-
gap="8px"
1441-
>
1442-
<Input
1443-
size="sm"
1444-
borderRadius="5px"
1445-
borderColor="#D2D2D2"
1446-
backgroundColor="#F6F6F6"
1447-
width="35%"
1448-
height="20%"
1449-
type="date"
1450-
placeholder="MM/DD/YYYY"
1451-
onChange={(e) =>
1452-
handleDateChange("start", e.target.value)
1453-
}
1454-
/>
1455-
<Text> to </Text>
1456-
<Input
1457-
size="sm"
1458-
borderRadius="5px"
1459-
borderColor="#D2D2D2"
1460-
backgroundColor="#F6F6F6"
1461-
width="35%"
1462-
height="20%"
1463-
type="date"
1464-
placeholder="MM/DD/YYYY"
1465-
onChange={(e) =>
1466-
handleDateChange("end", e.target.value)
1467-
}
1468-
/>
1469-
</Box>
1470-
</Box>
1471-
</FormControl>
1472-
<FormControl id="time">
1473-
<Box
1474-
display="flex"
1475-
flexDirection="column"
1476-
justifyContent="center"
1477-
alignItems="flex-start"
1478-
gap="16px"
1479-
alignSelf="stretch"
1480-
>
1481-
<Box
1482-
display="flex"
1483-
alignItems="center"
1484-
gap="5px"
1485-
alignSelf="stretch"
1486-
>
1487-
<Icon as={sessionsFilterClock} />
1488-
<Text
1489-
fontWeight="bold"
1490-
color="#767778"
1491-
>
1492-
Time
1493-
</Text>
1494-
</Box>
1495-
<Box
1496-
display="flex"
1497-
alignItems="center"
1498-
gap="8px"
1499-
>
1500-
<Input
1501-
size="xs"
1502-
borderRadius="5px"
1503-
borderColor="#D2D2D2"
1504-
backgroundColor="#F6F6F6"
1505-
width="30%"
1506-
height="20%"
1507-
type="time"
1508-
placeholder="00:00 am"
1509-
onChange={(e) =>
1510-
handleTimeChange("start", e.target.value)
1511-
}
1512-
/>
1513-
<Text> to </Text>
1514-
<Input
1515-
size="xs"
1516-
borderRadius="5px"
1517-
borderColor="#D2D2D2"
1518-
backgroundColor="#F6F6F6"
1519-
width="30%"
1520-
height="20%"
1521-
type="time"
1522-
placeholder="00:00 pm"
1523-
onChange={(e) =>
1524-
handleTimeChange("end", e.target.value)
1525-
}
1526-
/>
1527-
</Box>
1528-
</Box>
1529-
</FormControl>
1530-
<FormControl id="status">
1531-
<Box
1532-
display="flex"
1533-
flexDirection="column"
1534-
justifyContent="center"
1535-
alignItems="flex-start"
1536-
gap="16px"
1537-
alignSelf="stretch"
1538-
>
1539-
<Text
1540-
fontWeight="bold"
1541-
color="#767778"
1542-
visibility={isSelected ? "visible" : "hidden"}
1543-
>
1544-
Status
1545-
</Text>
1546-
<Box
1547-
display="flex"
1548-
alignItems="center"
1549-
gap="8px"
1550-
>
1551-
<Button
1552-
borderRadius="30px"
1553-
borderWidth="1px"
1554-
minWidth="auto"
1555-
height="20%"
1556-
onClick={() => setStatus("All")}
1557-
backgroundColor={
1558-
status === "All" ? "#EDEDFD" : "#F6F6F6"
1559-
}
1560-
borderColor={
1561-
status === "All" ? "#4E4AE7" : "#767778"
1562-
}
1563-
>
1564-
All
1565-
</Button>
1566-
<Button
1567-
borderRadius="30px"
1568-
borderWidth="1px"
1569-
minWidth="auto"
1570-
height="20%"
1571-
onClick={() => setStatus("Active")}
1572-
backgroundColor={
1573-
status === "Active"
1574-
? "#EDEDFD"
1575-
: "#F6F6F6"
1576-
}
1577-
borderColor={
1578-
status === "Active"
1579-
? "#4E4AE7"
1580-
: "#767778"
1581-
}
1582-
>
1583-
<Box
1584-
display="flex"
1585-
justifyContent="center"
1586-
alignItems="center"
1587-
gap="4px"
1588-
>
1589-
<Box
1590-
width="10px"
1591-
height="10px"
1592-
borderRadius="50%"
1593-
bg="#0C824D"
1594-
/>
1595-
Active
1596-
</Box>
1597-
</Button>
1598-
<Button
1599-
borderRadius="30px"
1600-
borderWidth="1px"
1601-
minWidth="auto"
1602-
height="20%"
1603-
onClick={() => setStatus("Past")}
1604-
backgroundColor={
1605-
status === "Past" ? "#EDEDFD" : "#F6F6F6"
1606-
}
1607-
borderColor={
1608-
status === "Past" ? "#4E4AE7" : "#767778"
1609-
}
1610-
>
1611-
<Box
1612-
display="flex"
1613-
justifyContent="center"
1614-
alignItems="center"
1615-
gap="4px"
1616-
>
1617-
<Box
1618-
width="10px"
1619-
height="10px"
1620-
borderRadius="50%"
1621-
bg="#DAB434"
1622-
/>
1623-
Past
1624-
</Box>
1625-
</Button>
1626-
</Box>
1627-
</Box>
1628-
</FormControl>
1629-
<FormControl id="room">
1630-
<Box
1631-
display="flex"
1632-
flexDirection="column"
1633-
justifyContent="center"
1634-
alignItems="flex-start"
1635-
gap="16px"
1636-
alignSelf="stretch"
1637-
>
1638-
<Box
1639-
display="flex"
1640-
alignItems="center"
1641-
gap="5px"
1642-
alignSelf="stretch"
1643-
>
1644-
<Icon as={sessionsFilterMapPin} />
1645-
<Text
1646-
fontWeight="bold"
1647-
color="#767778"
1648-
>
1649-
Room
1650-
</Text>
1651-
</Box>
1652-
<Wrap spacing={2}>
1653-
<WrapItem>
1654-
<Button
1655-
borderRadius="30px"
1656-
borderWidth="1px"
1657-
width="auto"
1658-
height="20px"
1659-
onClick={() => setSelectedRoom("All")}
1660-
backgroundColor={
1661-
selectedRoom === "All"
1662-
? "#EDEDFD"
1663-
: "#F6F6F6"
1664-
}
1665-
borderColor={
1666-
selectedRoom === "All"
1667-
? "#4E4AE7"
1668-
: "#767778"
1669-
}
1670-
>
1671-
All
1672-
</Button>
1673-
</WrapItem>
1674-
{Array.from(rooms.values()).map(
1675-
(room, index) => (
1676-
<WrapItem key={index}>
1677-
<Button
1678-
borderRadius="30px"
1679-
borderWidth="1px"
1680-
minWidth="auto"
1681-
height="20px"
1682-
onClick={() =>
1683-
setSelectedRoom(room.name)
1684-
}
1685-
backgroundColor={
1686-
selectedRoom === room.name
1687-
? "#EDEDFD"
1688-
: "#F6F6F6"
1689-
}
1690-
borderColor={
1691-
selectedRoom === room.name
1692-
? "#4E4AE7"
1693-
: "#767778"
1694-
}
1695-
>
1696-
{room.name}
1697-
</Button>
1698-
</WrapItem>
1699-
)
1700-
)}
1701-
</Wrap>
1702-
</Box>
1703-
</FormControl>
1704-
</Box>
1705-
</PopoverBody>
1706-
</Box>
1707-
</PopoverContent>
1708-
</Portal>
1709-
</Popover>
1370+
<SessionFilter
1371+
sessions={sessions}
1372+
setFilteredSessions={setFilteredSessions}
1373+
rooms={rooms}
1374+
isArchived={isArchived}
1375+
/>
17101376
</Flex>
17111377

17121378
<Flex alignItems="flex-end">

0 commit comments

Comments
 (0)