From a1840426539ad75941b10c5d82b8eb936c7d74ca Mon Sep 17 00:00:00 2001 From: Innei Date: Wed, 22 Oct 2025 14:34:20 +0800 Subject: [PATCH] refactor: simplify ChatShortcutsRow and update AIShortcutButton styles - Removed unused showSettings function from ChatShortcutsRow to streamline the component. - Updated AIShortcutButton styles to use a more pronounced background for better visibility. Signed-off-by: Innei --- .../ai-chat/components/layouts/ChatShortcutsRow.tsx | 11 ++--------- .../ai-chat/components/ui/AIShortcutButton.tsx | 4 ++-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatShortcutsRow.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatShortcutsRow.tsx index 84ffe2540..9304c4668 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatShortcutsRow.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatShortcutsRow.tsx @@ -1,11 +1,8 @@ import { DEFAULT_SHORTCUT_TARGETS } from "@follow/shared/settings/interface" -import { nextFrame } from "@follow/utils" import { useCallback, useMemo } from "react" import { useTranslation } from "react-i18next" import { useAISettingValue } from "~/atoms/settings/ai" -import { useSettingModal } from "~/modules/settings/modal/use-setting-modal-hack" -import { AI_SETTING_SECTION_IDS } from "~/modules/settings/tabs/ai" import { useCreateAIShortcutModal } from "~/modules/settings/tabs/ai/shortcuts/hooks" import type { ShortcutData } from "../../editor/plugins/shortcut/types" @@ -20,7 +17,6 @@ export const ChatShortcutsRow: React.FC = ({ onSelect }) const { t } = useTranslation("ai") const aiSettings = useAISettingValue() const mainEntryId = useMainEntryId() - const showSettings = useSettingModal() const shortcutsToDisplay = useMemo(() => { const shortcuts = aiSettings.shortcuts ?? [] @@ -46,11 +42,8 @@ export const ChatShortcutsRow: React.FC = ({ onSelect }) const handleAddShortcut = useCreateAIShortcutModal() const handleCustomize = useCallback(() => { - showSettings({ tab: "ai", section: AI_SETTING_SECTION_IDS.shortcuts }) - nextFrame(() => { - handleAddShortcut() - }) - }, [handleAddShortcut, showSettings]) + handleAddShortcut() + }, [handleAddShortcut]) return (
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/ui/AIShortcutButton.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/ui/AIShortcutButton.tsx index c6124ce03..9ee3b9e46 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/components/ui/AIShortcutButton.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/ui/AIShortcutButton.tsx @@ -8,7 +8,7 @@ import type { ReactNode } from "react" const aiShortcutButtonVariants = cva( [ // Base styles - "inline-flex items-center gap-2 rounded-full font-medium transition-shadow", + "inline-flex items-center gap-2 rounded-full font-medium", "hover:shadow-sm whitespace-nowrap", "backdrop-blur-background", ], @@ -20,7 +20,7 @@ const aiShortcutButtonVariants = cva( }, variant: { default: [ - "hover:bg-material-thick bg-material-thin", + "hover:bg-material-thick bg-material-ultra-thick", "border-border/50 hover:border-border border", "text-text hover:text-text", ],