diff --git a/app/assets/json/translations/react/en.json b/app/assets/json/translations/react/en.json index c9c4609311..cb151c8300 100644 --- a/app/assets/json/translations/react/en.json +++ b/app/assets/json/translations/react/en.json @@ -1348,6 +1348,10 @@ "listingsForSale.beforeApplying.step4": "Get pre-approved for a mortgage loan by a lender on our list", "listingsForSale.beforeApplying.step5": "Have enough in savings for closing costs and downpayment", "listingsForSale.beforeApplying.title": "Before applying", + "listingsDirectory.navBar.open": "Enter a lottery (%{numListings})", + "listingsDirectory.navBar.fcfs": "Buy now (%{numListings})", + "listingsDirectory.navBar.upcoming": "Upcoming lotteries (%{numListings})", + "listingsDirectory.navBar.results": "Lottery results (%{numListings})", "listingsForSale.beforeApplyingHabitat.readFullList": "Read the full list of requirements for more details.", "listingsForSale.beforeApplyingHabitat.rulesAreDifferent": "These units have rules that are different from other ownership listings on DAHLIA. Make sure you:", "listingsForSale.beforeApplyingHabitat.step1": "Go to a Habitat for Humanity information session", diff --git a/app/javascript/modules/listings/DirectoryPageNavigationBar.tsx b/app/javascript/modules/listings/DirectoryPageNavigationBar.tsx index a136b3ee97..0cf165b58d 100644 --- a/app/javascript/modules/listings/DirectoryPageNavigationBar.tsx +++ b/app/javascript/modules/listings/DirectoryPageNavigationBar.tsx @@ -1,63 +1,52 @@ import React from "react" import "./DirectoryPageNavigationBar.scss" import { Button } from "@bloom-housing/ui-seeds" -import { Icon } from "@bloom-housing/ui-components" +import { Icon, t } from "@bloom-housing/ui-components" const DirectoryPageNavigationBar = ({ directoryType, listingLengths, activeItem, - setActiveItem, }: { directoryType: string listingLengths: { open: number; upcoming: number; fcfs: number; results: number } activeItem: string setActiveItem: React.Dispatch }) => { + 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