From 7c796cbdb0f2a4afeb12a2e0daa5bcb211abb81b Mon Sep 17 00:00:00 2001 From: ruchi Date: Thu, 8 Apr 2021 17:00:31 -0400 Subject: [PATCH 1/4] message --- src/App.js | 2 ++ src/listings-page/ListingsPage.js | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/App.js b/src/App.js index 75af360..be57faa 100644 --- a/src/App.js +++ b/src/App.js @@ -3,6 +3,7 @@ import Footer from "./shared-components/footer-component/Footer"; import Navbar from "./shared-components/navbar-component/Navbar"; import { BrowserRouter, Route, Switch } from "react-router-dom"; import i18next from "i18next"; +import { useTranslation } from "react-i18next"; import Cookies from "js-cookie"; import HomePage from "./homePage/Homepage"; import ListingsPage from "./listings-page/ListingsPage"; @@ -30,6 +31,7 @@ function App() { const currentLanguage = langauges.find( (lang) => lang.code === currentLanguageCode ); + const { t } = useTranslation(); useEffect(() => { document.body.dir = currentLanguage.dir || "ltr"; diff --git a/src/listings-page/ListingsPage.js b/src/listings-page/ListingsPage.js index c9bbe8c..afe5953 100644 --- a/src/listings-page/ListingsPage.js +++ b/src/listings-page/ListingsPage.js @@ -17,7 +17,7 @@ import { ComboboxList, ComboboxOption, } from "@reach/combobox"; -import { formatRelative } from "date-fns"; +//import { formatRelative } from "date-fns"; import Select from "react-select"; import "@reach/combobox/styles.css"; @@ -26,6 +26,8 @@ import * as listingData from "./data/property-data.json"; import "./ListingsPage.css"; import compassImg from "./compass.svg"; +import { withTranslation } from "react-i18next"; + const libraries = ["places"]; @@ -111,7 +113,7 @@ export default function ListingsPage() { const { isLoaded, loadError } = useLoadScript({ googleMapsApiKey: `https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places&key= - AIzaSyC5TiZoTEwEcB_HUZRhe_rXrcSWW1Z5x8I`, + AIzaSyC5TiZoTEwEcB_HUZRhe_rXrcSWW1Z5x8I`, libraries, }); @@ -119,7 +121,7 @@ export default function ListingsPage() { const [selectedBeds, setSelectedBeds] = useState(null); const [selectedBaths, setSelectedBaths] = useState(null); - const [markers, setMarkers] = React.useState([]); + //const [markers, setMarkers] = React.useState([]); const [selected, setSelected] = React.useState(null); const [budget, setBudget] = useState(null); @@ -157,6 +159,7 @@ export default function ListingsPage() { setBath(e.value); }; + const { t } = this.props; return (
@@ -203,8 +206,8 @@ export default function ListingsPage() { > {listingData.Properties.map((house) => (budget >= house.PRICE || !budget) && - (bed == house.BEDS || !bed) && - (bath == house.BATHS || !bath) ? ( + (bed === house.BEDS || !bed) && + (bath === house.BATHS || !bath) ? ( Date: Thu, 8 Apr 2021 18:40:26 -0400 Subject: [PATCH 2/4] translations done --- public/assets/locales/en/translations.json | 17 +++++++- public/assets/locales/fr/translations.json | 18 ++++++++- src/listings-page/ListingsPage.js | 45 ++++++++++++++-------- src/listings-page/data/property-data.json | 21 ++++++++-- 4 files changed, 78 insertions(+), 23 deletions(-) diff --git a/public/assets/locales/en/translations.json b/public/assets/locales/en/translations.json index 7514842..6b81588 100644 --- a/public/assets/locales/en/translations.json +++ b/public/assets/locales/en/translations.json @@ -52,7 +52,22 @@ "Contact-Submit": "Submit", "Contact-Error1": "Please select an item in the list.", "Contact-Error2": "Please fill out this field.", - "Contact-Error3": "Invalid email address." + "Contact-Error3": "Invalid email address.", + + "Search-Bar":"Search your location", + "Budget":"Select Budget", + "Beds": "Number of Beds", + "Baths": "Number of Beds", + + "Any": "Any", + "Listing-Button": "Show Listing", + "FULL_DESCRIPTION_ENG":"RUN DON'T WALK to this beautiful former Jayman show home. This home has every feature and convenience you could want in a home. When you enter you will be greeted with a large entry way, open concept main floor with a very spacious chef-like kitchen, the big eat in dinning area is an entertainers dream and plenty of room in the living room as to cozy up to the fireplace. When you head upstairs the owner 's suite will impress with a gorgeous ensuite consisting of a large soaker tub, oversized shower, separate vanities, in-floor heating and 2 separate closest. You will also find a nice sized flex room, spacious laundry room up stairs, 4 piece main bathroom and 2 more bedrooms. Then head downstairs where you will find another bedroom, bathroom and Theatre room with wet bar and beverage station that is perfect for any movie lover. Must not forget that this home is air conditioned, has front and back irrigation outside and speakers throughout the house. All of this can be yours in the lake community of Auburn Bay close to all amenities and year round lake access just a short distance away", + + "listing_desc": "{{desc}}", + "listing_address": "{{address}}" + + + diff --git a/public/assets/locales/fr/translations.json b/public/assets/locales/fr/translations.json index 16472aa..2260e58 100644 --- a/public/assets/locales/fr/translations.json +++ b/public/assets/locales/fr/translations.json @@ -52,5 +52,21 @@ "Contact-Submit": "Soumettre", "Contact-Error1": "Veuillez sélectionner un élément dans la liste.", "Contact-Error2": "Veuillez remplir ce champ.", - "Contact-Error3": "Adresse e-mail invalide." + "Contact-Error3": "Adresse e-mail invalide.", + + "Search-Bar": "Rechercher", + "Budget":"Sélectionnez Budget", + "Beds": "Nombre de lits", + "Baths": "Nombre de bains", + "Any": "quelconque", + "Listing-Button": "Afficher la liste", + + "listing_desc": "{{desc}}", + "listing_address": "{{address}}" + + + + + + } \ No newline at end of file diff --git a/src/listings-page/ListingsPage.js b/src/listings-page/ListingsPage.js index 8b5acf3..969688c 100644 --- a/src/listings-page/ListingsPage.js +++ b/src/listings-page/ListingsPage.js @@ -26,8 +26,9 @@ import * as listingData from "./data/property-data.json"; import "./ListingsPage.css"; import compassImg from "./compass.svg"; -import { withTranslation } from "react-i18next"; - +import { useTranslation } from "react-i18next"; +import Cookies from "js-cookie"; +import i18next from "i18next"; const libraries = ["places"]; @@ -47,6 +48,10 @@ const center = { }; export default function ListingsPage() { + const {t} = useTranslation(); + + + const price_filter = [ { value: null, @@ -77,15 +82,15 @@ export default function ListingsPage() { }, { value: 1, - label: "One Bed", + label: "1", }, { value: 2, - label: "Two Beds", + label: "2", }, { value: 3, - label: "Three Beds", + label: "3", } ]; @@ -97,20 +102,21 @@ export default function ListingsPage() { }, { value: 1, - label: "One Bath", + label: "1", }, { value: 2, - label: "Two Baths", + label: "2", }, { value: 3, - label: "Three Baths", + label: "3", } ]; //console.log(data1[0]); + const { isLoaded, loadError } = useLoadScript({ googleMapsApiKey: `https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places&key= AIzaSyC5TiZoTEwEcB_HUZRhe_rXrcSWW1Z5x8I`, @@ -159,7 +165,7 @@ export default function ListingsPage() { setBath(e.value); }; - const { t } = this.props; + return (
@@ -170,7 +176,7 @@ export default function ListingsPage() {