feat: add icons on context menu

This commit is contained in:
kangfenmao 2024-07-02 19:35:13 +08:00
parent 7f61ab2a21
commit 6408762f40
3 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,11 @@
@import 'https://at.alicdn.com/t/c/font_4563475_hrx8c92awui.css';
@import './markdown.scss';
// @font-face {
// font-family: 'Playwrite';
// src: url(../fonts/Playwrite.ttf) format('truetype');
// }
:root {
--color-white: #ffffff;
--color-white-soft: #f8f8f8;

View File

@ -6,6 +6,7 @@ import { Dropdown, MenuProps } from 'antd'
import { MoreOutlined } from '@ant-design/icons'
import { last } from 'lodash'
import AgentSettingPopup from '@renderer/components/Popups/AgentSettingPopup'
import { DeleteOutlined, EditOutlined } from '@ant-design/icons'
interface Props {
activeAgent: Agent
@ -28,6 +29,7 @@ const Agents: FC<Props> = ({ activeAgent, onActive }) => {
{
label: 'Edit',
key: 'edit',
icon: <EditOutlined />,
async onClick() {
if (targetAgent.current) {
const _agent = await AgentSettingPopup.show({ agent: targetAgent.current })
@ -39,6 +41,7 @@ const Agents: FC<Props> = ({ activeAgent, onActive }) => {
{
label: 'Delete',
key: 'delete',
icon: <DeleteOutlined />,
danger: true,
onClick: () => targetAgent.current && onDelete(targetAgent.current)
}

View File

@ -6,7 +6,7 @@ import { Agent, Topic } from '@renderer/types'
import { Button, Dropdown, MenuProps, Popconfirm } from 'antd'
import { FC, useRef } from 'react'
import styled from 'styled-components'
import { DeleteOutlined } from '@ant-design/icons'
import { DeleteOutlined, EditOutlined, SignatureOutlined } from '@ant-design/icons'
import LocalStorage from '@renderer/services/storage'
interface Props {
@ -22,8 +22,9 @@ const TopicList: FC<Props> = ({ agent, activeTopic, setActiveTopic }) => {
const topicMenuItems: MenuProps['items'] = [
{
label: 'AI Rename',
key: 'ai-rename',
label: 'Auto Rename',
key: 'auto-rename',
icon: <SignatureOutlined />,
async onClick() {
if (currentTopic.current) {
const messages = await LocalStorage.getTopicMessages(currentTopic.current.id)
@ -39,6 +40,7 @@ const TopicList: FC<Props> = ({ agent, activeTopic, setActiveTopic }) => {
{
label: 'Rename',
key: 'rename',
icon: <EditOutlined />,
async onClick() {
const name = await PromptPopup.show({
title: 'Rename Topic',
@ -58,6 +60,7 @@ const TopicList: FC<Props> = ({ agent, activeTopic, setActiveTopic }) => {
label: 'Delete',
danger: true,
key: 'delete',
icon: <DeleteOutlined />,
onClick() {
if (agent.topics.length === 1) return
currentTopic.current && removeTopic(currentTopic.current)