Skip to content

Commit 8e2671e

Browse files
committed
refactore
1 parent 193f7bf commit 8e2671e

5 files changed

Lines changed: 239 additions & 119 deletions

File tree

packages/webapp/components/chat/MessageContextMenu.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const MessageContextMenu = forwardRef<
123123
// Trigger editor focus
124124
const event = new CustomEvent('editor:focus')
125125
document.dispatchEvent(event)
126-
}, [channelId, messageData])
126+
}, [channelId, messageData, setReplyMessageMemory])
127127

128128
const handleDeleteMessage = useCallback(async () => {
129129
if (!messageData) return
@@ -133,7 +133,7 @@ export const MessageContextMenu = forwardRef<
133133
} else {
134134
toast.success('Message deleted')
135135
}
136-
}, [messageData])
136+
}, [messageData, setEditMessageMemory])
137137

138138
const handlePinMessage = useCallback(async () => {
139139
if (!messageData) return
@@ -153,12 +153,12 @@ export const MessageContextMenu = forwardRef<
153153
// payload: { message: messageData, actionType }
154154
// })
155155
}
156-
}, [messageData])
156+
}, [messageData, setEditMessageMemory])
157157

158158
const handleEdit = useCallback(() => {
159159
if (!messageData) return
160160
setEditMessageMemory(channelId, messageData)
161-
}, [channelId, messageData])
161+
}, [channelId, messageData, setEditMessageMemory])
162162

163163
const handleThread = useCallback(() => {
164164
if (!messageData) return

packages/webapp/components/chat/components/send-message/CommentMessageIndicator.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type BtnIcon = React.ComponentProps<'button'> & { $active?: boolean; $size?: num
1010

1111
const IconButton = twx.button<BtnIcon>((props) =>
1212
cn(
13-
'btn btn-circle w-8 h-8 btn-xs p-1 mr-2',
13+
'btn btn-square w-8 h-8 btn-xs p-1',
1414
props.$active && 'btn-active',
1515
props.$size && `w-${props.$size} h-${props.$size}`
1616
)
@@ -36,7 +36,7 @@ export const CommentMessageIndicator = () => {
3636
if (commentMessageMemory?.channel_id !== channelId) return null
3737

3838
return (
39-
<div className="text-base-content flex w-full items-center justify-between px-4 py-2">
39+
<div className="text-base-content relative -bottom-1 flex w-full items-center justify-between rounded-t-lg border border-b-0 border-gray-200 px-4 py-2 shadow-[0_-2px_6px_-1px_rgba(0,0,0,0.1)]">
4040
<MdInsertComment size={24} />
4141
<div className="text-base-content flex w-full flex-col justify-start pl-3 text-base">
4242
<span className="text-sm">{commentMessageMemory?.content}</span>

packages/webapp/components/chat/components/send-message/EditeMessageIndicator.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type BtnIcon = React.ComponentProps<'button'> & { $active?: boolean; $size?: num
1010

1111
const IconButton = twx.button<BtnIcon>((props) =>
1212
cn(
13-
'btn btn-circle w-8 h-8 btn-xs p-1 mr-2',
13+
'btn btn-square w-8 h-8 btn-xs p-1',
1414
props.$active && 'btn-active',
1515
props.$size && `w-${props.$size} h-${props.$size}`
1616
)
@@ -38,10 +38,10 @@ export const EditeMessageIndicator = () => {
3838
if (editMessageMemory.channel_id !== channelId) return null
3939

4040
return (
41-
<div className="flex w-full items-center justify-between px-4 py-2 text-base-content">
41+
<div className="text-base-content relative -bottom-1 flex w-full items-center justify-between rounded-t-lg border border-b-0 border-gray-200 px-4 py-2 shadow-[0_-2px_6px_-1px_rgba(0,0,0,0.1)]">
4242
<RiPencilFill size={24} />
43-
<div className="flex w-full flex-col justify-start pl-3 text-base text-base-content">
44-
<span className="font-semibold text-primary antialiased">
43+
<div className="text-base-content flex w-full flex-col justify-start pl-3 text-base">
44+
<span className="text-primary font-semibold antialiased">
4545
Edite message
4646
<span className="ml-1 font-normal">{replyToUser}</span>
4747
</span>

packages/webapp/components/chat/components/send-message/ReplyMessageIndicator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type BtnIcon = React.ComponentProps<'button'> & { $active?: boolean; $size?: num
1010

1111
const IconButton = twx.button<BtnIcon>((props) =>
1212
cn(
13-
'btn btn-square w-8 h-8 btn-xs p-1 ',
13+
'btn btn-square w-8 h-8 btn-xs p-1',
1414
props.$active && 'btn-active',
1515
props.$size && `w-${props.$size} h-${props.$size}`
1616
)

0 commit comments

Comments
 (0)