feat (SW-2864): Move booking router to trpc package * Add env to trpc package * Add eslint to trpc package * Apply lint rules * Use direct imports from trpc package * Add lint-staged config to trpc * Move lang enum to common * Restructure trpc package folder structure * WIP first step * update internal imports in trpc * Fix most errors in scandic-web Just 100 left... * Move Props type out of trpc * Fix CategorizedFilters types * Move more schemas in hotel router * Fix deps * fix getNonContentstackUrls * Fix import error * Fix entry error handling * Fix generateMetadata metrics * Fix alertType enum * Fix duplicated types * lint:fix * Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package * Fix broken imports * Move booking router to trpc package * Merge branch 'master' into feat/sw-2864-move-hotels-router-to-trpc-package Approved-by: Linus Flood
93 lines
2.7 KiB
TypeScript
93 lines
2.7 KiB
TypeScript
"use client"
|
|
|
|
import { useState } from "react"
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { Button } from "@scandic-hotels/design-system/Button"
|
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
|
|
import ButtonLink from "@/components/ButtonLink"
|
|
import Modal from "@/components/Modal"
|
|
import useWakeLock from "@/hooks/useWakeLock"
|
|
|
|
import DigitalTeamMemberCardContent from "./Content"
|
|
|
|
import styles from "./digitalTeamMemberCard.module.css"
|
|
|
|
import type { User } from "@scandic-hotels/trpc/types/user"
|
|
|
|
interface DigitalTeamMemberCardClientProps {
|
|
user: User
|
|
}
|
|
|
|
export default function DigitalTeamMemberCardClient({
|
|
user,
|
|
}: DigitalTeamMemberCardClientProps) {
|
|
const intl = useIntl()
|
|
const [isOpen, setIsOpen] = useState(false)
|
|
|
|
const { release, request } = useWakeLock({
|
|
reacquireOnPageVisible: true,
|
|
})
|
|
|
|
function onToggle(modalState: boolean) {
|
|
setIsOpen(modalState)
|
|
if (modalState) {
|
|
request()
|
|
} else {
|
|
release()
|
|
}
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Button
|
|
className={styles.button}
|
|
onPress={() => onToggle(true)}
|
|
variant="Tertiary"
|
|
typography="Body/Paragraph/mdBold"
|
|
>
|
|
<span className={styles.text}>
|
|
{/* @ts-expect-error Icon is supported in font, just not in React Material Symbols package */}
|
|
<MaterialIcon icon="id_card" size={24} color="CurrentColor" />
|
|
{intl.formatMessage({
|
|
defaultMessage: "Show Team Member Card",
|
|
})}
|
|
</span>
|
|
</Button>
|
|
<Modal onToggle={onToggle} isOpen={isOpen} className={styles.modal}>
|
|
<Typography variant="Title/xs">
|
|
<h2 className={styles.title}>
|
|
{intl.formatMessage({ defaultMessage: "Scandic Family" })}
|
|
</h2>
|
|
</Typography>
|
|
|
|
<DigitalTeamMemberCardContent user={user} />
|
|
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<p className={styles.footer}>
|
|
{intl.formatMessage({
|
|
defaultMessage:
|
|
"Book discounted stays for yourself, family and friends!",
|
|
})}
|
|
</p>
|
|
</Typography>
|
|
<ButtonLink
|
|
href="https://scandic.fuseuniversal.com/topics/73727"
|
|
target="_blank"
|
|
variant="Tertiary"
|
|
typography="Body/Supporting text (caption)/smBold"
|
|
>
|
|
<span className={styles.link}>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Check out all your benefits",
|
|
})}
|
|
<MaterialIcon icon="open_in_new" size={20} color="CurrentColor" />
|
|
</span>
|
|
</ButtonLink>
|
|
</Modal>
|
|
</>
|
|
)
|
|
}
|