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.

refactor: consolidate imports and add electron styling to theme/lang buttons (#13495)

Innei8b445a1dc3a8
diff --git a/src/features/User/UserPanel/LangButton.tsx b/src/features/User/UserPanel/LangButton.tsx
index 2858b8e4131..6b301a2958f 100644
--- a/src/features/User/UserPanel/LangButton.tsx
+++ b/src/features/User/UserPanel/LangButton.tsx
@@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next';
import { localeOptions } from '@/locales/resources';
import { useGlobalStore } from '@/store/global';
import { globalGeneralSelectors } from '@/store/global/selectors';
+import { electronStylish } from '@/styles/electron';
const LangButton = memo<{ placement?: DropdownMenuProps['placement']; size?: number }>(
({ placement, size }) => {
@@ -101,6 +102,7 @@ const LangButton = memo<{ placement?: DropdownMenuProps['placement']; size?: num
placement={placement}
trigger="hover"
popupProps={{
+ className: electronStylish.nodrag,
style: {
maxHeight: 360,
minWidth: 240,
diff --git a/src/features/User/UserPanel/ThemeButton.tsx b/src/features/User/UserPanel/ThemeButton.tsx
index d300c4144e9..6fee0de1f29 100644
--- a/src/features/User/UserPanel/ThemeButton.tsx
+++ b/src/features/User/UserPanel/ThemeButton.tsx
@@ -2,10 +2,11 @@ import { type DropdownMenuProps } from '@lobehub/ui';
import { ActionIcon, DropdownMenu, Icon } from '@lobehub/ui';
import { Monitor, Moon, Sun } from 'lucide-react';
import { useTheme as useNextThemesTheme } from 'next-themes';
-import { type FC } from 'react';
-import { useMemo } from 'react';
+import { type FC, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import { electronStylish } from '@/styles/electron';
+
const themeIcons = {
dark: Moon,
light: Sun,
@@ -45,7 +46,11 @@ const ThemeButton: FC<{ placement?: DropdownMenuProps['placement']; size?: numbe
);
return (
- <DropdownMenu items={items} placement={placement}>
+ <DropdownMenu
+ items={items}
+ placement={placement}
+ popupProps={{ className: electronStylish.nodrag }}
+ >
<ActionIcon
icon={themeIcons[(theme as 'dark' | 'light' | 'system') || 'system']}
size={size || { blockSize: 32, size: 16 }}