Skip to content

Commit

Permalink
Merge pull request #1140 from Open-Earth-Foundation/fix/on-3424-close…
Browse files Browse the repository at this point in the history
…-button-ai-chat-popup

fix: close button handler on ai chat popup
  • Loading branch information
isaaccodekill authored Feb 24, 2025
2 parents 6842ead + 1d07e69 commit b05f290
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ const EmissionBySectorChart: React.FC<EmissionBySectorChartProps> = ({
data,
lng,
}) => {
const { hideTooltip, showTooltipFromEvent } = useTooltip();
const { t: tData } = useTranslation(lng, "data");
const defaultBreakdown = SECTORS.reduce((acc, sector) => {
return {
Expand Down
32 changes: 11 additions & 21 deletions app/src/components/ChatBot/chat-popover.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
"use client";

import {
Icon,
IconButton,
PopoverHeader,
useDisclosure,
} from "@chakra-ui/react";
import { Icon, PopoverHeader, useDisclosure } from "@chakra-ui/react";
import React from "react";
import { BsStars } from "react-icons/bs";
import ChatBot from "./chat-bot";
import { useTranslation } from "@/i18n/client";
import { AskAiIcon } from "../icons";
Expand All @@ -17,11 +11,11 @@ import {
PopoverCloseTrigger,
PopoverContent,
PopoverRoot,
PopoverTitle,
PopoverTrigger,
} from "@/components/ui/popover";

import { Button } from "@/components/ui/button";
import { OpenChangeDetails } from "@zag-js/popover";

export default function ChatPopover({
lng = "en",
Expand All @@ -35,27 +29,23 @@ export default function ChatPopover({
const inputRef = React.useRef(null);
const { t } = useTranslation(lng, "chat");

const onOpenChange = (e: OpenChangeDetails) => {
if (!e.open) {
onClose();
} else {
onOpen();
}
};

return (
<>
<PopoverRoot
open={open}
initialFocusEl={() => inputRef.current}
onOpenChange={onOpen}
onOpenChange={onOpenChange}
positioning={{
placement: "top-end",
}}
// closeOnBlur={false}
// strategy="fixed"
// modifiers={[
// {
// name: "zIndex",
// enabled: true,
// phase: "write",
// fn: ({ state }) => {
// state.elements.popper.style.zIndex = "9999";
// },
// },
// ]}
>
<PopoverTrigger asChild>
<Button
Expand Down

0 comments on commit b05f290

Please sign in to comment.