Skip to content

Commit bb2d370

Browse files
committed
Revert "feat: add clear messages confirm modal"
This reverts commit 3588f2d.
1 parent 3588f2d commit bb2d370

File tree

8 files changed

+8
-61
lines changed

8 files changed

+8
-61
lines changed
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
11
import { useStore } from '@nanostores/solid'
22
import { currentConversationId } from '@/stores/conversation'
3-
import {
4-
scrollController,
5-
showConfirmModal,
6-
} from '@/stores/ui'
3+
import { scrollController } from '@/stores/ui'
74
import { clearMessagesByConversationId } from '@/stores/messages'
8-
import { useI18n } from '@/hooks'
9-
import ConfirmModal from '../ui/ConfirmModal'
105

116
export default () => {
127
const $currentConversationId = useStore(currentConversationId)
13-
const { t } = useI18n()
148

159
const handleClearMessage = () => {
1610
clearMessagesByConversationId($currentConversationId())
1711
scrollController().scrollToBottom()
18-
showConfirmModal.set(false)
1912
}
2013

2114
return (
2215
<>
2316
{ $currentConversationId() && (
2417
<div
2518
class="fcc p-2 rounded-md text-xl hv-foreground"
26-
onClick={() => { showConfirmModal.set(true) }}
19+
onClick={handleClearMessage}
2720
>
2821
<div i-carbon-clean />
2922
</div>
3023
)}
31-
<ConfirmModal title={t('conversations.confirm.title')} description={t('conversations.confirm.desc')} onConfirm={handleClearMessage} onCancel={() => { showConfirmModal.set(false) }} />
3224
</>
3325
)
3426
}

src/components/main/Conversation.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default () => {
3333
<Switch
3434
fallback={(
3535
<Welcome />
36-
)}
36+
)}
3737
>
3838
<Match when={$currentConversationId() && !currentConversationMessages().length}>
3939
<ConversationEmpty conversation={currentConversation()} />
@@ -52,8 +52,9 @@ export default () => {
5252
</Match>
5353
<Match when={currentBot()?.type === 'image_generation'}>
5454
<Image
55-
// conversationId={$currentConversationId()}
55+
// conversationId={$currentConversationId()}
5656
messages={currentConversationMessages}
57+
// fetching={isLoading() || !isStreaming()}
5758
/>
5859
</Match>
5960
</Switch>

src/components/ui/ConfirmModal.tsx

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/components/ui/Modal.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ interface Props {
1111
direction: 'top' | 'bottom' | 'left' | 'right'
1212
children: JSXElement
1313
closeBtnClass?: string
14-
hiddenCloseIcon?: boolean
1514
}
1615

1716
export default (props: Props) => {
@@ -46,9 +45,9 @@ export default (props: Props) => {
4645
</Portal>
4746
<div {...api().containerProps}>
4847
<div {...api().contentProps} class={`bg-modal transition-transform ease-out max-w-screen max-h-screen overflow-auto border-base shadow-lg ring-0 outline-none ${containerBaseClass}`}>
49-
{
50-
!props.hiddenCloseIcon && <button {...api().closeTriggerProps} class={`absolute p-1 rounded-md top-4 right-4 hv-base hv-foreground ${props.closeBtnClass || ''}`}> <div i-carbon-close class="text-xl" /></button>
51-
}
48+
<button {...api().closeTriggerProps} class={`absolute p-1 rounded-md top-4 right-4 hv-base hv-foreground ${props.closeBtnClass || ''}`}>
49+
<div i-carbon-close class="text-xl" />
50+
</button>
5251
{ props.children }
5352
</div>
5453
</div>

src/locale/lang/en.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ export const en = {
2424
recent: 'Recents',
2525
noRecent: 'No recents',
2626
untitled: 'Untitled',
27-
confirm: {
28-
title: 'Delete all messages in this chat',
29-
desc: 'This action cannot be undone.',
30-
message: 'Delete this record',
31-
btn: 'confirm',
32-
cancel: 'cancel',
33-
},
3427
},
3528
send: {
3629
placeholder: 'Enter Something...',

src/locale/lang/zh-cn.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ export const zhCN = {
2424
recent: '最近对话',
2525
noRecent: '暂无最近对话',
2626
untitled: '未命名对话',
27-
confirm: {
28-
title: '删除本会话的所有消息',
29-
desc: '这将删除本会话的所有消息,且不可恢复',
30-
message: '删除这条记录',
31-
btn: '确认',
32-
cancel: '取消',
33-
},
3427
},
3528
send: {
3629
placeholder: '输入内容...',

src/stores/ui.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export const showConversationSidebar = atom(false)
55
export const showSettingsSidebar = atom(false)
66
export const showConversationEditModal = atom(false)
77
export const showEmojiPickerModal = atom(false)
8-
export const showConfirmModal = atom(false)
98

109
export const isSendBoxFocus = atom(false)
1110
export const currentErrorMessage = atom<ErrorMessage | null>(null)

unocss.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ export default defineConfig({
5858
'hv-foreground': 'transition-opacity cursor-pointer op-70 hover:op-100',
5959
'input-base': 'bg-transparent placeholder:op-50 dark:placeholder:op-20 focus:(ring-0 outline-none) resize-none',
6060
'button': 'mt-4 px-3 py-2 text-xs border border-base rounded-lg hv-base hover:border-base-100',
61-
'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',
6261
'max-w-base': 'max-w-3xl mx-auto',
6362
'text-error': 'text-red-700 dark:text-red-400/80',
6463
'border-error': 'border border-red-700 dark:border-red-400/80',

0 commit comments

Comments
 (0)