Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export function DocumentTagsModal({

return (
<Modal open={open} onOpenChange={handleClose}>
<ModalContent size='sm'>
<ModalContent size='md'>
<ModalHeader>
<div className='flex items-center justify-between'>
<span>Document Tags</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export function BaseTagsModal({ open, onOpenChange, knowledgeBaseId }: BaseTagsM
return (
<>
<Modal open={open} onOpenChange={handleClose}>
<ModalContent size='sm'>
<ModalContent size='md'>
<ModalHeader>
<div className='flex items-center justify-between'>
<span>Tags</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { useCallback, useState } from 'react'
import { useCallback, useRef, useState } from 'react'
import { useParams, useRouter } from 'next/navigation'
import { Badge, DocumentAttachment, Tooltip } from '@/components/emcn'
import { formatAbsoluteDate, formatRelativeTime } from '@/lib/core/utils/formatting'
Expand Down Expand Up @@ -100,6 +100,7 @@ export function BaseCard({
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false)
const [isTagsModalOpen, setIsTagsModalOpen] = useState(false)
const [isDeleting, setIsDeleting] = useState(false)
const actionTakenRef = useRef(false)

const searchParams = new URLSearchParams({
kbName: title,
Expand All @@ -110,7 +111,7 @@ export function BaseCard({

const handleClick = useCallback(
(e: React.MouseEvent) => {
if (isContextMenuOpen) {
if (isContextMenuOpen || actionTakenRef.current) {
e.preventDefault()
return
}
Expand All @@ -130,19 +131,35 @@ export function BaseCard({
)

const handleOpenInNewTab = useCallback(() => {
actionTakenRef.current = true
window.open(href, '_blank')
requestAnimationFrame(() => {
actionTakenRef.current = false
})
}, [href])

const handleViewTags = useCallback(() => {
actionTakenRef.current = true
setIsTagsModalOpen(true)
requestAnimationFrame(() => {
actionTakenRef.current = false
})
}, [])

const handleEdit = useCallback(() => {
actionTakenRef.current = true
setIsEditModalOpen(true)
requestAnimationFrame(() => {
actionTakenRef.current = false
})
}, [])

const handleDelete = useCallback(() => {
actionTakenRef.current = true
setIsDeleteModalOpen(true)
requestAnimationFrame(() => {
actionTakenRef.current = false
})
}, [])

const handleConfirmDelete = useCallback(async () => {
Expand Down
Loading