* First round of changes * Some missing styling * Last round of core changes * Color tweaks * Improving code readability * Reverting unneeded changes * Reverting yarn.lock * Removing yarn.lock * Empty state updated * Fixing webhook test * Cleaning up code * Fixing test and simplifying code a bit * Merging API Keys into developer section * Unifying Empty Screen with monorepo version * Cleaning up * Installed apps logic consistency + cleaning up * Type fixes * Apply suggestions from code review Co-authored-by: Omar López <zomars@me.com> Co-authored-by: alannnc <alannnc@gmail.com> * Improvements, still WIP * Update apps/web/pages/apps/installed.tsx Co-authored-by: Omar López <zomars@me.com> * Apply suggestions from code review Co-authored-by: Omar López <zomars@me.com> * App active install status * Apple Calendar setup, Daily.co preinstalled * Final pass * Minor tweaks * Conflicts with migration ignored * Fixing merge * Fixing merge yet again * Adopting main changes * Removing unneeded data-testid * Fixing reported bugs * Simplifying webhook query * Moving teams settings tab to second Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: alannnc <alannnc@gmail.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com>
57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
import { ExclamationIcon } from "@heroicons/react/solid";
|
|
import { useSession } from "next-auth/react";
|
|
import React, { AriaRole, ComponentType, FC, Fragment } from "react";
|
|
|
|
import { CONSOLE_URL } from "@calcom/lib/constants";
|
|
import EmptyScreen from "@calcom/ui/EmptyScreen";
|
|
|
|
type LicenseRequiredProps = {
|
|
as?: keyof JSX.IntrinsicElements | "";
|
|
className?: string;
|
|
role?: AriaRole | undefined;
|
|
children: React.ReactNode;
|
|
};
|
|
|
|
/**
|
|
* This component will only render it's children if the installation has a valid
|
|
* license.
|
|
*/
|
|
const LicenseRequired: FC<LicenseRequiredProps> = ({ children, as = "", ...rest }) => {
|
|
const session = useSession();
|
|
const Component = as || Fragment;
|
|
return (
|
|
<Component {...rest}>
|
|
{session.data?.hasValidLicense ? (
|
|
children
|
|
) : (
|
|
<EmptyScreen
|
|
Icon={ExclamationIcon}
|
|
headline="This is an enterprise feature"
|
|
description={
|
|
<>
|
|
To enable this feature, get a deployment key at{" "}
|
|
<a href={CONSOLE_URL} target="_blank" rel="noopener noreferrer" className="underline">
|
|
Cal.com console
|
|
</a>
|
|
.
|
|
</>
|
|
}
|
|
/>
|
|
)}
|
|
</Component>
|
|
);
|
|
};
|
|
|
|
export function withLicenseRequired<T>(Component: ComponentType<T>) {
|
|
// eslint-disable-next-line react/display-name
|
|
return (hocProps: T) => {
|
|
return (
|
|
<LicenseRequired>
|
|
<Component {...(hocProps as T)} />;
|
|
</LicenseRequired>
|
|
);
|
|
};
|
|
}
|
|
|
|
export default LicenseRequired;
|