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 <tukon479@gmail.com>
This commit is contained in:
+2
-9
@@ -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<ChatShortcutsRowProps> = ({ 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<ChatShortcutsRowProps> = ({ onSelect })
|
||||
|
||||
const handleAddShortcut = useCreateAIShortcutModal()
|
||||
const handleCustomize = useCallback(() => {
|
||||
showSettings({ tab: "ai", section: AI_SETTING_SECTION_IDS.shortcuts })
|
||||
nextFrame(() => {
|
||||
handleAddShortcut()
|
||||
})
|
||||
}, [handleAddShortcut, showSettings])
|
||||
handleAddShortcut()
|
||||
}, [handleAddShortcut])
|
||||
|
||||
return (
|
||||
<div className="mb-3 px-1">
|
||||
|
||||
@@ -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",
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user