From bb2d370c02193d4c3f97cb10b0612633a18dfd97 Mon Sep 17 00:00:00 2001 From: ddiu8081 Date: Mon, 22 May 2023 22:40:36 +0800 Subject: [PATCH] Revert "feat: add clear messages confirm modal" This reverts commit 3588f2db4c459d7f88505eb3e1b3e9cbcb643449. --- .../header/ConversationMessageClearButton.tsx | 12 ++------ src/components/main/Conversation.tsx | 5 ++-- src/components/ui/ConfirmModal.tsx | 29 ------------------- src/components/ui/Modal.tsx | 7 ++--- src/locale/lang/en.ts | 7 ----- src/locale/lang/zh-cn.ts | 7 ----- src/stores/ui.ts | 1 - unocss.config.ts | 1 - 8 files changed, 8 insertions(+), 61 deletions(-) delete mode 100644 src/components/ui/ConfirmModal.tsx diff --git a/src/components/header/ConversationMessageClearButton.tsx b/src/components/header/ConversationMessageClearButton.tsx index faf7ef02..48a9be6c 100644 --- a/src/components/header/ConversationMessageClearButton.tsx +++ b/src/components/header/ConversationMessageClearButton.tsx @@ -1,21 +1,14 @@ import { useStore } from '@nanostores/solid' import { currentConversationId } from '@/stores/conversation' -import { - scrollController, - showConfirmModal, -} from '@/stores/ui' +import { scrollController } from '@/stores/ui' import { clearMessagesByConversationId } from '@/stores/messages' -import { useI18n } from '@/hooks' -import ConfirmModal from '../ui/ConfirmModal' export default () => { const $currentConversationId = useStore(currentConversationId) - const { t } = useI18n() const handleClearMessage = () => { clearMessagesByConversationId($currentConversationId()) scrollController().scrollToBottom() - showConfirmModal.set(false) } return ( @@ -23,12 +16,11 @@ export default () => { { $currentConversationId() && (
{ showConfirmModal.set(true) }} + onClick={handleClearMessage} >
)} - { showConfirmModal.set(false) }} /> ) } diff --git a/src/components/main/Conversation.tsx b/src/components/main/Conversation.tsx index d17524e1..f84c4150 100644 --- a/src/components/main/Conversation.tsx +++ b/src/components/main/Conversation.tsx @@ -33,7 +33,7 @@ export default () => { - )} + )} > @@ -52,8 +52,9 @@ export default () => { diff --git a/src/components/ui/ConfirmModal.tsx b/src/components/ui/ConfirmModal.tsx deleted file mode 100644 index b75c6df0..00000000 --- a/src/components/ui/ConfirmModal.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - showConfirmModal, -} from '@/stores/ui' -import { useI18n } from '@/hooks' -import Modal from './Modal' - -interface Props { - title: string - description: string - onConfirm: () => void - onCancel: () => void -} - -export default (props: Props) => { - const { t } = useI18n() - return ( - -
-
-

{props.title}

{props.description}

-
- - -
-
-
-
- ) -} diff --git a/src/components/ui/Modal.tsx b/src/components/ui/Modal.tsx index 6763acf6..4c201ef6 100644 --- a/src/components/ui/Modal.tsx +++ b/src/components/ui/Modal.tsx @@ -11,7 +11,6 @@ interface Props { direction: 'top' | 'bottom' | 'left' | 'right' children: JSXElement closeBtnClass?: string - hiddenCloseIcon?: boolean } export default (props: Props) => { @@ -46,9 +45,9 @@ export default (props: Props) => {
- { - !props.hiddenCloseIcon && - } + { props.children }
diff --git a/src/locale/lang/en.ts b/src/locale/lang/en.ts index 84f19d3c..2cd7ee7b 100644 --- a/src/locale/lang/en.ts +++ b/src/locale/lang/en.ts @@ -24,13 +24,6 @@ export const en = { recent: 'Recents', noRecent: 'No recents', untitled: 'Untitled', - confirm: { - title: 'Delete all messages in this chat', - desc: 'This action cannot be undone.', - message: 'Delete this record', - btn: 'confirm', - cancel: 'cancel', - }, }, send: { placeholder: 'Enter Something...', diff --git a/src/locale/lang/zh-cn.ts b/src/locale/lang/zh-cn.ts index 9dbc92c5..66c3cd64 100644 --- a/src/locale/lang/zh-cn.ts +++ b/src/locale/lang/zh-cn.ts @@ -24,13 +24,6 @@ export const zhCN = { recent: '最近对话', noRecent: '暂无最近对话', untitled: '未命名对话', - confirm: { - title: '删除本会话的所有消息', - desc: '这将删除本会话的所有消息,且不可恢复', - message: '删除这条记录', - btn: '确认', - cancel: '取消', - }, }, send: { placeholder: '输入内容...', diff --git a/src/stores/ui.ts b/src/stores/ui.ts index 7990c17d..e733dd3d 100644 --- a/src/stores/ui.ts +++ b/src/stores/ui.ts @@ -5,7 +5,6 @@ export const showConversationSidebar = atom(false) export const showSettingsSidebar = atom(false) export const showConversationEditModal = atom(false) export const showEmojiPickerModal = atom(false) -export const showConfirmModal = atom(false) export const isSendBoxFocus = atom(false) export const currentErrorMessage = atom(null) diff --git a/unocss.config.ts b/unocss.config.ts index 83741e01..db08cef1 100644 --- a/unocss.config.ts +++ b/unocss.config.ts @@ -58,7 +58,6 @@ export default defineConfig({ 'hv-foreground': 'transition-opacity cursor-pointer op-70 hover:op-100', 'input-base': 'bg-transparent placeholder:op-50 dark:placeholder:op-20 focus:(ring-0 outline-none) resize-none', 'button': 'mt-4 px-3 py-2 text-xs border border-base rounded-lg hv-base hover:border-base-100', - 'emerald-button': 'mt-4 px-3 py-2 text-xs border rounded-lg text-light-400 border-emerald-600 bg-emerald-600 hover-bg-emerald-700 hover-border-emerald-700', 'max-w-base': 'max-w-3xl mx-auto', 'text-error': 'text-red-700 dark:text-red-400/80', 'border-error': 'border border-red-700 dark:border-red-400/80',