mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
Remove console.log debug statements and cleanup debug code
This commit is contained in:
1 parent
ce2630936d
commit
ac188c953b
20 files changed
+462
-220
No files matched your search
@@ -1,7 +1,6 @@
|
||||
import { memo } from 'react'
|
||||
import { X, RefreshCw, Loader2 } from 'lucide-react'
|
||||
import { X, Loader2 } from 'lucide-react'
|
||||
import { useUndoMessage } from '@/hooks/useUndoMessage'
|
||||
import { useRefreshMessage } from '@/hooks/useRemoveMessage'
|
||||
import { useMobile } from '@/hooks/useMobile'
|
||||
|
||||
interface UserMessageActionButtonsProps {
|
||||
@@ -10,10 +9,7 @@ interface UserMessageActionButtonsProps {
|
||||
directory?: string
|
||||
userMessageId: string
|
||||
userMessageContent: string
|
||||
assistantMessageId: string
|
||||
onUndo: (restoredPrompt: string) => void
|
||||
model?: string
|
||||
agent?: string
|
||||
}
|
||||
|
||||
export const UserMessageActionButtons = memo(function UserMessageActionButtons({
|
||||
@@ -22,10 +18,7 @@ export const UserMessageActionButtons = memo(function UserMessageActionButtons({
|
||||
directory,
|
||||
userMessageId,
|
||||
userMessageContent,
|
||||
assistantMessageId,
|
||||
onUndo,
|
||||
model,
|
||||
agent
|
||||
onUndo
|
||||
}: UserMessageActionButtonsProps) {
|
||||
const isMobile = useMobile()
|
||||
const undoMessage = useUndoMessage({
|
||||
@@ -34,46 +27,20 @@ export const UserMessageActionButtons = memo(function UserMessageActionButtons({
|
||||
directory,
|
||||
onSuccess: onUndo
|
||||
})
|
||||
const refreshMessage = useRefreshMessage({ opcodeUrl, sessionId, directory })
|
||||
|
||||
const isLoading = undoMessage.isPending || refreshMessage.isPending
|
||||
|
||||
const handleUndo = () => {
|
||||
if (isLoading) return
|
||||
if (undoMessage.isPending) return
|
||||
undoMessage.mutate({
|
||||
messageID: userMessageId,
|
||||
messageContent: userMessageContent
|
||||
})
|
||||
}
|
||||
|
||||
const handleRefresh = () => {
|
||||
if (isLoading || !userMessageContent) return
|
||||
refreshMessage.mutate({
|
||||
assistantMessageID: assistantMessageId,
|
||||
userMessageContent,
|
||||
model,
|
||||
agent
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`flex items-center gap-1 ${isMobile ? 'opacity-100' : 'opacity-0 group-hover:opacity-100'} transition-opacity`}>
|
||||
<button
|
||||
onClick={handleRefresh}
|
||||
disabled={isLoading}
|
||||
className="p-1 rounded hover:bg-primary/20 text-muted-foreground hover:text-primary transition-colors disabled:opacity-50"
|
||||
title="Try again for different response"
|
||||
>
|
||||
{refreshMessage.isPending ? (
|
||||
<Loader2 className="w-3.5 h-3.5 animate-spin" />
|
||||
) : (
|
||||
<RefreshCw className="w-3.5 h-3.5" />
|
||||
)}
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={handleUndo}
|
||||
disabled={isLoading}
|
||||
disabled={undoMessage.isPending}
|
||||
className="p-1 rounded hover:bg-destructive/20 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
|
||||
title="Undo this message"
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user