Restaurants Listing
Restaurants Listing
The /restaurants route renders the full restaurant directory listing. It composes the filter sidebar, active filter chips, and a paginated grid of XRDProfileCard components. Filter state is managed by useRestaurantFilters() and synced to URL query parameters so filtered views are shareable and bookmark-able.
Route
/restaurants
Components Used
| Component | Role |
|---|---|
XRDFilters | Root filter container — wraps aside and active filter display. |
XRDFiltersAsideFilters | Collapsible sidebar with all filter groups. |
XRDFiltersActiveFilters | Horizontally scrolling active filter chip row with individual clear buttons. |
XRDFiltersCuisineFilter | Cuisine type filter group. |
XRDFiltersPriceFilter | Price range filter group. |
XRDFiltersRatingFilter | Minimum rating filter group. |
XRDFiltersLocationFilter | Neighbourhood / location filter group. |
XRDFiltersAmenitiesFilter | Amenities filter group (parking, wifi, outdoor seating, etc.). |
XRDFiltersDietaryFilter | Dietary options filter group (vegetarian, vegan, gluten-free, etc.). |
XRDProfileCard | Individual restaurant card rendered for each result. |
Data Fetching
useRestaurantFilters() runs two async fetches:
restaurants-meta— a one-timeuseAsyncDatacall (useDomain().getRestaurants({ limit: 200 })) used to derive the availablecuisines/locations/amenitiesoption lists shown in the sidebar.filtered-restaurants— auseLazyAsyncDatacall (useDomain().getRestaurants(buildQuery())) that re-runs wheneverupdateUrl()is called, so changing filters triggers a fresh API request rather than pure client-side filtering.filteredRestaurants,totalCount, andpendingare all derived from this fetch.
URL query keys (driven by updateUrl()): cuisines, locations, prices, rating, amenities, dietary. The page query is reset to undefined on every filter change.
AI Context
route: /restaurants
package: "@xenterprises/nuxt-x-restaurants"
use-when: >
Rendering the main restaurant directory listing page with filters.
Filter state is managed by useRestaurantFilters() and synced to URL
query parameters (cuisines, locations, prices, rating, amenities, dietary).
Two API calls back the page: a meta dataset for option lists and a
lazy filtered-restaurants fetch that re-runs on every filter change.
Utility Pages
Supplementary routes — /popular, /explore, /about, /contact, /list-restaurant, /privacy, /terms, /sitemap, plus the /popular/:slug redirect.
Restaurant Profile
The /restaurants/:slug layout and overview child — fetches the restaurant profile once via useDomain().getRestaurantBySlug() and renders hero, navigation, sidebar, and child route content.
