2021-09-30 23:42:08 +00:00
|
|
|
import { XIcon } from "@heroicons/react/outline";
|
|
|
|
import { BadgeCheckIcon } from "@heroicons/react/solid";
|
2021-10-28 22:58:26 +00:00
|
|
|
import { Trans } from "react-i18next";
|
|
|
|
|
2022-03-16 23:36:43 +00:00
|
|
|
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
|
|
|
|
|
2021-10-28 22:58:26 +00:00
|
|
|
import { useLocale } from "@lib/hooks/useLocale";
|
2021-09-30 23:42:08 +00:00
|
|
|
|
|
|
|
import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
|
|
|
|
|
|
|
|
export default function LicenseBanner() {
|
2021-10-28 22:58:26 +00:00
|
|
|
const { t } = useLocale();
|
2021-09-30 23:42:08 +00:00
|
|
|
/*
|
2021-10-28 22:58:26 +00:00
|
|
|
Set this value to 'agree' to accept our license:
|
2022-02-01 10:19:22 +00:00
|
|
|
LICENSE: https://github.com/calcom/cal.com/blob/main/LICENSE
|
2021-09-30 23:42:08 +00:00
|
|
|
|
|
|
|
Summary of terms:
|
|
|
|
- The codebase has to stay open source, whether it was modified or not
|
|
|
|
- You can not repackage or sell the codebase
|
2022-02-11 20:55:46 +00:00
|
|
|
- Acquire a commercial license to remove these terms by visiting: cal.com/sales
|
2021-09-30 23:42:08 +00:00
|
|
|
NEXT_PUBLIC_LICENSE_CONSENT=''
|
|
|
|
*/
|
|
|
|
if (process.env.NEXT_PUBLIC_LICENSE_CONSENT === "agree") {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-02-09 00:05:13 +00:00
|
|
|
<div className="fixed inset-x-0 bottom-0 left-0 pb-2 sm:pb-5 md:left-56">
|
|
|
|
<div className="mx-auto max-w-7xl px-2 sm:px-8">
|
|
|
|
<div className="rounded-sm bg-green-600 p-2 shadow-lg sm:p-3">
|
2022-02-01 22:17:37 +00:00
|
|
|
<div className="flex flex-wrap items-center justify-between">
|
2022-02-09 00:05:13 +00:00
|
|
|
<div className="flex w-0 flex-1 items-center">
|
|
|
|
<span className="flex rounded-sm bg-green-800 p-2">
|
|
|
|
<BadgeCheckIcon className="h-6 w-6 text-white" aria-hidden="true" />
|
2021-09-30 23:42:08 +00:00
|
|
|
</span>
|
2022-02-09 00:05:13 +00:00
|
|
|
<p className="ml-3 truncate font-medium text-white">
|
2021-09-30 23:42:08 +00:00
|
|
|
<span className="inline">
|
2021-10-28 22:58:26 +00:00
|
|
|
<Trans i18nKey="accept_our_license" values={{ agree: "agree" }}>
|
2022-02-08 22:44:49 +00:00
|
|
|
Accept our license by changing the .env variable
|
2022-02-09 00:05:13 +00:00
|
|
|
<span className="bg-gray-50 bg-opacity-20 px-1">NEXT_PUBLIC_LICENSE_CONSENT</span> to
|
2021-10-28 22:58:26 +00:00
|
|
|
'agree'.
|
|
|
|
</Trans>
|
2021-09-30 23:42:08 +00:00
|
|
|
</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
2022-02-09 00:05:13 +00:00
|
|
|
<div className="order-3 mt-2 w-full flex-shrink-0 sm:order-2 sm:mt-0 sm:w-auto">
|
2021-09-30 23:42:08 +00:00
|
|
|
<Dialog>
|
|
|
|
<DialogTrigger asChild>
|
2022-02-09 00:05:13 +00:00
|
|
|
<button className="flex w-full items-center justify-center rounded-sm border border-transparent bg-white px-4 py-2 text-sm font-medium text-green-600 shadow-sm hover:bg-green-50">
|
2021-10-28 22:58:26 +00:00
|
|
|
{t("accept_license")}
|
2021-09-30 23:42:08 +00:00
|
|
|
</button>
|
|
|
|
</DialogTrigger>
|
|
|
|
<DialogContent />
|
|
|
|
</Dialog>
|
|
|
|
</div>
|
2022-02-09 00:05:13 +00:00
|
|
|
<div className="order-2 flex-shrink-0 sm:order-3 sm:ml-2">
|
2021-09-30 23:42:08 +00:00
|
|
|
<Dialog>
|
|
|
|
<DialogTrigger asChild>
|
2022-02-09 00:05:13 +00:00
|
|
|
<button className="-mr-1 flex rounded-sm p-2 hover:bg-green-500 focus:outline-none focus:ring-2 focus:ring-white">
|
2021-10-28 22:58:26 +00:00
|
|
|
<span className="sr-only">{t("dismiss")}</span>
|
2022-02-09 00:05:13 +00:00
|
|
|
<XIcon className="h-6 w-6 text-white" aria-hidden="true" />
|
2021-09-30 23:42:08 +00:00
|
|
|
</button>
|
|
|
|
</DialogTrigger>
|
|
|
|
<DialogContent />
|
|
|
|
</Dialog>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
function DialogContent() {
|
|
|
|
return (
|
|
|
|
<ConfirmationDialogContent
|
|
|
|
variety="success"
|
2021-10-28 22:58:26 +00:00
|
|
|
title={t("open_env")}
|
|
|
|
confirmBtnText={t("env_changed")}
|
|
|
|
cancelBtnText={t("cancel")}>
|
|
|
|
<Trans i18nKey="remove_banner_instructions" values={{ agree: "agree" }}>
|
2022-02-08 22:44:49 +00:00
|
|
|
To remove this banner, please open your .env file and change the
|
2022-02-09 00:05:13 +00:00
|
|
|
<span className="bg-green-400 bg-opacity-20 p-[2px] text-green-500">
|
2021-10-28 22:58:26 +00:00
|
|
|
NEXT_PUBLIC_LICENSE_CONSENT
|
2022-02-09 00:05:13 +00:00
|
|
|
</span>
|
2021-10-28 22:58:26 +00:00
|
|
|
variable to 'agreeapos;.
|
|
|
|
</Trans>
|
2022-02-09 22:32:31 +00:00
|
|
|
<h2 className="font-cal mt-8 mb-2 text-black">{t("terms_summary")}:</h2>
|
2021-09-30 23:42:08 +00:00
|
|
|
<ul className="ml-5 list-disc">
|
2021-10-28 22:58:26 +00:00
|
|
|
<li>{t("codebase_has_to_stay_opensource")}</li>
|
|
|
|
<li>{t("cannot_repackage_codebase")}</li>
|
2021-09-30 23:42:08 +00:00
|
|
|
<li>
|
2021-10-28 22:58:26 +00:00
|
|
|
{t("acquire_license")}:{" "}
|
2022-02-11 20:55:46 +00:00
|
|
|
<a className="text-blue-500 underline" href="https://cal.com/sales">
|
|
|
|
cal.com/sales
|
2021-09-30 23:42:08 +00:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</ConfirmationDialogContent>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|