From ff820d1f31fd4ab81ac690d56f763e1329819514 Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Tue, 11 Feb 2025 12:05:44 +0000 Subject: [PATCH] Merged in feat/SW-1454-listing-skeletons (pull request #1301) Feat/SW-1454 listing skeletons * feat(SW-1453): added skeleton for city listning * feat(SW-1454): added skeleton for hotel listning Approved-by: Fredrik Thorsson --- .../CityListingItemSkeleton.tsx | 32 ++++++++ .../CityListing/CityListingSkeleton.tsx | 20 +++++ .../DestinationPage/CityListing/index.tsx | 15 +++- .../DestinationCityPage/index.tsx | 8 +- .../DestinationCountryPage/index.tsx | 16 ++-- .../ExperienceList/ExperienceListSkeleton.tsx | 15 ++++ .../DestinationPage/HotelListing/Client.tsx | 72 +++++++++++++++++ .../HotelListingItemSkeleton.tsx | 41 ++++++++++ .../HotelListing/HotelListingSkeleton.tsx | 22 ++++++ .../DestinationPage/HotelListing/index.tsx | 77 +++---------------- lib/trpc/memoizedRequests/index.ts | 17 ++++ .../contentstack/destinationCityPage/input.ts | 5 ++ .../contentstack/destinationCityPage/query.ts | 23 ++++-- .../contentstack/destinationCityPage/utils.ts | 31 -------- .../destinationCountryPage/input.ts | 7 ++ .../destinationCountryPage/query.ts | 30 +++++--- server/routers/hotels/utils.ts | 29 +++++++ 17 files changed, 325 insertions(+), 135 deletions(-) create mode 100644 components/ContentType/DestinationPage/CityListing/CityListingItem/CityListingItemSkeleton.tsx create mode 100644 components/ContentType/DestinationPage/CityListing/CityListingSkeleton.tsx create mode 100644 components/ContentType/DestinationPage/ExperienceList/ExperienceListSkeleton.tsx create mode 100644 components/ContentType/DestinationPage/HotelListing/Client.tsx create mode 100644 components/ContentType/DestinationPage/HotelListing/HotelListingItem/HotelListingItemSkeleton.tsx create mode 100644 components/ContentType/DestinationPage/HotelListing/HotelListingSkeleton.tsx create mode 100644 server/routers/contentstack/destinationCityPage/input.ts create mode 100644 server/routers/contentstack/destinationCountryPage/input.ts diff --git a/components/ContentType/DestinationPage/CityListing/CityListingItem/CityListingItemSkeleton.tsx b/components/ContentType/DestinationPage/CityListing/CityListingItem/CityListingItemSkeleton.tsx new file mode 100644 index 000000000..fdc4bee8a --- /dev/null +++ b/components/ContentType/DestinationPage/CityListing/CityListingItem/CityListingItemSkeleton.tsx @@ -0,0 +1,32 @@ +import SkeletonShimmer from "@/components/SkeletonShimmer" +import Divider from "@/components/TempDesignSystem/Divider" + +import ExperienceListSkeleton from "../../ExperienceList/ExperienceListSkeleton" + +import styles from "./cityListingItem.module.css" + +export default async function CityListingItemSkeleton() { + return ( +
+
+ +
+
+ + +
+ + + + +
+ + + +
+ +
+
+
+ ) +} diff --git a/components/ContentType/DestinationPage/CityListing/CityListingSkeleton.tsx b/components/ContentType/DestinationPage/CityListing/CityListingSkeleton.tsx new file mode 100644 index 000000000..c1aa68a69 --- /dev/null +++ b/components/ContentType/DestinationPage/CityListing/CityListingSkeleton.tsx @@ -0,0 +1,20 @@ +import SkeletonShimmer from "@/components/SkeletonShimmer" + +import CityListingItemSkeleton from "./CityListingItem/CityListingItemSkeleton" + +import styles from "./cityListing.module.css" + +export default async function CityListingSkeleton() { + return ( +
+
+ +
+ +
+ ) +} diff --git a/components/ContentType/DestinationPage/CityListing/index.tsx b/components/ContentType/DestinationPage/CityListing/index.tsx index 6eda28805..9ad557f8f 100644 --- a/components/ContentType/DestinationPage/CityListing/index.tsx +++ b/components/ContentType/DestinationPage/CityListing/index.tsx @@ -1,3 +1,5 @@ +import { getDestinationCityPagesByCountry } from "@/lib/trpc/memoizedRequests" + import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import { getIntl } from "@/i18n" @@ -5,18 +7,23 @@ import CityListingItem from "./CityListingItem" import styles from "./cityListing.module.css" -import type { DestinationCityListItem } from "@/types/trpc/routers/contentstack/destinationCityPage" +import type { Country } from "@/types/enums/country" interface CityListingProps { - cities: DestinationCityListItem[] + country: Country } -export default async function CityListing({ cities }: CityListingProps) { +export default async function CityListing({ country }: CityListingProps) { const intl = await getIntl() + const cities = await getDestinationCityPagesByCountry(country) + + if (!cities.length) { + return null + } return (
-
+
{intl.formatMessage( { diff --git a/components/ContentType/DestinationPage/DestinationCityPage/index.tsx b/components/ContentType/DestinationPage/DestinationCityPage/index.tsx index 7aa6fccac..38b1604d2 100644 --- a/components/ContentType/DestinationPage/DestinationCityPage/index.tsx +++ b/components/ContentType/DestinationPage/DestinationCityPage/index.tsx @@ -11,6 +11,7 @@ import TrackingSDK from "@/components/TrackingSDK" import ExperienceList from "../ExperienceList" import HotelListing from "../HotelListing" +import HotelListingSkeleton from "../HotelListing/HotelListingSkeleton" import SidebarContentWrapper from "../SidebarContentWrapper" import DestinationPageSidePeek from "../Sidepeek" import StaticMap from "../StaticMap" @@ -27,7 +28,7 @@ export default async function DestinationCityPage() { return null } - const { tracking, destinationCityPage, hotels } = pageData + const { tracking, destinationCityPage, cityIdentifier } = pageData const { blocks, images, @@ -54,8 +55,9 @@ export default async function DestinationCityPage() { />
- - + }> + + {blocks && }