diff --git a/web/package.json b/web/package.json index 305da2ba..354e6266 100644 --- a/web/package.json +++ b/web/package.json @@ -14,6 +14,7 @@ "@mui/joy": "^5.0.0-alpha.75", "@reduxjs/toolkit": "^1.8.1", "axios": "^0.27.2", + "classnames": "^2.3.2", "copy-to-clipboard": "^3.3.2", "highlight.js": "^11.6.0", "i18next": "^21.9.2", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 569c2d5c..90fb2a54 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.0' +lockfileVersion: '6.1' settings: autoInstallPeers: true @@ -23,6 +23,9 @@ dependencies: axios: specifier: ^0.27.2 version: 0.27.2 + classnames: + specifier: ^2.3.2 + version: 2.3.2 copy-to-clipboard: specifier: ^3.3.2 version: 3.3.2 @@ -1346,6 +1349,10 @@ packages: fsevents: 2.3.2 dev: false + /classnames@2.3.2: + resolution: {integrity: sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==} + dev: false + /clsx@1.2.1: resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==} engines: {node: '>=6'} diff --git a/web/src/components/Header.tsx b/web/src/components/Header.tsx index 5330053d..1553f3f0 100644 --- a/web/src/components/Header.tsx +++ b/web/src/components/Header.tsx @@ -1,7 +1,8 @@ +import classNames from "classnames"; import { useEffect } from "react"; import { NavLink, useLocation } from "react-router-dom"; -import { useTranslate } from "@/utils/i18n"; import { useLayoutStore, useUserStore } from "@/store/module"; +import { useTranslate } from "@/utils/i18n"; import { resolution } from "@/utils/layout"; import Icon from "./Icon"; import UserBanner from "./UserBanner"; @@ -53,9 +54,10 @@ const Header = () => { to="/" id="header-home" className={({ isActive }) => - `${ - isActive && "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" - } px-4 pr-5 py-2 rounded-full border border-transparent flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700` + classNames( + "px-4 pr-5 py-2 rounded-full border flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700", + isActive ? "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" : "border-transparent" + ) } > <> @@ -66,9 +68,10 @@ const Header = () => { to="/review" id="header-review" className={({ isActive }) => - `${ - isActive && "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" - } px-4 pr-5 py-2 rounded-full border border-transparent flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700` + classNames( + "px-4 pr-5 py-2 rounded-full border flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700", + isActive ? "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" : "border-transparent" + ) } > <> @@ -79,9 +82,10 @@ const Header = () => { to="/resources" id="header-resources" className={({ isActive }) => - `${ - isActive && "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" - } px-4 pr-5 py-2 rounded-full border border-transparent flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700` + classNames( + "px-4 pr-5 py-2 rounded-full border flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700", + isActive ? "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" : "border-transparent" + ) } > <> @@ -94,9 +98,10 @@ const Header = () => { to="/explore" id="header-explore" className={({ isActive }) => - `${ - isActive && "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" - } px-4 pr-5 py-2 rounded-full border border-transparent flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700` + classNames( + "px-4 pr-5 py-2 rounded-full border flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700", + isActive ? "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" : "border-transparent" + ) } > <> @@ -110,9 +115,10 @@ const Header = () => { to="/memo-chat" id="header-memo-chat" className={({ isActive }) => - `${ - isActive && "bg-white dark:bg-zinc-700 shadow" - } px-4 pr-5 py-2 rounded-full flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:shadow dark:hover:bg-zinc-700` + classNames( + "px-4 pr-5 py-2 rounded-full border flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700", + isActive ? "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" : "border-transparent" + ) } > <> @@ -123,9 +129,10 @@ const Header = () => { to="/archived" id="header-archived" className={({ isActive }) => - `${ - isActive && "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" - } px-4 pr-5 py-2 rounded-full border border-transparent flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700` + classNames( + "px-4 pr-5 py-2 rounded-full border flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700", + isActive ? "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" : "border-transparent" + ) } > <> @@ -136,9 +143,10 @@ const Header = () => { to="/setting" id="header-setting" className={({ isActive }) => - `${ - isActive && "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" - } px-4 pr-5 py-2 rounded-full border border-transparent flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700` + classNames( + "px-4 pr-5 py-2 rounded-full border flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700", + isActive ? "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" : "border-transparent" + ) } > <> @@ -154,9 +162,10 @@ const Header = () => { to="/auth" id="header-auth" className={({ isActive }) => - `${ - isActive && "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" - } px-4 pr-5 py-2 rounded-full border border-transparent flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700` + classNames( + "px-4 pr-5 py-2 rounded-full border flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700", + isActive ? "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" : "border-transparent" + ) } > <> diff --git a/web/src/components/MemosChat/MemosChatInput.tsx b/web/src/components/MemoChat/ChatInput.tsx similarity index 80% rename from web/src/components/MemosChat/MemosChatInput.tsx rename to web/src/components/MemoChat/ChatInput.tsx index 4c56f0c8..b33c518a 100644 --- a/web/src/components/MemosChat/MemosChatInput.tsx +++ b/web/src/components/MemoChat/ChatInput.tsx @@ -2,20 +2,15 @@ import Icon from "@/components/Icon"; import Textarea from "@mui/joy/Textarea/Textarea"; import { useTranslation } from "react-i18next"; -interface MemosChatInputProps { +interface Props { question: string; handleQuestionTextareaChange: any; setIsInIME: any; handleKeyDown: any; handleSendQuestionButtonClick: any; } -const MemosChatInput = ({ - question, - handleQuestionTextareaChange, - setIsInIME, - handleKeyDown, - handleSendQuestionButtonClick, -}: MemosChatInputProps) => { + +const ChatInput = ({ question, handleQuestionTextareaChange, setIsInIME, handleKeyDown, handleSendQuestionButtonClick }: Props) => { const { t } = useTranslation(); return ( @@ -39,4 +34,4 @@ const MemosChatInput = ({ ); }; -export default MemosChatInput; +export default ChatInput; diff --git a/web/src/components/MemosChat/MemosChatMessage.tsx b/web/src/components/MemoChat/ChatMessage.tsx similarity index 91% rename from web/src/components/MemosChat/MemosChatMessage.tsx rename to web/src/components/MemoChat/ChatMessage.tsx index 2f6901d9..1c78fea6 100644 --- a/web/src/components/MemosChat/MemosChatMessage.tsx +++ b/web/src/components/MemoChat/ChatMessage.tsx @@ -7,7 +7,7 @@ interface MessageProps { message: Message; } -const MemosChatMessage = ({ index, message }: MessageProps) => { +const ChatMessage = ({ index, message }: MessageProps) => { return (
{systemStatus.customizedProfile.name}
-- {systemStatus.customizedProfile.description || t("common.memos-slogan")} -
+{systemStatus.customizedProfile.name}
Not found
+ > + ))}