Skip to content

Commit

Permalink
Add option to toggle agency visibility in the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Feb 4, 2025
1 parent d2228ae commit a2d8148
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 14 deletions.
1 change: 1 addition & 0 deletions frontend/.env.docker.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ VITE_MI_GG_APP_ID=XXXXXXXXXX
VITE_MI_MIN_LOCATIONS=4
VITE_MI_CONTACT_EMAIL=info@movinin.io
VITE_MI_WEBSITE_NAME="Movin' In"
VITE_MI_HIDE_AGENCIES=false
1 change: 1 addition & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ VITE_MI_GG_APP_ID=XXXXXXXXXX
VITE_MI_MIN_LOCATIONS=4
VITE_MI_CONTACT_EMAIL=info@movinin.io
VITE_MI_WEBSITE_NAME="Movin' In"
VITE_MI_HIDE_AGENCIES=false
1 change: 1 addition & 0 deletions frontend/src/config/env.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const env = {
GG_APP_ID: String(import.meta.env.VITE_MI_GG_APP_ID),
MIN_LOCATIONS: Number.parseInt(String(import.meta.env.VITE_MI_MIN_LOCATIONS), 10) || 4,
CONTACT_EMAIL: import.meta.env.VITE_MI_CONTACT_EMAIL,
HIDE_AGENCIES: (import.meta.env.VITE_MI_HIDE_AGENCIES && import.meta.env.VITE_MI_HIDE_AGENCIES.toLowerCase()) === 'true',
}

export default env
3 changes: 2 additions & 1 deletion frontend/src/pages/Booking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const Booking = () => {
<div className="booking">
<div className="col-1">
<form>
{!isAgency && (
{!isAgency && !env.HIDE_AGENCIES && (
<FormControl fullWidth margin="dense">
<AgencySelectList
label={blStrings.AGENCY}
Expand Down Expand Up @@ -195,6 +195,7 @@ const Booking = () => {
className="property"
properties={((property && [booking.property]) as movininTypes.Property[]) || []}
hidePrice
hideAgency={env.HIDE_AGENCIES}
/>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/Bookings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const Bookings = () => {
loading={loadingAgencies}
hideDates={env.isMobile}
checkboxSelection={false}
hideAgencyColumn={env.HIDE_AGENCIES}
/>
</div>
</div>
Expand Down
17 changes: 10 additions & 7 deletions frontend/src/pages/Checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ const Checkout = () => {
hideActions
hidePrice
sizeAuto
hideAgency={env.HIDE_AGENCIES}
/>

<CheckoutOptions
Expand Down Expand Up @@ -467,15 +468,17 @@ const Checkout = () => {
<span className="checkout-detail-title">{strings.PROPERTY}</span>
<div className="checkout-detail-value">{`${property.name} (${helper.priceLabel(property, language)})`}</div>
</div>
<div className="checkout-detail" style={{ height: bookingDetailHeight }}>
<span className="checkout-detail-title">{commonStrings.AGENCY}</span>
<div className="checkout-detail-value">
<div className="property-agency">
<img src={movininHelper.joinURL(env.CDN_USERS, property.agency.avatar)} alt={property.agency.fullName} style={{ height: env.AGENCY_IMAGE_HEIGHT }} />
<span className="property-agency-name">{property.agency.fullName}</span>
{!env.HIDE_AGENCIES && (
<div className="checkout-detail" style={{ height: bookingDetailHeight }}>
<span className="checkout-detail-title">{commonStrings.AGENCY}</span>
<div className="checkout-detail-value">
<div className="property-agency">
<img src={movininHelper.joinURL(env.CDN_USERS, property.agency.avatar)} alt={property.agency.fullName} style={{ height: env.AGENCY_IMAGE_HEIGHT }} />
<span className="property-agency-name">{property.agency.fullName}</span>
</div>
</div>
</div>
</div>
)}
<div className="checkout-detail" style={{ height: bookingDetailHeight }}>
<span className="checkout-detail-title">{strings.COST}</span>
<div className="checkout-detail-value checkout-price">{movininHelper.formatPrice(price, commonStrings.CURRENCY, language)}</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Property.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const Property = () => {
</div>

<div className="property-footer">
<AgencyBadge agency={property.agency} />
{env.HIDE_AGENCIES ? <div /> : <AgencyBadge agency={property.agency} />}

{
!hideAction
Expand Down
14 changes: 9 additions & 5 deletions frontend/src/pages/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import PropertyTypeFilter from '@/components/PropertyTypeFilter'
import Map from '@/components/Map'
import ViewOnMapButton from '@/components/ViewOnMapButton'
import MapDialog from '@/components/MapDialog'
import env from '@/config/env.config'

import '@/assets/css/search.css'

Expand Down Expand Up @@ -119,11 +120,13 @@ const Properties = () => {
collapse
onSubmit={handlePropertyFilterSubmit}
/>
<AgencyFilter
className="filter"
agencies={allAgencies}
onChange={handleAgencyFilterChange}
/>
{!env.HIDE_AGENCIES && (
<AgencyFilter
className="filter"
agencies={allAgencies}
onChange={handleAgencyFilterChange}
/>
)}
<PropertyTypeFilter
className="filter"
onChange={handlePropertyTypeFilterChange}
Expand All @@ -144,6 +147,7 @@ const Properties = () => {
loading={loading}
from={from}
to={to}
hideAgency={env.HIDE_AGENCIES}
/>
</div>
</div>
Expand Down

0 comments on commit a2d8148

Please sign in to comment.