mirror of
https://github.com/hexastack/hexabot
synced 2025-01-22 18:45:57 +00:00
fix(frontend): make the widget stateful
This commit is contained in:
parent
402bdb872c
commit
72d24498ac
@ -8,6 +8,7 @@
|
||||
|
||||
import { Avatar, Box } from "@mui/material";
|
||||
import UiChatWidget from "hexabot-widget/src/UiChatWidget";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
import { getAvatarSrc } from "@/components/inbox/helpers/mapMessages";
|
||||
import { useConfig } from "@/hooks/useConfig";
|
||||
@ -16,7 +17,8 @@ import { EntityType, RouterType } from "@/services/types";
|
||||
|
||||
import { ChatWidgetHeader } from "./ChatWidgetHeader";
|
||||
|
||||
export const ChatWidget = ({ pathname }: { pathname: string }) => {
|
||||
export const ChatWidget = () => {
|
||||
const pathname = usePathname();
|
||||
const { apiUrl } = useConfig();
|
||||
const isVisualEditor = pathname === `/${RouterType.VISUAL_EDITOR}`;
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
import { BoxProps, Grid } from "@mui/material";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
import { ChatWidget } from "@/app-components/widget/ChatWidget";
|
||||
@ -29,7 +28,6 @@ export const Layout: React.FC<LayoutProps> = ({
|
||||
sxContent,
|
||||
...rest
|
||||
}) => {
|
||||
const pathname = usePathname();
|
||||
const [isSideBarOpen, setIsSideBarOpen] = useState(false);
|
||||
|
||||
return (
|
||||
@ -46,7 +44,7 @@ export const Layout: React.FC<LayoutProps> = ({
|
||||
<Content sx={sxContent} {...rest}>
|
||||
{children}
|
||||
</Content>
|
||||
<ChatWidget pathname={pathname} />
|
||||
<ChatWidget />
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user