From ad3ab0141e48e0555e13803945bd4bb2b41df978 Mon Sep 17 00:00:00 2001 From: Jong Eun Lee Date: Tue, 12 Nov 2024 20:26:14 +0800 Subject: [PATCH] feat: Main layout NEO header --- react/package.json | 1 + react/pnpm-lock.yaml | 3 + react/src/components/BAIMenu.tsx | 67 +++------ .../src/components/BAINotificationButton.tsx | 32 +++-- react/src/components/BAISelect.tsx | 52 ++++++- .../components/LoginSessionExtendButton.tsx | 84 +++++++----- .../src/components/MainLayout/WebUIHeader.css | 8 -- .../src/components/MainLayout/WebUIHeader.tsx | 128 ++++++++++-------- react/src/components/ProjectSelect.tsx | 7 +- react/src/components/ReverseThemeProvider.tsx | 29 ++++ react/src/components/UserDropdownMenu.tsx | 74 +++++----- react/src/components/WEBUIHelpButton.tsx | 1 - .../src/components/WebUIThemeToggleButton.tsx | 1 - resources/i18n/de.json | 4 +- resources/i18n/el.json | 4 +- resources/i18n/en.json | 4 +- resources/i18n/es.json | 4 +- resources/i18n/fi.json | 4 +- resources/i18n/fr.json | 4 +- resources/i18n/id.json | 4 +- resources/i18n/it.json | 4 +- resources/i18n/ja.json | 4 +- resources/i18n/ko.json | 6 +- resources/i18n/mn.json | 4 +- resources/i18n/ms.json | 4 +- resources/i18n/pl.json | 4 +- resources/i18n/pt-BR.json | 4 +- resources/i18n/pt.json | 4 +- resources/i18n/ru.json | 4 +- resources/i18n/th.json | 4 +- resources/i18n/tr.json | 4 +- resources/i18n/vi.json | 4 +- resources/i18n/zh-CN.json | 4 +- resources/i18n/zh-TW.json | 4 +- resources/theme.json | 25 ++-- 35 files changed, 353 insertions(+), 245 deletions(-) delete mode 100644 react/src/components/MainLayout/WebUIHeader.css create mode 100644 react/src/components/ReverseThemeProvider.tsx diff --git a/react/package.json b/react/package.json index f6f87cb828..d9eec91688 100644 --- a/react/package.json +++ b/react/package.json @@ -26,6 +26,7 @@ "ansi_up": "^6.0.2", "antd": "^5.20.0", "antd-style": "^3.6.2", + "classnames": "^2.5.1", "dayjs": "^1.11.12", "graphql": "^16.9.0", "i18next": "^23.12.2", diff --git a/react/pnpm-lock.yaml b/react/pnpm-lock.yaml index acb99c74f8..4483bdb2cd 100644 --- a/react/pnpm-lock.yaml +++ b/react/pnpm-lock.yaml @@ -77,6 +77,9 @@ importers: antd-style: specifier: ^3.6.2 version: 3.6.2(@types/react@18.3.3)(antd@5.20.0(date-fns@2.30.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + classnames: + specifier: ^2.5.1 + version: 2.5.1 dayjs: specifier: ^1.11.12 version: 1.11.12 diff --git a/react/src/components/BAIMenu.tsx b/react/src/components/BAIMenu.tsx index 397124b750..480d50cce7 100644 --- a/react/src/components/BAIMenu.tsx +++ b/react/src/components/BAIMenu.tsx @@ -1,56 +1,29 @@ -import { ConfigProvider, Menu, MenuProps, theme } from 'antd'; +import { ConfigProvider, Menu, MenuProps } from 'antd'; import React from 'react'; -// interface BAIMenuProps extends MenuProps { - -// } - const BAIMenu: React.FC = ({ ...props }) => { - const { token } = theme.useToken(); return ( - <> - - + - - - + // mode="" + {...props} + className="bai-menu" + /> + ); }; diff --git a/react/src/components/BAINotificationButton.tsx b/react/src/components/BAINotificationButton.tsx index 453c10efcb..2cbd2905e0 100644 --- a/react/src/components/BAINotificationButton.tsx +++ b/react/src/components/BAINotificationButton.tsx @@ -10,10 +10,15 @@ import { atom, useAtom } from 'jotai'; import _ from 'lodash'; import React, { useEffect } from 'react'; -interface Props extends ButtonProps {} +interface Props extends ButtonProps { + buttonRender?: (defaultButton: React.ReactNode) => React.ReactNode; +} export const isOpenDrawerState = atom(false); -const BAINotificationButton: React.FC = ({ ...props }) => { +const BAINotificationButton: React.FC = ({ + buttonRender = (btn) => btn, + ...props +}) => { const [notifications, { upsertNotification }] = useBAINotificationState(); useBAINotificationEffect(); @@ -33,17 +38,18 @@ const BAINotificationButton: React.FC = ({ ...props }) => { }); return ( <> - + +