[WEB-2103] chore: intercom trigger updates from sidebar and command palette helper actions (#5314)

* chore: handled intercom operations programatically.

* fix: app sidebar improvement

---------

Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so>
This commit is contained in:
guru_sainath 2024-08-06 16:02:01 +05:30 committed by GitHub
parent 2fa92fda75
commit 9715922fc1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 78 additions and 19 deletions

View file

@ -10,7 +10,7 @@ import { DiscordIcon, GithubIcon, Tooltip } from "@plane/ui";
// helpers
import { cn } from "@/helpers/common.helper";
// hooks
import { useAppTheme, useCommandPalette, useInstance } from "@/hooks/store";
import { useAppTheme, useCommandPalette, useInstance, useTransient } from "@/hooks/store";
import useOutsideClickDetector from "@/hooks/use-outside-click-detector";
import { usePlatformOS } from "@/hooks/use-platform-os";
// components
@ -45,15 +45,14 @@ export const SidebarHelpSection: React.FC<WorkspaceHelpSectionProps> = observer(
const { toggleShortcutModal } = useCommandPalette();
const { isMobile } = usePlatformOS();
const { config } = useInstance();
const { isIntercomToggle, toggleIntercom } = useTransient();
// states
const [isNeedHelpOpen, setIsNeedHelpOpen] = useState(false);
// refs
const helpOptionsRef = useRef<HTMLDivElement | null>(null);
const handleCrispWindowShow = () => {
if (window) {
window.$crisp.push(["do", "chat:show"]);
}
toggleIntercom(!isIntercomToggle);
};
useOutsideClickDetector(helpOptionsRef, () => setIsNeedHelpOpen(false));
@ -133,7 +132,7 @@ export const SidebarHelpSection: React.FC<WorkspaceHelpSectionProps> = observer(
leaveTo="transform opacity-0 scale-95"
>
<div
className={`absolute bottom-2 min-w-[10rem] ${
className={`absolute bottom-2 min-w-[10rem] z-[15] ${
isCollapsed ? "left-full" : "-left-[75px]"
} divide-y divide-custom-border-200 whitespace-nowrap rounded bg-custom-background-100 p-1 shadow-custom-shadow-xs`}
ref={helpOptionsRef}