
* added base logic for team billing - moved Stripe customer related logic to customer.ts - implemented unstable logic for team owner upgrading, downgrading and adding/removing seats * logic improvements * - improved Alert style - hide free team members on public team page - upgraded textarea to ui component TextArea in SAML setup - added Alert on team settings for hidden members - hide CreateEventTypeButton if not admin - fixed missing locale strings in team settings * remove random import * - show hidden status on team list - refactor team pill * - improved logic (mostly functional) - added Alerts for members & owners - added local strings - created upgrade modal - added info notice on invite member modal - fixed router redirect after leaving team * - improved logic in team-billing - error display on upgrade modal - added better launch.json for VSCode debugger - fixed bug with missing inviteeUserId * code cleanup * nit pick fixes i should sleep now * fixed leave team bug - quantity would not decrease upon leave or removal * added stripe billing callback handler * - better launch.json - teams empty component * - fixed error not removing after successful pro upgrade - fixed silent fail on team create name conflict - fixed input border radius on member invite modal * updated local strings * improved logic for edge cases, such as: - team owned by member sponsored by another team can smoothly upgrade to pro if kicked from sponsored team - logic to calculate if owner is specifically missing pro subscription (ownerIsMissingSeat) - corrected calculation of members missing seats, shouldn't care for proPaidForByTeamId as that only matters for removing member and preserving pro if they pay for it themselves - added react query devtools - added missing locale string * - allow type override for LinkIconButton - consolidate filter logic for getMembersMissingSeats * - only activate team billing for hosted cal - fix prod price keys * fix requiresUpgrade when not hosted by cal * added HOSTED_CAL_FEATURES * fixed failing build - fixed broken import path - added support for premium price plan. (will consider premium as a valid seat) - remove rouge console log * fix customer id type error Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
75 lines
2.6 KiB
TypeScript
75 lines
2.6 KiB
TypeScript
import { ClockIcon, CreditCardIcon, UserIcon, UsersIcon } from "@heroicons/react/solid";
|
|
import { SchedulingType } from "@prisma/client";
|
|
import { Prisma } from "@prisma/client";
|
|
import React from "react";
|
|
import { FormattedNumber, IntlProvider } from "react-intl";
|
|
|
|
import classNames from "@lib/classNames";
|
|
import { useLocale } from "@lib/hooks/useLocale";
|
|
|
|
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>;
|
|
|
|
export type EventTypeDescriptionProps = {
|
|
eventType: EventType;
|
|
className?: string;
|
|
};
|
|
|
|
export const EventTypeDescription = ({ eventType, className }: EventTypeDescriptionProps) => {
|
|
const { t } = useLocale();
|
|
|
|
return (
|
|
<>
|
|
<div className={classNames("text-neutral-500 dark:text-white", className)}>
|
|
{eventType.description && (
|
|
<h2 className="opacity-60 text-ellipsis overflow-hidden max-w-[280px] sm:max-w-[500px]">
|
|
{eventType.description.substring(0, 100)}
|
|
{eventType.description.length > 100 && "..."}
|
|
</h2>
|
|
)}
|
|
<ul className="flex mt-2 space-x-4 rtl:space-x-reverse ">
|
|
<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 && t("round_robin")}
|
|
{eventType.schedulingType === SchedulingType.COLLECTIVE && t("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" />
|
|
{t("1_on_1")}
|
|
</li>
|
|
)}
|
|
{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>
|
|
)}
|
|
</ul>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default EventTypeDescription;
|