Skip to content

Commit e28cd93

Browse files
refactor: pr review
1 parent 5b67574 commit e28cd93

14 files changed

Lines changed: 27 additions & 29 deletions

sites/partners/src/components/listings/PaperListingForm/index.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ import ListingApprovalDialog from "./dialogs/ListingApprovalDialog"
6464
import SaveBeforeExitDialog from "./dialogs/SaveBeforeExitDialog"
6565

6666
import * as styles from "./ListingForm.module.scss"
67-
6867
const CHARACTER_LIMIT = 1000
6968

7069
type ListingFormProps = {
@@ -187,11 +186,11 @@ const ListingForm = ({
187186

188187
useEffect(() => {
189188
if (profile) {
190-
setSelectedJurisdictionData(
191-
profile?.jurisdictions?.find((juris) => jurisdictionId === juris.id)
192-
)
189+
const jurisdiction = profile?.jurisdictions?.find((juris) => jurisdictionId === juris.id)
190+
if (!jurisdiction) void router.replace("/")
191+
setSelectedJurisdictionData(jurisdiction)
193192
}
194-
}, [profile, jurisdictionId])
193+
}, [profile, jurisdictionId, router])
195194

196195
useEffect(() => {
197196
if (selectedJurisdictionData && !listing) {

sites/partners/src/components/listings/PaperListingForm/sections/AdditionalFees.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import { GridRow } from "@bloom-housing/ui-seeds/src/layout/Grid"
1515
import { ListingContext } from "../../ListingContext"
1616

1717
type AdditionalFeesProps = {
18-
enableNonRegulatedListings: boolean
19-
enableUtilitiesIncluded: boolean
18+
enableNonRegulatedListings?: boolean
19+
enableUtilitiesIncluded?: boolean
2020
existingUtilities: ListingUtilities
2121
requiredFields: string[]
2222
}

sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import { fieldMessage, fieldHasError, getLabel } from "../../../../lib/helpers"
2525
import styles from "../ListingForm.module.scss"
2626

2727
type ApplicationDatesProps = {
28-
enableMarketingStatus: boolean
29-
enableMarketingStatusMonths: boolean
28+
enableMarketingStatus?: boolean
29+
enableMarketingStatusMonths?: boolean
3030
openHouseEvents: TempEvent[]
3131
requiredFields: string[]
3232
listing?: FormListing

sites/partners/src/components/listings/PaperListingForm/sections/BuildingDetails.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ interface MapboxApiResponse {
4545

4646
type BuildingDetailsProps = {
4747
customMapPositionChosen?: boolean
48-
enableNonRegulatedListings: boolean
49-
enableRegions: boolean
48+
enableNonRegulatedListings?: boolean
49+
enableRegions?: boolean
5050
latLong?: LatitudeLongitude
5151
listing?: FormListing
5252
requiredFields: string[]

sites/partners/src/components/listings/PaperListingForm/sections/BuildingFeatures.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { defaultFieldProps } from "../../../../lib/helpers"
99
import styles from "../ListingForm.module.scss"
1010

1111
type BuildingFeaturesProps = {
12-
enableAccessibilityFeatures: boolean
12+
enableAccessibilityFeatures?: boolean
1313
existingFeatures: ListingFeatures
1414
requiredFields: string[]
1515
}

sites/partners/src/components/listings/PaperListingForm/sections/CommunityType.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import styles from "../ListingForm.module.scss"
2222
type CommunityTypeProps = {
2323
listing?: FormListing
2424
requiredFields: string[]
25-
swapCommunityTypeWithPrograms: boolean
25+
swapCommunityTypeWithPrograms?: boolean
2626
}
2727

2828
const CommunityType = ({

sites/partners/src/components/listings/PaperListingForm/sections/LeasingAgent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
import SectionWithGrid from "../../../shared/SectionWithGrid"
1414

1515
type LeasingAgentProps = {
16-
enableCompanyWebsite: boolean
16+
enableCompanyWebsite?: boolean
1717
requiredFields: string[]
1818
}
1919

sites/partners/src/components/listings/PaperListingForm/sections/ListingIntro.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { defaultFieldProps, fieldHasError, fieldMessage } from "../../../../lib/
1010
import SectionWithGrid from "../../../shared/SectionWithGrid"
1111

1212
interface ListingIntroProps {
13-
enableHousingDeveloperOwner: boolean
14-
enableListingFileNumber: boolean
15-
enableNonRegulatedListings: boolean
13+
enableHousingDeveloperOwner?: boolean
14+
enableListingFileNumber?: boolean
15+
enableNonRegulatedListings?: boolean
1616
jurisdictionName: string
1717
listingId: string
1818
requiredFields: string[]

sites/partners/src/components/listings/PaperListingForm/sections/ListingVerification.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useFormContext } from "react-hook-form"
44
import styles from "../ListingForm.module.scss"
55

66
type ListingVerificationProps = {
7-
enableIsVerified: boolean
7+
enableIsVerified?: boolean
88
}
99

1010
const ListingVerification = (props: ListingVerificationProps) => {

sites/partners/src/components/listings/PaperListingForm/sections/NeighborhoodAmenities.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ enum NeighborhoodAmenityDistanceEnum {
1919
}
2020

2121
type NeighborhoodAmenitiesProps = {
22-
enableNeighborhoodAmenities: boolean
23-
enableNeighborhoodAmenitiesDropdown: boolean
22+
enableNeighborhoodAmenities?: boolean
23+
enableNeighborhoodAmenitiesDropdown?: boolean
2424
visibleNeighborhoodAmenities: NeighborhoodAmenitiesEnum[]
2525
}
2626

0 commit comments

Comments
 (0)