feat: update icons in Inputbar and related components for consistency

This commit is contained in:
Teo 2025-04-14 15:48:25 +08:00 committed by Asurada
parent e6b325dd88
commit 81538a5446
7 changed files with 64 additions and 45 deletions

View File

@ -1,10 +1,11 @@
import { CheckOutlined, RightOutlined } from '@ant-design/icons' import { RightOutlined } from '@ant-design/icons'
import { isMac } from '@renderer/config/constant' import { isMac } from '@renderer/config/constant'
import { classNames } from '@renderer/utils' import { classNames } from '@renderer/utils'
import { Flex } from 'antd' import { Flex } from 'antd'
import { theme } from 'antd' import { theme } from 'antd'
import Color from 'color' import Color from 'color'
import { t } from 'i18next' import { t } from 'i18next'
import { Check } from 'lucide-react'
import React, { use, useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react' import React, { use, useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react'
import styled from 'styled-components' import styled from 'styled-components'
import * as tinyPinyin from 'tiny-pinyin' import * as tinyPinyin from 'tiny-pinyin'
@ -444,7 +445,7 @@ export const QuickPanelView: React.FC<Props> = ({ setInputText }) => {
{item.suffix ? ( {item.suffix ? (
item.suffix item.suffix
) : item.isSelected ? ( ) : item.isSelected ? (
<CheckOutlined /> <Check />
) : ( ) : (
item.isMenu && !item.disabled && <RightOutlined /> item.isMenu && !item.disabled && <RightOutlined />
)} )}
@ -632,8 +633,16 @@ const QuickPanelItemLeft = styled.div`
` `
const QuickPanelItemIcon = styled.span` const QuickPanelItemIcon = styled.span`
font-size: 12px; font-size: 13px;
color: var(--color-text-3); color: var(--color-text-3);
display: flex;
align-items: center;
justify-content: center;
> svg {
width: 1em;
height: 1em;
color: var(--color-text-3);
}
` `
const QuickPanelItemLabel = styled.span` const QuickPanelItemLabel = styled.span`
@ -669,4 +678,9 @@ const QuickPanelItemSuffixIcon = styled.span`
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
gap: 3px; gap: 3px;
> svg {
width: 1em;
height: 1em;
color: var(--color-text-3);
}
` `

View File

@ -1,12 +1,4 @@
import { import { HolderOutlined } from '@ant-design/icons'
CodeOutlined,
FileSearchOutlined,
HolderOutlined,
PaperClipOutlined,
PauseCircleOutlined,
ThunderboltOutlined,
TranslationOutlined
} from '@ant-design/icons'
import { QuickPanelListItem, QuickPanelView, useQuickPanel } from '@renderer/components/QuickPanel' import { QuickPanelListItem, QuickPanelView, useQuickPanel } from '@renderer/components/QuickPanel'
import TranslateButton from '@renderer/components/TranslateButton' import TranslateButton from '@renderer/components/TranslateButton'
import { isGenerateImageModel, isVisionModel, isWebSearchModel } from '@renderer/config/models' import { isGenerateImageModel, isVisionModel, isWebSearchModel } from '@renderer/config/models'
@ -39,7 +31,22 @@ import TextArea, { TextAreaRef } from 'antd/es/input/TextArea'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import Logger from 'electron-log/renderer' import Logger from 'electron-log/renderer'
import { debounce, isEmpty } from 'lodash' import { debounce, isEmpty } from 'lodash'
import { Globe, Maximize, MessageSquareDiff, Minimize, PaintbrushVertical } from 'lucide-react' import {
AtSign,
CirclePause,
FileSearch,
FileText,
Globe,
Languages,
LucideSquareTerminal,
Maximize,
MessageSquareDiff,
Minimize,
PaintbrushVertical,
Paperclip,
Upload,
Zap
} from 'lucide-react'
import React, { CSSProperties, FC, useCallback, useEffect, useMemo, useRef, useState } from 'react' import React, { CSSProperties, FC, useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
@ -261,7 +268,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
label: fileContent.origin_name || fileContent.name, label: fileContent.origin_name || fileContent.name,
description: description:
formatFileSize(fileContent.size) + ' · ' + dayjs(fileContent.created_at).format('YYYY-MM-DD HH:mm'), formatFileSize(fileContent.size) + ' · ' + dayjs(fileContent.created_at).format('YYYY-MM-DD HH:mm'),
icon: <FileSearchOutlined />, icon: <FileText />,
isSelected: files.some((f) => f.path === fileContent.path), isSelected: files.some((f) => f.path === fileContent.path),
action: async ({ item }) => { action: async ({ item }) => {
item.isSelected = !item.isSelected item.isSelected = !item.isSelected
@ -292,7 +299,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
{ {
label: t('chat.input.upload.upload_from_local'), label: t('chat.input.upload.upload_from_local'),
description: '', description: '',
icon: <PaperClipOutlined />, icon: <Upload />,
action: () => { action: () => {
attachmentButtonRef.current?.openQuickPanel() attachmentButtonRef.current?.openQuickPanel()
} }
@ -304,7 +311,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
return { return {
label: base.name, label: base.name,
description: `${length} ${t('files.count')}`, description: `${length} ${t('files.count')}`,
icon: <FileSearchOutlined />, icon: <FileSearch />,
disabled: length === 0, disabled: length === 0,
isMenu: true, isMenu: true,
action: () => openKnowledgeFileList(base) action: () => openKnowledgeFileList(base)
@ -320,7 +327,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
{ {
label: t('settings.quickPhrase.title'), label: t('settings.quickPhrase.title'),
description: '', description: '',
icon: <ThunderboltOutlined />, icon: <Zap />,
isMenu: true, isMenu: true,
action: () => { action: () => {
quickPhrasesButtonRef.current?.openQuickPanel() quickPhrasesButtonRef.current?.openQuickPanel()
@ -329,7 +336,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
{ {
label: t('agents.edit.model.select.title'), label: t('agents.edit.model.select.title'),
description: '', description: '',
icon: '@', icon: <AtSign />,
isMenu: true, isMenu: true,
action: () => { action: () => {
mentionModelsButtonRef.current?.openQuickPanel() mentionModelsButtonRef.current?.openQuickPanel()
@ -338,7 +345,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
{ {
label: t('chat.input.knowledge_base'), label: t('chat.input.knowledge_base'),
description: '', description: '',
icon: <FileSearchOutlined />, icon: <FileSearch />,
isMenu: true, isMenu: true,
disabled: files.length > 0, disabled: files.length > 0,
action: () => { action: () => {
@ -348,7 +355,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
{ {
label: t('settings.mcp.title'), label: t('settings.mcp.title'),
description: t('settings.mcp.not_support'), description: t('settings.mcp.not_support'),
icon: <CodeOutlined />, icon: <LucideSquareTerminal />,
isMenu: true, isMenu: true,
action: () => { action: () => {
mcpToolsButtonRef.current?.openQuickPanel() mcpToolsButtonRef.current?.openQuickPanel()
@ -357,7 +364,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
{ {
label: `MCP ${t('settings.mcp.tabs.prompts')}`, label: `MCP ${t('settings.mcp.tabs.prompts')}`,
description: '', description: '',
icon: <CodeOutlined />, icon: <LucideSquareTerminal />,
isMenu: true, isMenu: true,
action: () => { action: () => {
mcpToolsButtonRef.current?.openPromptList() mcpToolsButtonRef.current?.openPromptList()
@ -366,7 +373,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
{ {
label: `MCP ${t('settings.mcp.tabs.resources')}`, label: `MCP ${t('settings.mcp.tabs.resources')}`,
description: '', description: '',
icon: <CodeOutlined />, icon: <LucideSquareTerminal />,
isMenu: true, isMenu: true,
action: () => { action: () => {
mcpToolsButtonRef.current?.openResourcesList() mcpToolsButtonRef.current?.openResourcesList()
@ -375,14 +382,14 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
{ {
label: isVisionModel(model) ? t('chat.input.upload') : t('chat.input.upload.document'), label: isVisionModel(model) ? t('chat.input.upload') : t('chat.input.upload.document'),
description: '', description: '',
icon: <PaperClipOutlined />, icon: <Paperclip />,
isMenu: true, isMenu: true,
action: openSelectFileMenu action: openSelectFileMenu
}, },
{ {
label: t('translate.title'), label: t('translate.title'),
description: t('translate.menu.description'), description: t('translate.menu.description'),
icon: <TranslationOutlined />, icon: <Languages />,
action: () => { action: () => {
if (!text) return if (!text) return
translate() translate()
@ -1009,7 +1016,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
{loading && ( {loading && (
<Tooltip placement="top" title={t('chat.input.pause')} arrow> <Tooltip placement="top" title={t('chat.input.pause')} arrow>
<ToolbarButton type="text" onClick={onPause} style={{ marginRight: -2, marginTop: 1 }}> <ToolbarButton type="text" onClick={onPause} style={{ marginRight: -2, marginTop: 1 }}>
<PauseCircleOutlined style={{ color: 'var(--color-error)', fontSize: 20 }} /> <CirclePause style={{ color: 'var(--color-error)', fontSize: 20 }} />
</ToolbarButton> </ToolbarButton>
</Tooltip> </Tooltip>
)} )}

View File

@ -1,10 +1,8 @@
import { FileSearchOutlined } from '@ant-design/icons'
import { PlusOutlined } from '@ant-design/icons'
import { QuickPanelListItem, useQuickPanel } from '@renderer/components/QuickPanel' import { QuickPanelListItem, useQuickPanel } from '@renderer/components/QuickPanel'
import { useAppSelector } from '@renderer/store' import { useAppSelector } from '@renderer/store'
import { KnowledgeBase } from '@renderer/types' import { KnowledgeBase } from '@renderer/types'
import { Tooltip } from 'antd' import { Tooltip } from 'antd'
import { FileSearch } from 'lucide-react' import { FileSearch, Plus } from 'lucide-react'
import { FC, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react' import { FC, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router' import { useNavigate } from 'react-router'
@ -49,13 +47,13 @@ const KnowledgeBaseButton: FC<Props> = ({ ref, selectedBases, onSelect, disabled
const newList: QuickPanelListItem[] = knowledgeState.bases.map((base) => ({ const newList: QuickPanelListItem[] = knowledgeState.bases.map((base) => ({
label: base.name, label: base.name,
description: `${base.items.length} ${t('files.count')}`, description: `${base.items.length} ${t('files.count')}`,
icon: <FileSearchOutlined />, icon: <FileSearch />,
action: () => handleBaseSelect(base), action: () => handleBaseSelect(base),
isSelected: selectedBases?.some((selected) => selected.id === base.id) isSelected: selectedBases?.some((selected) => selected.id === base.id)
})) }))
newList.push({ newList.push({
label: t('knowledge.add.title') + '...', label: t('knowledge.add.title') + '...',
icon: <PlusOutlined />, icon: <Plus />,
action: () => navigate('/knowledge'), action: () => navigate('/knowledge'),
isSelected: false isSelected: false
}) })

View File

@ -1,9 +1,8 @@
import { CodeOutlined, PlusOutlined } from '@ant-design/icons'
import { QuickPanelListItem, useQuickPanel } from '@renderer/components/QuickPanel' import { QuickPanelListItem, useQuickPanel } from '@renderer/components/QuickPanel'
import { useMCPServers } from '@renderer/hooks/useMCPServers' import { useMCPServers } from '@renderer/hooks/useMCPServers'
import { MCPPrompt, MCPResource, MCPServer } from '@renderer/types' import { MCPPrompt, MCPResource, MCPServer } from '@renderer/types'
import { Form, Input, Modal, Tooltip } from 'antd' import { Form, Input, Modal, Tooltip } from 'antd'
import { SquareTerminal } from 'lucide-react' import { Plus, SquareTerminal } from 'lucide-react'
import { FC, useCallback, useEffect, useImperativeHandle, useMemo, useState } from 'react' import { FC, useCallback, useEffect, useImperativeHandle, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router' import { useNavigate } from 'react-router'
@ -46,14 +45,14 @@ const MCPToolsButton: FC<Props> = ({
const newList: QuickPanelListItem[] = activedMcpServers.map((server) => ({ const newList: QuickPanelListItem[] = activedMcpServers.map((server) => ({
label: server.name, label: server.name,
description: server.description || server.baseUrl, description: server.description || server.baseUrl,
icon: <CodeOutlined />, icon: <SquareTerminal />,
action: () => toggelEnableMCP(server), action: () => toggelEnableMCP(server),
isSelected: enabledMCPs.some((s) => s.id === server.id) isSelected: enabledMCPs.some((s) => s.id === server.id)
})) }))
newList.push({ newList.push({
label: t('settings.mcp.addServer') + '...', label: t('settings.mcp.addServer') + '...',
icon: <PlusOutlined />, icon: <Plus />,
action: () => navigate('/settings/mcp') action: () => navigate('/settings/mcp')
}) })
return newList return newList
@ -271,7 +270,7 @@ const MCPToolsButton: FC<Props> = ({
return prompts.map((prompt) => ({ return prompts.map((prompt) => ({
label: prompt.name, label: prompt.name,
description: prompt.description, description: prompt.description,
icon: <CodeOutlined />, icon: <SquareTerminal />,
action: () => handlePromptSelect(prompt) action: () => handlePromptSelect(prompt)
})) }))
}, [handlePromptSelect, enabledMCPs]) }, [handlePromptSelect, enabledMCPs])
@ -373,7 +372,7 @@ const MCPToolsButton: FC<Props> = ({
resources.map((resource) => ({ resources.map((resource) => ({
label: resource.name, label: resource.name,
description: resource.description, description: resource.description,
icon: <CodeOutlined />, icon: <SquareTerminal />,
action: () => handleResourceSelect(resource) action: () => handleResourceSelect(resource)
})) }))
) )

View File

@ -1,4 +1,3 @@
import { PlusOutlined } from '@ant-design/icons'
import ModelTagsWithLabel from '@renderer/components/ModelTagsWithLabel' import ModelTagsWithLabel from '@renderer/components/ModelTagsWithLabel'
import { useQuickPanel } from '@renderer/components/QuickPanel' import { useQuickPanel } from '@renderer/components/QuickPanel'
import { QuickPanelListItem } from '@renderer/components/QuickPanel/types' import { QuickPanelListItem } from '@renderer/components/QuickPanel/types'
@ -10,7 +9,7 @@ import { Model } from '@renderer/types'
import { Avatar, Tooltip } from 'antd' import { Avatar, Tooltip } from 'antd'
import { useLiveQuery } from 'dexie-react-hooks' import { useLiveQuery } from 'dexie-react-hooks'
import { first, sortBy } from 'lodash' import { first, sortBy } from 'lodash'
import { AtSign } from 'lucide-react' import { AtSign, Plus } from 'lucide-react'
import { FC, useCallback, useImperativeHandle, useMemo } from 'react' import { FC, useCallback, useImperativeHandle, useMemo } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router' import { useNavigate } from 'react-router'
@ -101,7 +100,7 @@ const MentionModelsButton: FC<Props> = ({ ref, mentionModels, onMentionModel, To
items.push({ items.push({
label: t('settings.models.add.add_model') + '...', label: t('settings.models.add.add_model') + '...',
icon: <PlusOutlined />, icon: <Plus />,
action: () => navigate('/settings/provider'), action: () => navigate('/settings/provider'),
isSelected: false isSelected: false
}) })

View File

@ -1,10 +1,9 @@
import { PlusOutlined, ThunderboltOutlined } from '@ant-design/icons'
import { useQuickPanel } from '@renderer/components/QuickPanel' import { useQuickPanel } from '@renderer/components/QuickPanel'
import { QuickPanelListItem, QuickPanelOpenOptions } from '@renderer/components/QuickPanel/types' import { QuickPanelListItem, QuickPanelOpenOptions } from '@renderer/components/QuickPanel/types'
import QuickPhraseService from '@renderer/services/QuickPhraseService' import QuickPhraseService from '@renderer/services/QuickPhraseService'
import { QuickPhrase } from '@renderer/types' import { QuickPhrase } from '@renderer/types'
import { Tooltip } from 'antd' import { Tooltip } from 'antd'
import { Zap } from 'lucide-react' import { Plus, Zap } from 'lucide-react'
import { memo, useCallback, useEffect, useImperativeHandle, useMemo, useState } from 'react' import { memo, useCallback, useEffect, useImperativeHandle, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router' import { useNavigate } from 'react-router'
@ -61,12 +60,12 @@ const QuickPhrasesButton = ({ ref, setInputValue, resizeTextArea, ToolbarButton
const newList: QuickPanelListItem[] = quickPhrasesList.map((phrase) => ({ const newList: QuickPanelListItem[] = quickPhrasesList.map((phrase) => ({
label: phrase.title, label: phrase.title,
description: phrase.content, description: phrase.content,
icon: <ThunderboltOutlined />, icon: <Zap />,
action: () => handlePhraseSelect(phrase) action: () => handlePhraseSelect(phrase)
})) }))
newList.push({ newList.push({
label: t('settings.quickPhrase.add') + '...', label: t('settings.quickPhrase.add') + '...',
icon: <PlusOutlined />, icon: <Plus />,
action: () => navigate('/settings/quickPhrase') action: () => navigate('/settings/quickPhrase')
}) })
return newList return newList

View File

@ -34,7 +34,6 @@ import {
Save, Save,
Share, Share,
Split, Split,
ThumbsDown,
ThumbsUp, ThumbsUp,
Trash Trash
} from 'lucide-react' } from 'lucide-react'
@ -438,7 +437,11 @@ const MessageMenubar: FC<Props> = (props) => {
{isAssistantMessage && isGrouped && ( {isAssistantMessage && isGrouped && (
<Tooltip title={t('chat.message.useful')} mouseEnterDelay={0.8}> <Tooltip title={t('chat.message.useful')} mouseEnterDelay={0.8}>
<ActionButton className="message-action-button" onClick={onUseful}> <ActionButton className="message-action-button" onClick={onUseful}>
{message.useful ? <ThumbsUp size={16} /> : <ThumbsDown size={16} />} {message.useful ? (
<ThumbsUp size={17.5} fill="var(--color-primary)" strokeWidth={0} />
) : (
<ThumbsUp size={16} />
)}
</ActionButton> </ActionButton>
</Tooltip> </Tooltip>
)} )}