Closed nathanclairmonte closed 10 months ago
These are great suggestions!! Love the idea of attaching the requests on the server side that's brilliant
Here are the changes I made from these suggestions:
/host/listing/[listingId].js
page that links to host/manage/listings/${listingId}/edit
if it's an active/past listing.RequestItemForHostListing
component, so that each individual request can have a useEffect to fetch the user info of the subTenant of that request (so we can get first name to display)
request.tenandId
instead of request.subTenantId
like we are doing now.Tabs
component, where you can give it a list of tab options (up to 6) and it will create the tabs dynamically (instead of hardcoding the tab options like we did with SubletsTabs). If you like this idea I can update the sublets pages (host and regular) to use this general tabs component instead of the SubletsTabs
component too.ACTIVE_STATUSES
and PAST_STATUSES
arrays we have previously defined.published = true
(using the /api/listings/published/[userId]
API route)/api/listings/expired/[userId]
API route)isBooked = true
(using the /api/listings/booked/[userId]
API route)ListingItemForHostSublets
component, I changed the price text to show "No Offers" for the scenario where no offers have been placed yet. Also shows nothing for past tab and the amount of the request that was confirmed for confirmed tab/listingactiverequests
API route (on both the ListingItemForHostSublets
and the host sublets page). This is defff better. One thing to note tho is that one of the listings I was looking at in testing went from "1 active bid" to "no active bids" when I used the passed-in request prop instead of the one from the API route. Not entirely sure why this is happening but I feel like once we streamline all the request logic we'll catch all the bugs like thisSome other thoughts from ur comments:
isHostMode
flag that we add to context and/or the user auth object (will be much easier to do with NextAuth too actually) that will determine whether they're in hosting mode or not, and then we display like a whole different bottom nav based on that. Maybe even like different bottom nav labels altogether too to distinguish between host mode and non-host mode?Sorry I took forever to look at your updates homie, I am finally able to use a keyboard again lmao.
The changes are great, and yeah sorry when i said requestee I meant subTenant so you assumed correct lmao.
For it going from 1 active request to no active bids its because the listingId in Request model is a string and therefore when we are doing the aggregate in the api it cant lookup a string to an ObjectId so i changed the listingId in Requests model to be ObjectId instead of string. Hopefully this doesnt mess up anything when a new request is created but we will see when we start working on that.
For the confirmed tabs prices, you're right it should never reach the else statement since every confirmed booking should have a price. This might be because of some old testing stuff where I bugged around with things even after listings were booked but we will sort all this out like you said after we sort the request/book logic so we can just leave it for now.
closes #17
Did the following things in this PR:
Host Sublets Page
/pages/host/sublets.js
page, which is visually identical to the regular/pages/sublets.js
page, except that now it checks for listings the user has created themselves (instead of checking for listings that the user has created requests for)..requests
attribute.request.status !== "confirmed"
are shownrequest.status === "confirmed"
are shownHost Listing Page
/pages/host/listing/[listingId].js
page, which is also visually very similar to the regular/pages/listing/[listingId].js
page, with a few small differences.API Routes
/api/requests/index.js
to get all requests in the DB. Using this on the new host sublets page/api/listings/published/[userId].js
to get all published listings for a given user/api/listings/expires/[userId].js
to get all expired listings for a given userComponents
ListingItemForHostSublets.js
ListingItem
-esque component, with the main difference being that this one now links to the host listing page (instead of the regular listing page)Miscellaneous
BottomNav
component to highlight the "Sublets" icon if we're on the host sublets page as well as the regular sublets page