}) => {
+ const directorySections =
+ directoryType === "forSale"
+ ? {
+ open: { key: "enter-a-lottery", icon: "house" },
+ fcfs: { key: "buy-now", icon: "house" },
+ upcoming: { key: "upcoming-lotteries", icon: "house" },
+ results: { key: "lottery-results", icon: "house" },
+ }
+ : {
+ open: { key: "enter-a-lottery", icon: "house" },
+ upcoming: { key: "upcoming-lotteries", icon: "house" },
+ results: { key: "lottery-results", icon: "house" },
+ }
+
return (
-
- {directoryType === "forSale" && (
-
- )}
-
-
+ {Object.keys(directorySections).map((listingType, index) => {
+ return (
+
+ )
+ })}
)
}
diff --git a/app/javascript/modules/listings/GenericDirectory.tsx b/app/javascript/modules/listings/GenericDirectory.tsx
index a880e36c6c..ff91ffbfa9 100644
--- a/app/javascript/modules/listings/GenericDirectory.tsx
+++ b/app/javascript/modules/listings/GenericDirectory.tsx
@@ -66,10 +66,10 @@ export const GenericDirectory = (props: RentalDirectoryProps) => {
const observerRef = useRef(null)
useEffect(() => {
- let prevRatio = null
const handleIntersectionEvents = (events: IntersectionObserverEntry[]) => {
let newActiveItem = activeItem
for (const e of events) {
+ let prevRatio = null
if (e.isIntersecting) {
if (!prevRatio) {
prevRatio = e.intersectionRatio