Merged in fix/BOOK-755-alert-content (pull request #3523)
fix(BOOK-755, BOOK-787): Fixed issue for phone number and sidepeeks not showing * fix(BOOK-755): Fixed issue for phone number and sidepeeks not showing * fix(BOOK-755): fix issue phonenumber alert * fix(BOOK-755): fix issue phonenumber Approved-by: Matilda Landström
This commit is contained in:
committed by
Bianca Widstam
parent
b3c4761ae5
commit
0cda37808e
@@ -1,13 +1,29 @@
|
||||
import { Alert } from "@scandic-hotels/design-system/Alert"
|
||||
import { getAlertPhoneContactData } from "@scandic-hotels/trpc/routers/contentstack/base/utils"
|
||||
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import type { AlertBlock } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
interface AlertBlockProps extends Pick<AlertBlock, "alert"> {}
|
||||
|
||||
export function AlertBlock({ alert }: AlertBlockProps) {
|
||||
export async function AlertBlock({ alert }: AlertBlockProps) {
|
||||
const caller = await serverClient()
|
||||
const contactConfig = await caller.contentstack.base.contact()
|
||||
if (!alert) {
|
||||
return null
|
||||
}
|
||||
|
||||
return <Alert {...alert} />
|
||||
const phoneContact =
|
||||
alert.phoneContact && contactConfig
|
||||
? getAlertPhoneContactData(alert, contactConfig)
|
||||
: null
|
||||
|
||||
return (
|
||||
<Alert
|
||||
{...alert}
|
||||
phoneContact={phoneContact}
|
||||
sidepeekCtaText={alert.sidepeekButton?.cta_text}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user