From 79842f5f46daefa2d3e88836e3d031f75f65a566 Mon Sep 17 00:00:00 2001 From: Mohamed Marrouchi Date: Tue, 22 Oct 2024 15:41:08 +0100 Subject: [PATCH] feat: hexabot logo in the widget header --- .../app-components/logos/HexabotLogoRound.tsx | 64 +++++++++++++++++++ .../widget/ChatWidgetHeader.tsx | 7 +- widget/src/components/ChatHeader.scss | 5 +- widget/src/components/ChatHeader.tsx | 18 +++--- widget/src/providers/SettingsProvider.tsx | 2 +- 5 files changed, 81 insertions(+), 15 deletions(-) create mode 100644 frontend/src/app-components/logos/HexabotLogoRound.tsx diff --git a/frontend/src/app-components/logos/HexabotLogoRound.tsx b/frontend/src/app-components/logos/HexabotLogoRound.tsx new file mode 100644 index 00000000..cbd79b24 --- /dev/null +++ b/frontend/src/app-components/logos/HexabotLogoRound.tsx @@ -0,0 +1,64 @@ +/* + * Copyright © 2024 Hexastack. All rights reserved. + * + * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: + * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. + * 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 { FC, SVGProps } from "react"; + +const HexabotLogoRound: FC> = ({ + width = "18", + height = "18", + ...rest +}) => { + return ( + + + + + + + + + + + ); +}; + +export default HexabotLogoRound; diff --git a/frontend/src/app-components/widget/ChatWidgetHeader.tsx b/frontend/src/app-components/widget/ChatWidgetHeader.tsx index 347a93cd..bb76d695 100644 --- a/frontend/src/app-components/widget/ChatWidgetHeader.tsx +++ b/frontend/src/app-components/widget/ChatWidgetHeader.tsx @@ -6,18 +6,19 @@ * 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 { Box, Typography } from "@mui/material"; import { useTranslate } from "@/hooks/useTranslate"; +import HexabotLogoRound from "../logos/HexabotLogoRound"; + export const ChatWidgetHeader = () => { const { t } = useTranslate(); return ( - - + + {t("title.live_chat_tester")} diff --git a/widget/src/components/ChatHeader.scss b/widget/src/components/ChatHeader.scss index 7c309d0f..6d334d2b 100644 --- a/widget/src/components/ChatHeader.scss +++ b/widget/src/components/ChatHeader.scss @@ -1,5 +1,5 @@ .sc-header { - min-height: 75px; + min-height: 64px; border-top-left-radius: 9px; border-top-right-radius: 9px; padding: 10px; @@ -20,10 +20,9 @@ .sc-header--title { align-self: center; - padding: 10px; flex: 1; user-select: none; - font-size: 20px; + font-size: 1.25rem; } .sc-header--title.enabled { diff --git a/widget/src/components/ChatHeader.tsx b/widget/src/components/ChatHeader.tsx index d2c5a565..70752c24 100644 --- a/widget/src/components/ChatHeader.tsx +++ b/widget/src/components/ChatHeader.tsx @@ -12,8 +12,9 @@ import { useColors } from '../providers/ColorProvider'; import { useSettings } from '../providers/SettingsProvider'; import { useWidget } from '../providers/WidgetProvider'; -import CloseIcon from './icons/CloseIcon'; import './ChatHeader.scss'; +import CloseIcon from './icons/CloseIcon'; +import OpenIcon from './icons/OpenIcon'; type ChatHeaderProps = PropsWithChildren; @@ -31,13 +32,14 @@ const ChatHeader: FC = ({ children }) => { children ) : ( <> - {settings.titleImageUrl && ( - - )} + + +
{settings.title}
)} diff --git a/widget/src/providers/SettingsProvider.tsx b/widget/src/providers/SettingsProvider.tsx index c020c912..f44e71a3 100644 --- a/widget/src/providers/SettingsProvider.tsx +++ b/widget/src/providers/SettingsProvider.tsx @@ -67,7 +67,7 @@ const defaultSettings: ChatSettings = { alwaysScrollToBottom: true, focusOnOpen: true, title: 'Hexabot :)', - titleImageUrl: 'https://i.pravatar.cc/300', + titleImageUrl: '', inputDisabled: false, placeholder: 'Write something...', menu: [],