Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: map feature toggle #994

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/cypress_public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ env:
SHOW_PUBLIC_LOTTERY: "TRUE"
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
GOOGLE_MAPS_MAP_ID: ${{ secrets.GOOGLE_MAPS_MAP_ID }}
SHOW_ALL_MAP_PINS: "TRUE"

jobs:
public-cypress:
Expand Down
1 change: 1 addition & 0 deletions api/src/controllers/listing.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export class ListingController {
listingId,
language,
queryParams.view,
queryParams.combined,
);
}
}
7 changes: 7 additions & 0 deletions api/src/dtos/listings/listings-retrieve-params.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ export class ListingsRetrieveParams {
groups: [ValidationsGroupsEnum.default],
})
view?: ListingViews;

@Expose()
@ApiPropertyOptional({
type: Boolean,
example: true,
})
combined?: boolean;
}
20 changes: 19 additions & 1 deletion api/src/services/listing.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,11 @@ export class ListingService implements OnModuleInit {
listingId: string,
lang: LanguagesEnum = LanguagesEnum.en,
view: ListingViews = ListingViews.full,
combined?: boolean,
): Promise<Listing> {
const listingRaw = await this.findOrThrow(listingId, view);
const listingRaw = combined
? await this.findOrThrowCombined(listingId)
: await this.findOrThrow(listingId, view);

let result = mapTo(Listing, listingRaw);

Expand Down Expand Up @@ -1310,6 +1313,21 @@ export class ListingService implements OnModuleInit {
return listing;
}

async findOrThrowCombined(id: string) {
const listing = await this.prisma.combinedListings.findUnique({
where: {
id,
},
});

if (!listing) {
throw new NotFoundException(
`listingId ${id} was requested but not found`,
);
}
return listing;
}

/*
This should be run for all address fields on an update of a listing.
The address either needs to be updated if fields are changed, deleted if no longer attached,
Expand Down
2 changes: 2 additions & 0 deletions ci/buildspec/build_public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ phases:
--build-arg "API_PASS_KEY=${API_PASS_KEY}"
--build-arg "GOOGLE_MAPS_API_KEY=${GOOGLE_MAPS_API_KEY}"
--build-arg "GOOGLE_MAPS_MAP_ID=${GOOGLE_MAPS_MAP_ID}"
--build-arg "SHOW_ALL_MAP_PINS=${SHOW_ALL_MAP_PINS}"
emilyjablonski marked this conversation as resolved.
Show resolved Hide resolved
--target test
-t sites/public:test
.
Expand Down Expand Up @@ -78,6 +79,7 @@ phases:
--build-arg "API_PASS_KEY=${API_PASS_KEY}"
--build-arg "GOOGLE_MAPS_API_KEY=${GOOGLE_MAPS_API_KEY}"
--build-arg "GOOGLE_MAPS_MAP_ID=${GOOGLE_MAPS_MAP_ID}"
--build-arg "SHOW_ALL_MAP_PINS=${SHOW_ALL_MAP_PINS}"
--target run
-t sites/public:run-candidate
.
Expand Down
11 changes: 9 additions & 2 deletions shared-helpers/src/types/backend-swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ export class ListingsService {
id: string
/** */
view?: ListingViews
/** */
combined?: boolean
} = {} as any,
options: IRequestOptions = {}
): Promise<string> {
Expand All @@ -359,7 +361,7 @@ export class ListingsService {
url = url.replace("{id}", params["id"] + "")

const configs: IRequestConfig = getConfigs("get", "application/json", url, options)
configs.params = { view: params["view"] }
configs.params = { view: params["view"], combined: params["combined"] }

/** 适配ios13,get请求不允许带body */

Expand Down Expand Up @@ -438,6 +440,8 @@ export class ListingsService {
id: string
/** */
view?: ListingViews
/** */
combined?: boolean
} = {} as any,
options: IRequestOptions = {}
): Promise<Listing> {
Expand All @@ -446,7 +450,7 @@ export class ListingsService {
url = url.replace("{id}", params["id"] + "")

const configs: IRequestConfig = getConfigs("get", "application/json", url, options)
configs.params = { view: params["view"] }
configs.params = { view: params["view"], combined: params["combined"] }

/** 适配ios13,get请求不允许带body */

Expand Down Expand Up @@ -2934,6 +2938,9 @@ export interface ListingsQueryParams {
export interface ListingsRetrieveParams {
/** */
view?: ListingViews

/** */
combined?: boolean
}

export interface PaginationAllowsAllQueryParams {
Expand Down
1 change: 1 addition & 0 deletions sites/public/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ SHOW_PWDLESS=TRUE
BLOOM_API_BASE=https://api.housingbayarea.bloom.exygy.dev
GOOGLE_MAPS_API_KEY=SUPER_SECRET_KEY
GOOGLE_MAPS_MAP_ID=
SHOW_ALL_MAP_PINS=


# API passkey, requests missing this will not be alllowed to progress
Expand Down
1 change: 1 addition & 0 deletions sites/public/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"react-dom": "18.2.0",
"react-google-recaptcha-v3": "^1.10.1",
"react-hook-form": "^6.15.5",
"react-swipeable": "^7.0.2",
"tailwindcss": "2.2.10",
"tough-cookie": "4.1.3",
"winston": "^3.13.0"
Expand Down
5 changes: 5 additions & 0 deletions sites/public/public/images/map-pin-deprecated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
.swipe-area {
display: none;

@media (max-width: $screen-md) {
display: block;
position: absolute;
top: 0;
height: 3.25rem;
width: 100%;
z-index: var(--seeds-z-index-overlay);
emilyjablonski marked this conversation as resolved.
Show resolved Hide resolved
background-color: var(--background-color);
border-top-left-radius: var(--bloom-rounded-3xl);
border-top-right-radius: var(--bloom-rounded-3xl);
}
}

.swipe-area-bottom {
display: none;

@media (max-width: $screen-md) {
display: block;
position: absolute;
top: calc(var(--listings-component-height));
height: 3.25rem;
width: 100%;
z-index: var(--seeds-z-index-overlay);
background-color: var(--background-color);
border-top-left-radius: var(--bloom-rounded-3xl);
border-top-right-radius: var(--bloom-rounded-3xl);
}
}

.swipe-area-line {
display: none;

@media (max-width: $screen-md) {
display: block;
width: 30%;
margin-left: 35%;
margin-right: 35%;
margin-top: var(--bloom-s4);
border-top: 1px solid var(--line-color);
}
}

.listings-list-deprecated {
overflow-y: auto;
width: var(--listings-list-width);

@media (max-width: $screen-md) {
padding-top: 0;
z-index: 1;
top: var(--seeds-s10);
width: 100%;
overflow-y: auto;
background-color: var(--background-color);
display: block;
position: static;
z-index: 1;
height: calc(100dvh - 370px);
overflow-y: auto;
background-color: var(--background-color);
}
}

.listings-outer-container-deprecated {
overflow-y: auto;
width: var(--listings-list-width);

@media (max-width: $screen-md) {
position: absolute;
max-height: var(--listings-component-height-mobile);
z-index: 1;
top: calc(calc(calc(100vh - 183px) / 2));
width: 100%;
border-top-left-radius: var(--bloom-rounded-3xl);
border-top-right-radius: var(--bloom-rounded-3xl);
}
}

.listings-list-wrapper-deprecated {
@media (max-width: $screen-md) {
padding-top: var(--seeds-s10);
}
}

.listings-list-expanded-deprecated {
overflow-y: auto;
width: var(--listings-list-width);

@media (max-width: $screen-md) {
margin-top: var(--seeds-s4);
z-index: 1;
top: var(--seeds-s10);
width: 100%;
overflow-y: auto;
background-color: var(--background-color);
display: block;
position: static;
z-index: 1;
height: calc(100dvh - 230px);
overflow-y: auto;
background-color: var(--background-color);
}
}

.listings-map-deprecated {
flex: 1;
position: relative;
display: flex;
height: 100%;
@media (max-width: $screen-md) {
position: absolute;
z-index: 0;
height: calc(100dvh - 230px);
width: 100%;
}
}
Loading
Loading