From 792595a46fe09477467edab8d22a2f2b4d95563b Mon Sep 17 00:00:00 2001 From: Yi Date: Wed, 18 Sep 2024 18:32:33 +0800 Subject: [PATCH] update page header --- web/app/(commonLayout)/plugins/Container.tsx | 14 +++-- web/app/components/base/logo/logo-site.tsx | 12 +--- .../billing/header-billing-btn/index.tsx | 24 ++++++-- .../header/account-dropdown/index.tsx | 5 -- .../workplace-selector/index.tsx | 52 ++++++++---------- web/app/components/header/index.tsx | 33 ++++++----- web/app/components/header/nav/index.tsx | 2 +- .../plugins/plugin-setting/style.module.css | 7 +++ web/i18n/en-US/marketplace.ts | 7 ++- web/i18n/zh-Hans/marketplace.ts | 10 ++++ web/public/logo/logo.png | Bin 0 -> 6249 bytes 11 files changed, 97 insertions(+), 69 deletions(-) create mode 100644 web/app/components/plugins/plugin-setting/style.module.css create mode 100644 web/i18n/zh-Hans/marketplace.ts create mode 100644 web/public/logo/logo.png diff --git a/web/app/(commonLayout)/plugins/Container.tsx b/web/app/(commonLayout)/plugins/Container.tsx index fde3f0335c..5fee5354a2 100644 --- a/web/app/(commonLayout)/plugins/Container.tsx +++ b/web/app/(commonLayout)/plugins/Container.tsx @@ -35,8 +35,11 @@ const Container = () => { const containerRef = useRef(null) return ( -
+
@@ -96,12 +99,15 @@ const Container = () => {
-
+
- {/* Content for active tab will go here */} + {/* Filter goes here */}
+
+ {/* Plugin cards go here */} +
Drop plugin package here to install diff --git a/web/app/components/base/logo/logo-site.tsx b/web/app/components/base/logo/logo-site.tsx index a399ff3301..4b0e026afd 100644 --- a/web/app/components/base/logo/logo-site.tsx +++ b/web/app/components/base/logo/logo-site.tsx @@ -1,7 +1,6 @@ 'use client' import type { FC } from 'react' import classNames from '@/utils/classnames' -import { useSelector } from '@/context/app-context' type LogoSiteProps = { className?: string @@ -10,17 +9,10 @@ type LogoSiteProps = { const LogoSite: FC = ({ className, }) => { - const { theme } = useSelector((s) => { - return { - theme: s.theme, - } - }) - - const src = theme === 'light' ? '/logo/logo-site.png' : `/logo/logo-site-${theme}.png` return ( logo ) diff --git a/web/app/components/billing/header-billing-btn/index.tsx b/web/app/components/billing/header-billing-btn/index.tsx index a8415524fd..a5bc310d9b 100644 --- a/web/app/components/billing/header-billing-btn/index.tsx +++ b/web/app/components/billing/header-billing-btn/index.tsx @@ -7,11 +7,13 @@ import cn from '@/utils/classnames' import { useProviderContext } from '@/context/provider-context' type Props = { - onClick: () => void + onClick?: () => void + isDisplayOnly?: boolean } const HeaderBillingBtn: FC = ({ onClick, + isDisplayOnly = false, }) => { const { plan, enableBilling, isFetchedPlan } = useProviderContext() const { @@ -25,9 +27,9 @@ const HeaderBillingBtn: FC = ({ })() const classNames = (() => { if (type === Plan.professional) - return 'border-[#E0F2FE] hover:border-[#B9E6FE] bg-[#E0F2FE] text-[#026AA2]' + return `border-[#E0F2FE] ${!isDisplayOnly ? 'hover:border-[#B9E6FE]' : ''} bg-[#E0F2FE] text-[#026AA2]` if (type === Plan.team) - return 'border-[#E0EAFF] hover:border-[#C7D7FE] bg-[#E0EAFF] text-[#3538CD]' + return `border-[#E0EAFF] ${!isDisplayOnly ? 'hover:border-[#C7D7FE]' : ''} bg-[#E0EAFF] text-[#3538CD]` return '' })() @@ -35,10 +37,22 @@ const HeaderBillingBtn: FC = ({ return null if (type === Plan.sandbox) - return + return + + const handleClick = () => { + if (!isDisplayOnly && onClick) + onClick() + } return ( -
+
{name}
) diff --git a/web/app/components/header/account-dropdown/index.tsx b/web/app/components/header/account-dropdown/index.tsx index 03157ed7cb..4c42374ffd 100644 --- a/web/app/components/header/account-dropdown/index.tsx +++ b/web/app/components/header/account-dropdown/index.tsx @@ -9,7 +9,6 @@ import { Menu, Transition } from '@headlessui/react' import Indicator from '../indicator' import AccountAbout from '../account-about' import { mailToSupport } from '../utils/util' -import WorkplaceSelector from './workplace-selector' import classNames from '@/utils/classnames' import I18n from '@/context/i18n' import Avatar from '@/app/components/base/avatar' @@ -101,10 +100,6 @@ export default function AppSelector({ isMobile }: IAppSelector) {
-
-
{t('common.userProfile.workspace')}
- -
setShowAccountSettingModal({ payload: 'account' })}> diff --git a/web/app/components/header/account-dropdown/workplace-selector/index.tsx b/web/app/components/header/account-dropdown/workplace-selector/index.tsx index 801f0b3d52..b32cb13227 100644 --- a/web/app/components/header/account-dropdown/workplace-selector/index.tsx +++ b/web/app/components/header/account-dropdown/workplace-selector/index.tsx @@ -2,33 +2,20 @@ import { Fragment } from 'react' import { useContext } from 'use-context-selector' import { useTranslation } from 'react-i18next' import { Menu, Transition } from '@headlessui/react' -import s from './index.module.css' +import { RiArrowDownSLine } from '@remixicon/react' import cn from '@/utils/classnames' import { switchWorkspace } from '@/service/common' import { useWorkspacesContext } from '@/context/workspace-context' -import { ChevronRight } from '@/app/components/base/icons/src/vender/line/arrows' -import { Check } from '@/app/components/base/icons/src/vender/line/general' +import HeaderBillingBtn from '@/app/components/billing/header-billing-btn' +import { useProviderContext } from '@/context/provider-context' import { ToastContext } from '@/app/components/base/toast' -const itemClassName = ` - flex items-center px-3 py-2 h-10 cursor-pointer -` -const itemIconClassName = ` - shrink-0 mr-2 flex items-center justify-center w-6 h-6 bg-[#EFF4FF] rounded-md text-xs font-medium text-primary-600 -` -const itemNameClassName = ` - grow mr-2 text-sm text-gray-700 text-left -` -const itemCheckClassName = ` - shrink-0 w-4 h-4 text-primary-600 -` - const WorkplaceSelector = () => { const { t } = useTranslation() const { notify } = useContext(ToastContext) const { workspaces } = useWorkspacesContext() + const { enableBilling } = useProviderContext() const currentWorkspace = workspaces.find(v => v.current) - const handleSwitchWorkspace = async (tenant_id: string) => { try { if (currentWorkspace?.id === tenant_id) @@ -49,13 +36,13 @@ const WorkplaceSelector = () => { <> -
{currentWorkspace?.name[0].toLocaleUpperCase()}
-
{currentWorkspace?.name}
- +
{currentWorkspace?.name[0].toLocaleUpperCase()}
+
{currentWorkspace?.name}
+
{ -
+
+
+ {t('common.userProfile.workspace')} +
{ workspaces.map(workspace => ( -
handleSwitchWorkspace(workspace.id)}> -
{workspace.name[0].toLocaleUpperCase()}
-
{workspace.name}
- {workspace.current && } +
handleSwitchWorkspace(workspace.id)}> +
{workspace.name[0].toLocaleUpperCase()}
+
{workspace.name}
+ {enableBilling && ( +
+ +
+ )}
)) } diff --git a/web/app/components/header/index.tsx b/web/app/components/header/index.tsx index 035cc6fd1e..8f41dee938 100644 --- a/web/app/components/header/index.tsx +++ b/web/app/components/header/index.tsx @@ -16,6 +16,7 @@ import GithubStar from './github-star' import { WorkspaceProvider } from '@/context/workspace-context' import { useAppContext } from '@/context/app-context' import LogoSite from '@/app/components/base/logo/logo-site' +import WorkplaceSelector from '@/app/components/header/account-dropdown/workplace-selector' import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' import { useProviderContext } from '@/context/provider-context' import { useModalContext } from '@/context/modal-context' @@ -48,7 +49,7 @@ const Header = () => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedSegment]) return ( -
+
{isMobile &&
{ >
} - {!isMobile && <> - + {!isMobile + &&
+ - {enableBilling && ( -
- -
- )} - - } +
/
+
+ + + + {enableBilling && ( +
+ +
+ )} +
+
+ }
{isMobile && (
+
/
{enableBilling && (
@@ -94,9 +103,7 @@ const Header = () => {
- - - +
{(isMobile && isShowNavMenu) && (
diff --git a/web/app/components/header/nav/index.tsx b/web/app/components/header/nav/index.tsx index bfb4324320..de98593ddd 100644 --- a/web/app/components/header/nav/index.tsx +++ b/web/app/components/header/nav/index.tsx @@ -68,7 +68,7 @@ const Nav = ({ { curNav && isActivated && ( <> -
/
+
/
Jb&5UhoO1A z_lugEt_w7v93%-|4M4h1N4U-a@O|`;=>lH1qw}MWJ}Uc0_Z7!_&-=Vm7Za&-bM|~M zd;!vEG&*5V3${-Sy-uA6=o|(f_eA z6D!skU+0*}WngA^`sC^waBjVL!w z_cgwMa=d{ZzhmIq?PKue*`~jF5?^YX=I?Fa57HPapnhh_2mqDtT3TA#ci;_t;b*Tb zRY8Ipn>v7jDsU#$bpR!RY&t%Gyq_5QwQI)UOIw@%riu2i2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