2021-10-06 14:05:01 +00:00
|
|
|
import { useState } from "react";
|
|
|
|
|
2022-07-27 02:24:00 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2023-01-23 23:08:01 +00:00
|
|
|
import { FiX } from "@calcom/ui/components/icon";
|
2021-10-15 10:53:42 +00:00
|
|
|
|
2021-10-06 14:05:01 +00:00
|
|
|
export default function AddToHomescreen() {
|
2021-10-15 10:53:42 +00:00
|
|
|
const { t } = useLocale();
|
2021-10-06 14:05:01 +00:00
|
|
|
const [closeBanner, setCloseBanner] = useState(false);
|
|
|
|
|
|
|
|
if (typeof window !== "undefined") {
|
|
|
|
if (window.matchMedia("(display-mode: standalone)").matches) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2021-10-14 10:57:49 +00:00
|
|
|
return !closeBanner ? (
|
2021-12-14 10:39:32 +00:00
|
|
|
<div className="fixed inset-x-0 bottom-0 pb-2 sm:hidden sm:pb-5">
|
2022-02-09 00:05:13 +00:00
|
|
|
<div className="mx-auto max-w-7xl px-2 sm:px-6 lg:px-8">
|
|
|
|
<div className="rounded-lg p-2 shadow-lg sm:p-3" style={{ background: "#2F333D" }}>
|
2021-12-14 10:39:32 +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">
|
2022-03-05 15:37:46 +00:00
|
|
|
<span className="bg-brand text-brandcontrast dark:bg-darkmodebrand dark:text-darkmodebrandcontrast flex rounded-lg bg-opacity-30 p-2">
|
2021-10-14 10:57:49 +00:00
|
|
|
<svg
|
2022-02-09 00:05:13 +00:00
|
|
|
className="h-7 w-7 fill-current text-indigo-500"
|
2021-10-14 10:57:49 +00:00
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
viewBox="0 0 50 50"
|
|
|
|
enableBackground="new 0 0 50 50">
|
|
|
|
<path d="M30.3 13.7L25 8.4l-5.3 5.3-1.4-1.4L25 5.6l6.7 6.7z" />
|
|
|
|
<path d="M24 7h2v21h-2z" />
|
|
|
|
<path d="M35 40H15c-1.7 0-3-1.3-3-3V19c0-1.7 1.3-3 3-3h7v2h-7c-.6 0-1 .4-1 1v18c0 .6.4 1 1 1h20c.6 0 1-.4 1-1V19c0-.6-.4-1-1-1h-7v-2h7c1.7 0 3 1.3 3 3v18c0 1.7-1.3 3-3 3z" />
|
|
|
|
</svg>
|
|
|
|
</span>
|
2023-04-09 09:13:57 +00:00
|
|
|
<p className="text-inverted ms-3 text-xs font-medium">
|
2021-10-15 10:53:42 +00:00
|
|
|
<span className="inline">{t("add_to_homescreen")}</span>
|
2021-10-14 10:57:49 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2021-10-06 14:05:01 +00:00
|
|
|
|
2022-02-09 00:05:13 +00:00
|
|
|
<div className="order-2 flex-shrink-0 sm:order-3">
|
2021-10-14 10:57:49 +00:00
|
|
|
<button
|
|
|
|
onClick={() => setCloseBanner(true)}
|
|
|
|
type="button"
|
2022-02-09 00:05:13 +00:00
|
|
|
className="-mr-1 flex rounded-md p-2 hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-white">
|
2021-10-15 10:53:42 +00:00
|
|
|
<span className="sr-only">{t("dismiss")}</span>
|
2023-04-05 18:14:46 +00:00
|
|
|
<FiX className="text-inverted h-6 w-6" aria-hidden="true" />
|
2021-10-14 10:57:49 +00:00
|
|
|
</button>
|
2021-10-06 14:05:01 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-10-14 10:57:49 +00:00
|
|
|
</div>
|
|
|
|
) : null;
|
2021-10-06 14:05:01 +00:00
|
|
|
}
|