Open dekdynamics opened 1 month ago
To add an edit button for quick delete functionality:
Modify sidebar-thread.blade.php
:
<div class="relative z-[15]">
<!-- Existing code -->
<button wire:click="deleteThread({{ $thread->id }})" class="hidden group-hover:block">Delete</button>
</div>
Modify sidebar-switcher.blade.php
:
<div x-data="{ editMode: false }">
<button @click="editMode = !editMode">Edit</button>
<ul>
<!-- Existing code -->
<li x-show="editMode">
<!-- Include delete button here -->
</li>
</ul>
</div>
Update Chat.php
Livewire Component:
public function deleteThread($threadId)
{
$thread = Thread::find($threadId);
if ($thread) {
$thread->delete();
session()->flash('message', 'Thread deleted successfully.');
}
}
Add 'Delete All Chats' Button in Settings:
<button wire:click="deleteAllChats">Delete All Chats</button>
public function deleteAllChats()
{
Thread::truncate();
session()->flash('message', 'All chats deleted successfully.');
}
/resources/views/livewire/sidebar-thread.blade.php /resources/views/livewire/sidebar-switcher.blade.php /app/Livewire/Chat.php /app/Livewire/Modals/Chat/Delete.php /resources/views/livewire/modals/chat/delete.blade.php
Hi Team,
I have a bunch of chats that I'd like to remove from the sidebar, but clicking each one and confirming the delete is pretty annoying and time consuming.
Can you add an edit button at the top of the column that reveals a delete button on each chat, for quick delete, or can you add a "Delete All chats" button in settings?
Thanks!