Files
cal.diy/apps/web/ee/lib/helpscout/HelpscoutMenuItem.tsx
T
323524b77c Redesign help menu item (#2710)
* Seperate help menu item and contact menu item

* Add menu items

* Install react-popover

* Render contact only if support keys are present

* Adjust contact support links

* Add translations

* Add embed changes

* Adjust menu if helped is pressed

* Add items to help menu

* Change button color on selection

* Create endpoint

* Create feedback table

* Create migration file

* Write feedback to db

* Remove logs

* Add response message

* Send feedback email

* Disable submit if no rating and after submit

* Add translations

* Fix padding

* Clean up

* Clean up

* Add user feedback email to .env example

* Lint fixes and styles

* Changed onClick function to a named function and fix style

* Fix ids order

* Removed commented code and changed textarea id and name

* Fix id orders

* Change to AND operator

Co-authored-by: Omar López <[email protected]>

* Add user relation to feedback

Co-authored-by: Omar López <[email protected]>

* Add migration files

* Change rating to strings

* Change rating to strings

* Fix type errors

* WIP success & error messages

* Change success and error to boolans

* Style messages

* Add await

Co-authored-by: Omar López <[email protected]>

* Remove duplicate string

* Refactor import statement

Co-authored-by: Omar López <[email protected]>

* Change opacity of emojis

* added [email protected] email for feedback

* Add success toast

* Update .env.example

Co-authored-by: Omar López <[email protected]>

* Add tCRP route

* tCRP send email

* tCRP send email

Co-authored-by: Alan <[email protected]>
Co-authored-by: Omar López <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Peer Richelsen <[email protected]>
2022-05-24 13:29:39 +00:00

35 lines
983 B
TypeScript

import { ChatAltIcon } from "@heroicons/react/solid";
import { useState } from "react";
import { HelpScout, useChat } from "react-live-chat-loader";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { DropdownMenuItem } from "@calcom/ui/Dropdown";
import classNames from "@lib/classNames";
export default function HelpscoutMenuItem() {
const { t } = useLocale();
const [active, setActive] = useState(false);
const [state, loadChat] = useChat();
function handleClick() {
setActive(true);
loadChat({ open: true });
}
if (!process.env.NEXT_PUBLIC_HELPSCOUT_KEY) return null;
else
return (
<>
<button
onClick={handleClick}
className="flex w-full py-2 pr-4 text-sm font-medium text-neutral-700 hover:bg-gray-100 hover:text-gray-900">
{t("contact_support")}
</button>
{active && <HelpScout color="#292929" icon="message" horizontalPosition="right" zIndex="1" />}
</>
);
}