2023-04-21 23:57:53 +00:00
|
|
|
import { useSession } from "next-auth/react";
|
|
|
|
import Link from "next/link";
|
|
|
|
|
|
|
|
import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
|
|
|
|
import { APP_NAME, POWERED_BY_URL } from "@calcom/lib/constants";
|
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
|
|
|
2023-05-05 07:36:23 +00:00
|
|
|
const PoweredByCal = ({ logoOnly }: { logoOnly?: boolean }) => {
|
2023-04-21 23:57:53 +00:00
|
|
|
const { t } = useLocale();
|
|
|
|
const session = useSession();
|
|
|
|
const isEmbed = useIsEmbed();
|
|
|
|
const hasValidLicense = session.data ? session.data.hasValidLicense : null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={"p-2 text-center text-xs sm:text-right" + (isEmbed ? " max-w-3xl" : "")}>
|
2023-05-05 07:36:23 +00:00
|
|
|
<Link href={POWERED_BY_URL} target="_blank" className="text-subtle">
|
|
|
|
{!logoOnly && <>{t("powered_by")} </>}
|
2023-04-21 23:57:53 +00:00
|
|
|
{APP_NAME === "Cal.com" || !hasValidLicense ? (
|
|
|
|
<>
|
|
|
|
<img
|
2023-05-05 07:36:23 +00:00
|
|
|
className="relative -mt-px inline h-[10px] w-auto dark:invert"
|
|
|
|
src="/api/logo"
|
2023-04-21 23:57:53 +00:00
|
|
|
alt="Cal.com Logo"
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
) : (
|
2023-05-05 07:36:23 +00:00
|
|
|
<span className="text-emphasis font-semibold opacity-50 hover:opacity-100">{APP_NAME}</span>
|
2023-04-21 23:57:53 +00:00
|
|
|
)}
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default PoweredByCal;
|