Files
calendar/packages/features/ee/support/lib/freshchat/FreshChatMenuItem.tsx
T
29ceaee8d2 feat: Add fresh chat to list of support integration (#7448)
* chore: add fresh chat configs to env.example

* feat: add fresh chat menu item and render

* refactor: remove some event listeners

* chore: make popover closed after the click

* refactor the code and fix some bugs

* feat: auto open chat

---------

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2023-03-08 11:30:24 +00:00

31 lines
769 B
TypeScript

import { useLocale } from "@calcom/lib/hooks/useLocale";
import { useFreshChat } from "./FreshChatProvider";
import { isFreshChatEnabled } from "./FreshChatScript";
interface FreshChatMenuItemProps {
onHelpItemSelect: () => void;
}
export default function FreshChatMenuItem(props: FreshChatMenuItemProps) {
const { onHelpItemSelect } = props;
const { t } = useLocale();
const { setActive } = useFreshChat();
if (!isFreshChatEnabled) return null;
return (
<>
<button
onClick={() => {
setActive(true);
onHelpItemSelect();
}}
className="flex w-full px-5 py-2 pr-4 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900">
{t("contact_support")}
</button>
</>
);
}