2021-09-22 18:36:13 +00:00
|
|
|
import {
|
|
|
|
ClockIcon,
|
|
|
|
CreditCardIcon,
|
|
|
|
InformationCircleIcon,
|
|
|
|
UserIcon,
|
|
|
|
UsersIcon,
|
|
|
|
} from "@heroicons/react/solid";
|
2021-09-22 19:52:38 +00:00
|
|
|
import { SchedulingType } from "@prisma/client";
|
2021-09-22 18:36:13 +00:00
|
|
|
import { Prisma } from "@prisma/client";
|
2021-09-22 19:52:38 +00:00
|
|
|
import React from "react";
|
2021-09-22 18:36:13 +00:00
|
|
|
import { FormattedNumber, IntlProvider } from "react-intl";
|
|
|
|
|
2021-09-22 19:52:38 +00:00
|
|
|
import classNames from "@lib/classNames";
|
|
|
|
|
2021-09-22 18:36:13 +00:00
|
|
|
const eventTypeData = Prisma.validator<Prisma.EventTypeArgs>()({
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
length: true,
|
|
|
|
price: true,
|
|
|
|
currency: true,
|
|
|
|
schedulingType: true,
|
|
|
|
description: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
type EventType = Prisma.EventTypeGetPayload<typeof eventTypeData>;
|
2021-09-14 08:45:28 +00:00
|
|
|
|
|
|
|
export type EventTypeDescriptionProps = {
|
|
|
|
eventType: EventType;
|
|
|
|
className?: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const EventTypeDescription = ({ eventType, className }: EventTypeDescriptionProps) => {
|
|
|
|
return (
|
|
|
|
<ul className={classNames("mt-2 space-x-4 text-neutral-500 dark:text-white flex", className)}>
|
|
|
|
<li className="flex whitespace-nowrap">
|
|
|
|
<ClockIcon className="inline mt-0.5 mr-1.5 h-4 w-4 text-neutral-400" aria-hidden="true" />
|
|
|
|
{eventType.length}m
|
|
|
|
</li>
|
|
|
|
{eventType.schedulingType ? (
|
|
|
|
<li className="flex whitespace-nowrap">
|
|
|
|
<UsersIcon className="inline mt-0.5 mr-1.5 h-4 w-4 text-neutral-400" aria-hidden="true" />
|
|
|
|
{eventType.schedulingType === SchedulingType.ROUND_ROBIN && "Round Robin"}
|
|
|
|
{eventType.schedulingType === SchedulingType.COLLECTIVE && "Collective"}
|
|
|
|
</li>
|
|
|
|
) : (
|
|
|
|
<li className="flex whitespace-nowrap">
|
|
|
|
<UserIcon className="inline mt-0.5 mr-1.5 h-4 w-4 text-neutral-400" aria-hidden="true" />
|
|
|
|
1-on-1
|
|
|
|
</li>
|
|
|
|
)}
|
2021-09-22 18:36:13 +00:00
|
|
|
{eventType.price > 0 && (
|
|
|
|
<li className="flex whitespace-nowrap">
|
|
|
|
<CreditCardIcon className="inline mt-0.5 mr-1.5 h-4 w-4 text-neutral-400" aria-hidden="true" />
|
|
|
|
<IntlProvider locale="en">
|
|
|
|
<FormattedNumber
|
|
|
|
value={eventType.price / 100.0}
|
|
|
|
style="currency"
|
|
|
|
currency={eventType.currency.toUpperCase()}
|
|
|
|
/>
|
|
|
|
</IntlProvider>
|
|
|
|
</li>
|
|
|
|
)}
|
2021-09-14 08:45:28 +00:00
|
|
|
{eventType.description && (
|
|
|
|
<li className="flex">
|
|
|
|
<InformationCircleIcon
|
|
|
|
className="flex-none inline mr-1.5 mt-0.5 h-4 w-4 text-neutral-400"
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
<span>{eventType.description.substring(0, 100)}</span>
|
|
|
|
</li>
|
|
|
|
)}
|
|
|
|
</ul>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default EventTypeDescription;
|