Skip to content

Commit

Permalink
Merge pull request #266 from mehul-m-prajapati/clear_char
Browse files Browse the repository at this point in the history
Clear all chat with single click on button
  • Loading branch information
kom-senapati authored Nov 5, 2024
2 parents d748e6e + 4facda5 commit c148a53
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions client/src/pages/Chatbot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,23 +263,11 @@ export default function ChatbotPage() {
</DropdownMenuSub>
<DropdownMenuSeparator />
<DropdownMenuItem
className="text-destructive hover:text-destructive/90"
onClick={() => {
if (singleClickTimeout.current) {
clearTimeout(singleClickTimeout.current); // If double click happens, clear the single-click action
}
singleClickTimeout.current = setTimeout(() => {
toast.success("Double Click to delete all messages.");
}, 200); // Set a delay to check if it's a single or double click
}}
onDoubleClick={() => {
if (singleClickTimeout.current) {
clearTimeout(singleClickTimeout.current); // Clear single click timeout on double click
}
mutation.mutate(id); // Trigger the double-click delete action
}}
>
{t("chatbot_page.delete_all")}
className="text-destructive hover:text-destructive/90"
onClick={() => {
mutation.mutate(id); // Trigger the delete action on single click
}}
>Clear All
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
Expand Down

0 comments on commit c148a53

Please sign in to comment.