diff --git a/frontend/src/layout/Header.tsx b/frontend/src/layout/Header.tsx index 6f773062..bf58c835 100644 --- a/frontend/src/layout/Header.tsx +++ b/frontend/src/layout/Header.tsx @@ -6,6 +6,7 @@ * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ +import ChatIcon from "@mui/icons-material/Chat"; import MenuIcon from "@mui/icons-material/Menu"; import { Avatar, @@ -17,6 +18,8 @@ import { styled, } from "@mui/material"; import MuiAppBar, { AppBarProps as MuiAppBarProps } from "@mui/material/AppBar"; +import UiChatWidget from "hexabot-widget/src/UiChatWidget"; +import { usePathname } from "next/navigation"; import { FC, useEffect, useRef, useState } from "react"; import { HexabotLogo } from "@/app-components/logos/HexabotLogo"; @@ -25,7 +28,8 @@ import { getAvatarSrc } from "@/components/inbox/helpers/mapMessages"; import { useAuth } from "@/hooks/useAuth"; import { useConfig } from "@/hooks/useConfig"; import { useTranslate } from "@/hooks/useTranslate"; -import { EntityType } from "@/services/types"; +import i18n from "@/i18n/config"; +import { EntityType, RouterType } from "@/services/types"; import { getRandom } from "@/utils/safeRandom"; import { borderLine, theme } from "./themes/theme"; @@ -72,8 +76,23 @@ export type HeaderProps = { isSideBarOpen: boolean; onToggleSidebar: () => void; }; + +const CustomWidgetHeader = () => { + const { t } = useTranslate(); + + return ( + + + + {t("title.live_chat_tester")} + + + ); +}; + export const Header: FC = ({ isSideBarOpen, onToggleSidebar }) => { const { apiUrl, ssoEnabled } = useConfig(); + const pathname = usePathname(); const { t } = useTranslate(); const anchorRef = useRef(null); const [isMenuPopoverOpen, setIsMenuPopoverOpen] = useState(false); @@ -88,6 +107,8 @@ export const Header: FC = ({ isSideBarOpen, onToggleSidebar }) => { setRandomSeed(getRandom().toString()); }, [user]); + const isVisualEditor = pathname === `/${RouterType.VISUAL_EDITOR}`; + return ( @@ -193,6 +214,24 @@ export const Header: FC = ({ isSideBarOpen, onToggleSidebar }) => { ) : null} ) : null} + + + ( + + )} + /> + ); diff --git a/frontend/src/pages/visual-editor.tsx b/frontend/src/pages/visual-editor.tsx index 107959b9..45fd4194 100644 --- a/frontend/src/pages/visual-editor.tsx +++ b/frontend/src/pages/visual-editor.tsx @@ -6,52 +6,15 @@ * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ -import ChatIcon from "@mui/icons-material/Chat"; -import { Avatar, Box, Typography } from "@mui/material"; -import UiChatWidget from "hexabot-widget/src/UiChatWidget"; import { ReactElement } from "react"; -import { getAvatarSrc } from "@/components/inbox/helpers/mapMessages"; import { VisualEditor } from "@/components/visual-editor"; -import { useConfig } from "@/hooks/useConfig"; -import { useTranslate } from "@/hooks/useTranslate"; -import i18n from "@/i18n/config"; import { Layout } from "@/layout"; -import { EntityType } from "@/services/types"; -const CustomWidgetHeader = () => { - const { t } = useTranslate(); - - return ( - - - - {t("title.live_chat_tester")} - - - ); -}; const VisualEditorPage = () => { - const { apiUrl } = useConfig(); - return ( <> - ( - - )} - /> ); };