Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(settings): fix mermaid preview overflow in chat appearance (#18937)

Innei1e3cb5a17c5d
diff --git a/src/components/AntdStaticMethods/index.tsx b/src/components/AntdStaticMethods/index.tsx
index b894e19c2dc..39032d05176 100644
--- a/src/components/AntdStaticMethods/index.tsx
+++ b/src/components/AntdStaticMethods/index.tsx
@@ -1,11 +1,10 @@
// Entry component
import { App } from 'antd';
import { type ModalStaticFunctions } from 'antd/es/modal/confirm';
-import { type NotificationInstance } from 'antd/es/notification/interface';
import { memo } from 'react';
// eslint-disable-next-line import-x/no-mutable-exports
-let notification: NotificationInstance;
+let notification: ReturnType<typeof App.useApp>['notification'];
// eslint-disable-next-line import-x/no-mutable-exports
let modal: Omit<ModalStaticFunctions, 'warn'>;
diff --git a/src/features/ProfileEditor/AgentUserTools/AgentToolsSection.tsx b/src/features/ProfileEditor/AgentUserTools/AgentToolsSection.tsx
index beca52d0d70..f93aa2979ab 100644
--- a/src/features/ProfileEditor/AgentUserTools/AgentToolsSection.tsx
+++ b/src/features/ProfileEditor/AgentUserTools/AgentToolsSection.tsx
@@ -1,8 +1,8 @@
'use client';
import { upsertPluginMode } from '@lobechat/types';
-import { Dropdown, Flexbox, Icon } from '@lobehub/ui';
-import { Button, confirmModal, Text } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Button, confirmModal, DropdownMenu, Text } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { CopyIcon, PlugZapIcon, PlusIcon } from 'lucide-react';
import { memo } from 'react';
@@ -56,29 +56,17 @@ const AgentToolsSection = memo<{ agentId: string; onStartCopy: () => void }>(
const addMenuItems = [
{
- icon: <Icon icon={PlugZapIcon} />,
+ desc: t('settingAgent.agentTools.connectNew.desc'),
+ icon: PlugZapIcon,
key: 'connectNew',
- label: (
- <Flexbox>
- <Text>{t('settingAgent.agentTools.connectNew.title')}</Text>
- <Text style={{ fontSize: 12 }} type={'secondary'}>
- {t('settingAgent.agentTools.connectNew.desc')}
- </Text>
- </Flexbox>
- ),
+ label: t('settingAgent.agentTools.connectNew.title'),
onClick: () => createAgentSkillStoreModal(agentId),
},
{
- icon: <Icon icon={CopyIcon} />,
+ desc: t('settingAgent.agentTools.copy.desc'),
+ icon: CopyIcon,
key: 'copy',
- label: (
- <Flexbox>
- <Text>{t('settingAgent.agentTools.copy.title')}</Text>
- <Text style={{ fontSize: 12 }} type={'secondary'}>
- {t('settingAgent.agentTools.copy.desc')}
- </Text>
- </Flexbox>
- ),
+ label: t('settingAgent.agentTools.copy.title'),
onClick: onStartCopy,
},
];
@@ -89,16 +77,16 @@ const AgentToolsSection = memo<{ agentId: string; onStartCopy: () => void }>(
{t('settingAgent.agentTools.tabAgent')} · {agentConnectors.length}
</Text>
<Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>
- <Dropdown
- disabled={!canEdit}
- menu={{ items: addMenuItems }}
- placement={'bottomLeft'}
- trigger={['click']}
- >
- <Button icon={<Icon icon={PlusIcon} />} size={'small'} type={'text'}>
+ <DropdownMenu items={addMenuItems} placement={'bottomLeft'}>
+ <Button
+ disabled={!canEdit}
+ icon={<Icon icon={PlusIcon} />}
+ size={'small'}
+ type={'text'}
+ >
{t('settingAgent.agentTools.add')}
</Button>
- </Dropdown>
+ </DropdownMenu>
{agentConnectors.length === 0 && (
<Text style={{ fontSize: 12 }} type={'secondary'}>
diff --git a/src/features/Settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsx b/src/features/Settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsx
index 34e567cb9c3..e5ce97c3dc3 100644
--- a/src/features/Settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsx
+++ b/src/features/Settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsx
@@ -9,8 +9,8 @@ const code = `sequenceDiagram
const MermaidPreview = ({ theme }: { theme?: MermaidProps['theme'] }) => {
return (
- <Center height={280}>
- <Flexbox width={480}>
+ <Center>
+ <Flexbox style={{ maxWidth: '100%' }} width={480}>
<Mermaid theme={theme}>{code}</Mermaid>
</Flexbox>
</Center>