File tree Expand file tree Collapse file tree 7 files changed +57
-4
lines changed Expand file tree Collapse file tree 7 files changed +57
-4
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import Conversation from './main/Conversation'
8
8
---
9
9
10
10
<main class =" relative h-full flex-1 flex flex-col overflow-hidden bg-base" >
11
- <Header client:load />
11
+ <Header client:only />
12
12
<main class =" flex-1 mt-14 flex flex-col overflow-hidden" >
13
13
<div class =" flex-1 relative overflow-hidden" >
14
14
<Conversation client:only />
Original file line number Diff line number Diff line change 1
1
import { useStore } from '@nanostores/solid'
2
2
import { currentConversationId } from '@/stores/conversation'
3
- import { scrollController } from '@/stores/ui'
3
+ import {
4
+ scrollController ,
5
+ showConfirmModal ,
6
+ } from '@/stores/ui'
4
7
import { clearMessagesByConversationId } from '@/stores/messages'
8
+ import { useI18n } from '@/hooks'
9
+ import ConfirmModal from '../ui/ConfirmModal'
5
10
6
11
export default ( ) => {
7
12
const $currentConversationId = useStore ( currentConversationId )
13
+ const { t } = useI18n ( )
8
14
9
15
const handleClearMessage = ( ) => {
10
16
clearMessagesByConversationId ( $currentConversationId ( ) )
11
17
scrollController ( ) . scrollToBottom ( )
18
+ showConfirmModal . set ( false )
12
19
}
13
20
14
21
return (
15
22
< >
16
- { $currentConversationId ( ) && (
23
+ { $currentConversationId ( ) && (
17
24
< div
18
25
class = "fcc p-2 rounded-md text-xl hv-foreground"
19
- onClick = { handleClearMessage }
26
+ onClick = { ( ) => { showConfirmModal . set ( true ) } }
20
27
>
21
28
< div i-carbon-clean />
22
29
</ div >
23
30
) }
31
+ < ConfirmModal title = { t ( 'conversations.confirm.title' ) } description = { t ( 'conversations.confirm.desc' ) } onConfirm = { handleClearMessage } onCancel = { ( ) => { showConfirmModal . set ( false ) } } />
24
32
</ >
25
33
)
26
34
}
Original file line number Diff line number Diff line change
1
+ import {
2
+ showConfirmModal ,
3
+ } from '@/stores/ui'
4
+ import { useI18n } from '@/hooks'
5
+ import Modal from './Modal'
6
+
7
+ interface Props {
8
+ title : string
9
+ description : string
10
+ onConfirm : ( ) => void
11
+ onCancel : ( ) => void
12
+ }
13
+
14
+ export default ( props : Props ) => {
15
+ const { t } = useI18n ( )
16
+ return (
17
+ < Modal bindValue = { showConfirmModal } direction = "bottom" closeBtnClass = "hidden" >
18
+ < div class = "max-h-[70vh] w-full" >
19
+ < div class = "grid w-full max-w-lg scale-100 gap-4 border-base sm:border bg-white dark:bg-zinc-900/90 dark:backdrop-blur-lg p-6 opacity-100 shadow-lg sm:rounded-lg md:w-full" >
20
+ < div class = "flex flex-col space-y-2 text-center sm:text-left" > < h2 id = "radix-:rl:" class = "text-lg font-semibold" > { props . title } </ h2 > < p id = "radix-:rm:" class = "text-sm text-muted-foreground" > { props . description } </ p > </ div >
21
+ < div class = "flex flex-col-reverse sm:flex-row sm:justify-end gap-2" >
22
+ < button class = "button" onClick = { ( ) => props . onCancel ( ) } > { t ( 'conversations.confirm.cancel' ) } </ button >
23
+ < button class = "emerald-button" onClick = { ( ) => props . onConfirm ( ) } > { t ( 'conversations.confirm.btn' ) } </ button >
24
+ </ div >
25
+ </ div >
26
+ </ div >
27
+ </ Modal >
28
+ )
29
+ }
Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ export const en = {
24
24
recent : 'Recents' ,
25
25
noRecent : 'No recents' ,
26
26
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
+ } ,
27
34
} ,
28
35
send : {
29
36
placeholder : 'Enter Something...' ,
Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ export const zhCN = {
24
24
recent : '最近对话' ,
25
25
noRecent : '暂无最近对话' ,
26
26
untitled : '未命名对话' ,
27
+ confirm : {
28
+ title : '删除本会话的所有消息' ,
29
+ desc : '这将删除本会话的所有消息,且不可恢复' ,
30
+ message : '删除这条记录' ,
31
+ btn : '确认' ,
32
+ cancel : '取消' ,
33
+ } ,
27
34
} ,
28
35
send : {
29
36
placeholder : '输入内容...' ,
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export const showConversationSidebar = atom(false)
5
5
export const showSettingsSidebar = atom ( false )
6
6
export const showConversationEditModal = atom ( false )
7
7
export const showEmojiPickerModal = atom ( false )
8
+ export const showConfirmModal = atom ( false )
8
9
9
10
export const isSendBoxFocus = atom ( false )
10
11
export const currentErrorMessage = atom < ErrorMessage | null > ( null )
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export default defineConfig({
58
58
'hv-foreground' : 'transition-opacity cursor-pointer op-70 hover:op-100' ,
59
59
'input-base' : 'bg-transparent placeholder:op-50 dark:placeholder:op-20 focus:(ring-0 outline-none) resize-none' ,
60
60
'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' ,
61
62
'max-w-base' : 'max-w-3xl mx-auto' ,
62
63
'text-error' : 'text-red-700 dark:text-red-400/80' ,
63
64
'border-error' : 'border border-red-700 dark:border-red-400/80' ,
You can’t perform that action at this time.
0 commit comments