format
This commit is contained in:
@@ -86,7 +86,10 @@ export async function callTools(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tripPlan.listAccommodations) {
|
if (tripPlan.listAccommodations) {
|
||||||
ui.write("accommodations-list", getAccommodationsListProps(state.tripDetails));
|
ui.write(
|
||||||
|
"accommodations-list",
|
||||||
|
getAccommodationsListProps(state.tripDetails),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (tripPlan.bookAccommodation && tripPlan.accommodationName) {
|
if (tripPlan.bookAccommodation && tripPlan.accommodationName) {
|
||||||
ui.write("book-accommodation", {
|
ui.write("book-accommodation", {
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ export function getAccommodationsListProps(tripDetails: TripDetails) {
|
|||||||
"https://a0.muscache.com/im/pictures/11bcbeec-749c-4897-8593-1ec6f6dc04ad.jpg?im_w=720&im_format=avif",
|
"https://a0.muscache.com/im/pictures/11bcbeec-749c-4897-8593-1ec6f6dc04ad.jpg?im_w=720&im_format=avif",
|
||||||
"https://a0.muscache.com/im/pictures/prohost-api/Hosting-18327626/original/fba2e4e8-9d68-47a8-838e-dab5353e5209.jpeg?im_w=720&im_format=avif",
|
"https://a0.muscache.com/im/pictures/prohost-api/Hosting-18327626/original/fba2e4e8-9d68-47a8-838e-dab5353e5209.jpeg?im_w=720&im_format=avif",
|
||||||
"https://a0.muscache.com/im/pictures/miso/Hosting-813949239894880001/original/b2abe806-b60f-4c0b-b4e6-46808024e5b6.jpeg?im_w=720&im_format=avif",
|
"https://a0.muscache.com/im/pictures/miso/Hosting-813949239894880001/original/b2abe806-b60f-4c0b-b4e6-46808024e5b6.jpeg?im_w=720&im_format=avif",
|
||||||
"https://a0.muscache.com/im/pictures/prohost-api/Hosting-894877242638354447/original/29e50d48-1733-4c5b-9068-da4443dd7757.jpeg?im_w=720&im_format=avif",,
|
"https://a0.muscache.com/im/pictures/prohost-api/Hosting-894877242638354447/original/29e50d48-1733-4c5b-9068-da4443dd7757.jpeg?im_w=720&im_format=avif",
|
||||||
|
,
|
||||||
"https://a0.muscache.com/im/pictures/hosting/Hosting-1079897686805296552/original/b24bd803-52f2-4ca7-9389-f73c9d9b3c64.jpeg?im_w=720&im_format=avif",
|
"https://a0.muscache.com/im/pictures/hosting/Hosting-1079897686805296552/original/b24bd803-52f2-4ca7-9389-f73c9d9b3c64.jpeg?im_w=720&im_format=avif",
|
||||||
"https://a0.muscache.com/im/pictures/miso/Hosting-43730011/original/29f90186-4f83-408a-89ce-a82e520b4e36.png?im_w=720&im_format=avif",
|
"https://a0.muscache.com/im/pictures/miso/Hosting-43730011/original/29f90186-4f83-408a-89ce-a82e520b4e36.png?im_w=720&im_format=avif",
|
||||||
"https://a0.muscache.com/im/pictures/300ae0e1-fc7e-4a05-93a4-26809311ef19.jpg?im_w=720&im_format=avif",
|
"https://a0.muscache.com/im/pictures/300ae0e1-fc7e-4a05-93a4-26809311ef19.jpg?im_w=720&im_format=avif",
|
||||||
@@ -43,14 +44,16 @@ export function getAccommodationsListProps(tripDetails: TripDetails) {
|
|||||||
const shuffledImages = [...IMAGE_URLS]
|
const shuffledImages = [...IMAGE_URLS]
|
||||||
.sort(() => Math.random() - 0.5)
|
.sort(() => Math.random() - 0.5)
|
||||||
.slice(0, 6)
|
.slice(0, 6)
|
||||||
.filter((i): i is string => typeof i === "string")
|
.filter((i): i is string => typeof i === "string");
|
||||||
|
|
||||||
return Array.from({ length: 6 }, (_, index) => ({
|
return Array.from({ length: 6 }, (_, index) => ({
|
||||||
id: faker.string.uuid(),
|
id: faker.string.uuid(),
|
||||||
name: faker.location.streetAddress(),
|
name: faker.location.streetAddress(),
|
||||||
price: faker.number.int({ min: 100, max: 1000 }),
|
price: faker.number.int({ min: 100, max: 1000 }),
|
||||||
rating: Number(
|
rating: Number(
|
||||||
faker.number.float({ min: 4.0, max: 5.0, fractionDigits: 2 }).toFixed(2),
|
faker.number
|
||||||
|
.float({ min: 4.0, max: 5.0, fractionDigits: 2 })
|
||||||
|
.toFixed(2),
|
||||||
),
|
),
|
||||||
city: city,
|
city: city,
|
||||||
image: shuffledImages[index],
|
image: shuffledImages[index],
|
||||||
@@ -60,5 +63,5 @@ export function getAccommodationsListProps(tripDetails: TripDetails) {
|
|||||||
return {
|
return {
|
||||||
tripDetails,
|
tripDetails,
|
||||||
accommodations: getAccommodations(tripDetails.location),
|
accommodations: getAccommodations(tripDetails.location),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,9 @@ function SelectedAccommodation({
|
|||||||
<StarSVG fill="black" />
|
<StarSVG fill="black" />
|
||||||
{accommodation.rating}
|
{accommodation.rating}
|
||||||
</span>
|
</span>
|
||||||
<p className="text-gray-600">{capitalizeSentence(accommodation.city)}</p>
|
<p className="text-gray-600">
|
||||||
|
{capitalizeSentence(accommodation.city)}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2 text-sm text-gray-600">
|
<div className="space-y-2 text-sm text-gray-600">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
* Capitalizes the first letter of each word in a string.
|
* Capitalizes the first letter of each word in a string.
|
||||||
*/
|
*/
|
||||||
export function capitalizeSentence(string: string): string {
|
export function capitalizeSentence(string: string): string {
|
||||||
return string.split(' ').map(word => {
|
return string
|
||||||
|
.split(" ")
|
||||||
|
.map((word) => {
|
||||||
return word.charAt(0).toUpperCase() + word.slice(1);
|
return word.charAt(0).toUpperCase() + word.slice(1);
|
||||||
}).join(' ');
|
})
|
||||||
|
.join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user