Added contact and term btn

This commit is contained in:
2024-05-25 11:20:11 +02:00
parent c05de5d325
commit a4a528b6ca
5 changed files with 85 additions and 7 deletions
+8 -3
View File
@@ -25,7 +25,7 @@
<input class="input is-small mt-2 is-hidden" type="text" id="conversation-name-input"
name="conversation-name-input" placeholder="Conversation name" autocomplete="off">
<div class="is-flex is-justify-content-space-between mt-4">
<button class="button is-small is-danger" id="delete-conversation-button"
<button disabled class="button is-small is-danger" id="delete-conversation-button"
hx-get="/deleteConversation" hx-swap="outerHTML" hx-target="#conversation-dropdown"
hx-vals="js:{conversationId: findSelectedConversationID()}">
<span class="icon">
@@ -61,6 +61,7 @@
function findSelectedConversationID() {
return document.getElementsByClassName('icon-conv selected')[0].getAttribute('data-id');
}
function toggleConversationSelection(element) {
const elements = Array.from(document.getElementsByClassName('icon-conv'));
@@ -86,8 +87,12 @@
element.classList.add('selected');
}
// Make an HTMX request to update the chat
// If the text inside the selected button is Default
if (element.textContent === 'Default') {
document.getElementById('delete-conversation-button').disabled = true;
} else {
document.getElementById('delete-conversation-button').disabled = false;
}
}
var sortable = new Sortable(document.getElementById('conversation-list'), {