diff --git a/libs/api/listings/data-access/src/listings.repository.ts b/libs/api/listings/data-access/src/listings.repository.ts index a4c6064b..1ff00d2f 100644 --- a/libs/api/listings/data-access/src/listings.repository.ts +++ b/libs/api/listings/data-access/src/listings.repository.ts @@ -39,7 +39,7 @@ export class ListingsRepository { let query: admin.firestore.Query; if(req.userId){ - query = collection.where('user_id', '==', req.userId).limit(5); + query = collection.where('user_id', '==', req.userId); } else{ query = collection.limit(10); @@ -206,7 +206,7 @@ export class ListingsRepository { return {unapprovedListings : listings}; } - + pageSize = 10; async getFilteredListings(req: GetFilteredListingsRequest): Promise{ try{ const listingsCollection = admin.firestore().collection('listings'); @@ -244,13 +244,13 @@ export class ListingsRepository { } if (lastListingDoc?.exists) { - query = query.startAfter(lastListingDoc).limit(5); + query = query.startAfter(lastListingDoc).limit(this.pageSize); } let loopLimit = 0; // let lastListing: Listing | undefined = undefined; // let lastQualityRating = 0; let lastSnapshot: DocumentSnapshot | undefined = undefined - while (response.listings.length < 5 && loopLimit < 25) { + while (response.listings.length < 10 && loopLimit < 25) { const queryData = await query.get(); ++loopLimit; // queryData.forEach((docSnapshot) => { @@ -302,12 +302,12 @@ export class ListingsRepository { } response.listings.push(data); - if(response.listings.length >= 5){ + if(response.listings.length >= this.pageSize){ return response; } } if (lastSnapshot) - query = query.startAfter(lastSnapshot).limit(5 - response.listings.length); + query = query.startAfter(lastSnapshot).limit(this.pageSize - response.listings.length); } return response; } diff --git a/libs/app/create-listing/feature/src/create-listing.page.html b/libs/app/create-listing/feature/src/create-listing.page.html index f3122923..ab98573b 100644 --- a/libs/app/create-listing/feature/src/create-listing.page.html +++ b/libs/app/create-listing/feature/src/create-listing.page.html @@ -48,7 +48,7 @@
- Click here to add an image of your property* + Click here to add images of your property*
diff --git a/libs/app/search/feature/src/search.page.html b/libs/app/search/feature/src/search.page.html index 448fda87..13b871d9 100644 --- a/libs/app/search/feature/src/search.page.html +++ b/libs/app/search/feature/src/search.page.html @@ -464,11 +464,10 @@ - - + +
+

No Search Results Found in {{searchQuery}}

+
diff --git a/libs/app/search/feature/src/search.page.ts b/libs/app/search/feature/src/search.page.ts index f184187c..f4638661 100644 --- a/libs/app/search/feature/src/search.page.ts +++ b/libs/app/search/feature/src/search.page.ts @@ -59,6 +59,7 @@ export class SearchPage implements OnDestroy, AfterViewInit { private markers: any[] = []; public listings: Listing[] = []; public allListings: Listing[] = []; + public noResults = false; public activeTab = 'Any'; public searchQuery = ''; @@ -89,7 +90,7 @@ export class SearchPage implements OnDestroy, AfterViewInit { public smallestProp = 99999999; public largestProp = 0; cardView = new Map(); - + searched = false; recommendationMinimum = 100000; @@ -198,6 +199,7 @@ export class SearchPage implements OnDestroy, AfterViewInit { // this.predictions = this.gmapsService.regionPredictions; // if timeout is already set, reset remaining duration clearTimeout(this.timeout); + this.searched = false; if (this.searchQuery.length == 0) { this.searchLoading = false; this.predictions = []; @@ -468,9 +470,10 @@ async loadMap() { } Templistings: Listing[] = []; - + pageSize = 10; async searchProperties(nextPage?: boolean, previousPage?: boolean) { this.predictions = []; + this.searched = false; if(!this.searchQuery){ const toast = await this.toastController.create({ message: 'Please enter an area for us to search in', @@ -503,14 +506,14 @@ async loadMap() { if (previousPage) { if (this.currentPage > 0) { this.currentPage--; - this.listings = this.allListings.slice(this.currentPage * 5, this.currentPage * 5 + 5); + this.listings = this.allListings.slice(this.currentPage * this.pageSize, this.currentPage * this.pageSize + this.pageSize); } return; } if (nextPage) { - if (this.currentPage * 5 + 5 < this.allListings.length) { + if (this.currentPage * this.pageSize + this.pageSize < this.allListings.length) { this.currentPage++; - this.listings = this.allListings.slice(this.currentPage * 5, this.currentPage * 5 + 5); + this.listings = this.allListings.slice(this.currentPage * this.pageSize, this.currentPage * this.pageSize + this.pageSize); return; } } @@ -573,7 +576,7 @@ async loadMap() { // this.allListings = []; this.allListings = this.allListings.concat(response.listings); if (nextPage) this.currentPage++; - this.listings = this.allListings.slice(this.currentPage * 5, this.currentPage * 5 + 5); + this.listings = this.allListings.slice(this.currentPage * this.pageSize, this.currentPage * this.pageSize + this.pageSize); const temp = []; @@ -642,11 +645,20 @@ async loadMap() { setTimeout(() => { this.searching = false; + this.searched = true; document.getElementById("searchButton")?.setAttribute("disabled", "false") }, 1500) } } + //no result that returns a boolean + noResult(){ + if(this.searchQuery!='' && this.listings.length == 0){ + return true; + } + return false; + } + async addMarkersToMap() { for (const listing of this.listings) { const coordinates = listing.geometry