From 08b968eca5d770bb295980cf2702fd0ac0cf8026 Mon Sep 17 00:00:00 2001 From: NFish Date: Fri, 28 Feb 2025 12:25:50 +0800 Subject: [PATCH] fix: workspace selector style --- .../workplace-selector/index.tsx | 47 +++++-------------- 1 file changed, 12 insertions(+), 35 deletions(-) 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 2e50710cf0..070190267a 100644 --- a/web/app/components/header/account-dropdown/workplace-selector/index.tsx +++ b/web/app/components/header/account-dropdown/workplace-selector/index.tsx @@ -6,31 +6,14 @@ import { RiArrowDownSLine } from '@remixicon/react' import cn from '@/utils/classnames' import { switchWorkspace } from '@/service/common' import { useWorkspacesContext } from '@/context/workspace-context' -import { useProviderContext } from '@/context/provider-context' import { ToastContext } from '@/app/components/base/toast' -import { ChevronRight } from '@/app/components/base/icons/src/vender/line/arrows' -import { Check } from '@/app/components/base/icons/src/vender/line/general' - -const itemClassName = ` - flex items-center px-3 py-2 h-9 cursor-pointer rounded-lg -` -const itemIconClassName = ` - shrink-0 mr-2 flex items-center justify-center w-6 h-6 bg-[#EFF4FF] rounded-md text-xs font-medium text-text-accent -` -const itemNameClassName = ` - grow mr-2 text-sm text-text-secondary text-left -` -const itemCheckClassName = ` - shrink-0 w-4 h-4 text-text-accent -` const WorkplaceSelector = () => { const { t } = useTranslation() - const { plan } = useProviderContext() const { notify } = useContext(ToastContext) const { workspaces } = useWorkspacesContext() const currentWorkspace = workspaces.find(v => v.current) - const isFreePlan = plan.type === 'sandbox' + const handleSwitchWorkspace = async (tenant_id: string) => { try { if (currentWorkspace?.id === tenant_id) @@ -49,16 +32,17 @@ const WorkplaceSelector = () => { { ({ open }) => ( <> - -
{currentWorkspace?.name[0].toLocaleUpperCase()}
-
{currentWorkspace?.name}
- +
{currentWorkspace?.name[0].toLocaleUpperCase()}
+
+
{currentWorkspace?.name}
+ +
{ @@ -83,16 +66,10 @@ const WorkplaceSelector = () => { { workspaces.map(workspace => ( - - {({ active }) =>
handleSwitchWorkspace(workspace.id)}> -
{workspace.name[0].toLocaleUpperCase()}
-
{workspace.name}
- {workspace.current && } -
} - -
+
handleSwitchWorkspace(workspace.id)}> +
{workspace.name[0].toLocaleUpperCase()}
+
{workspace.name}
+
)) }