From c99d0d6f10cad55a9d71f5db9d846d61d74c9e91 Mon Sep 17 00:00:00 2001 From: 897809421 <897809421@qq.com> Date: Thu, 30 Mar 2023 17:38:43 +0800 Subject: [PATCH] feat: dialog title edit --- app/components/home.module.scss | 27 ++++++++++- app/components/home.tsx | 82 +++++++++++++++++++++++++++------ app/icons/edit-title.svg | 1 + app/store/app.ts | 12 +++++ 4 files changed, 106 insertions(+), 16 deletions(-) create mode 100644 app/icons/edit-title.svg diff --git a/app/components/home.module.scss b/app/components/home.module.scss index 87231feee..38c432ff5 100644 --- a/app/components/home.module.scss +++ b/app/components/home.module.scss @@ -169,13 +169,38 @@ transition: all ease 0.3s; opacity: 0; } +.chat-item-edit { + position: absolute; + top: 11px; + right: -25px; + transition: all ease 0.3s; + opacity: 0; +} +.chat-item-edit-input[type=text] { + font-size: 14px; + color: black; + font-weight: bolder; + padding: 0; + box-sizing: border-box; + width: 100%; + height: 100%; + border: 1px rgb(29,147,171) solid; + outline: none; + +} .chat-item:hover > .chat-item-delete { opacity: 0.5; right: 10px; } -.chat-item:hover > .chat-item-delete:hover { +.chat-item:hover > .chat-item-edit { + opacity: 0.5; + right: 35px; +} + +.chat-item:hover > .chat-item-delete, +.chat-item:hover > .chat-item-edit { opacity: 1; } diff --git a/app/components/home.tsx b/app/components/home.tsx index da65b1d63..5b95811cf 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -15,6 +15,7 @@ import ExportIcon from "../icons/export.svg"; import BotIcon from "../icons/bot.svg"; import AddIcon from "../icons/add.svg"; import DeleteIcon from "../icons/delete.svg"; +import EditIcon from "../icons/edit-title.svg"; import LoadingIcon from "../icons/three-dots.svg"; import MenuIcon from "../icons/menu.svg"; import CloseIcon from "../icons/close.svg"; @@ -69,11 +70,16 @@ export function Avatar(props: { role: Message["role"] }) { export function ChatItem(props: { onClick?: () => void; onDelete?: () => void; + onEdit?: (title: string) => void; title: string; count: number; time: string; selected: boolean; }) { + const [dialog, setDialog] = useState({ + isEdit: false, + title: props.title, + }); return (