Merged in fix/SW-2528 (pull request #2688)

fix(SW-2528): get correct restaurant type

* fix(SW-2528): get correct type


Approved-by: Erik Tiekstra
This commit is contained in:
Matilda Landström
2025-08-26 06:38:40 +00:00
parent 8180271b0f
commit 4c9605ef3f
2 changed files with 27 additions and 19 deletions

View File

@@ -26,7 +26,7 @@ export default async function RestaurantBarItem({
menus,
restaurantPage,
mainBody,
type,
restaurantType,
} = restaurant
const visibleImages = restaurant.content.images.slice(0, 2)
@@ -37,7 +37,10 @@ export default async function RestaurantBarItem({
return (
<div className={styles.restaurantBarItem}>
<div className={styles.stickyHeading}>
<MaterialIcon icon={getRestaurantIconName(type)} color="CurrentColor" />
<MaterialIcon
icon={getRestaurantIconName(restaurantType)}
color="CurrentColor"
/>
<Typography variant="Title/Subtitle/lg">
<h3>{name}</h3>
</Typography>

View File

@@ -75,23 +75,28 @@ const openingDetailsSchema = z.object({
})
export const restaurantsSchema = z.object({
attributes: z.object({
bookTableUrl: nullableStringValidator,
content: contentSchema,
elevatorPitch: z.string().optional(),
email: z.string().email().optional(),
externalBreakfast: externalBreakfastSchema,
isPublished: z.boolean().default(false),
mainBody: z.string().optional(),
menus: z.array(menuItemSchema).default([]),
name: z.string().default(""),
nameInUrl: z.string().optional(),
openingDetails: z.array(openingDetailsSchema).default([]),
phoneNumber: z.string().optional(),
restaurantPage: z.boolean().default(false),
specialAlerts: specialAlertsSchema,
type: z.string(),
}),
attributes: z
.object({
bookTableUrl: nullableStringValidator,
content: contentSchema,
elevatorPitch: z.string().optional(),
email: z.string().email().optional(),
externalBreakfast: externalBreakfastSchema,
isPublished: z.boolean().default(false),
mainBody: z.string().optional(),
menus: z.array(menuItemSchema).default([]),
name: z.string().default(""),
nameInUrl: z.string().optional(),
openingDetails: z.array(openingDetailsSchema).default([]),
phoneNumber: z.string().optional(),
restaurantPage: z.boolean().default(false),
specialAlerts: specialAlertsSchema,
type: z.string(),
})
.transform(({ type, ...rest }) => ({
...rest,
restaurantType: type,
})),
id: z.string(),
type: z.literal("restaurants"),
})