New changes.
@ -0,0 +1,36 @@
|
||||
{% if chat_message.member %}
|
||||
<div class="w-full flex justify-start items-end gap-2 fade-in-up">
|
||||
<div>
|
||||
<div
|
||||
class="w-[30px] h-[30px] rounded-full shadow-md text-white flex justify-center items-center bg-osiblue uppercase text-xs">
|
||||
{% if chat_message.member.staffprofile.image %}
|
||||
<img class="w-full h-full rounded-full"
|
||||
src="http://192.168.0.100:8000{{chat_message.member.staffprofile.image.url}}">
|
||||
{% else %}
|
||||
<p>{{chat_message.member.first_name.0}}{{chat_message.member.last_name.0}}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="w-fit bg-gray-50 px-3 py-2 rounded-r-3xl rounded-tl-3xl text-secondosiblue text-sm leading-6 bg-opacity-50 shadow-md border border-gray-100">
|
||||
<p class="break-all">{{chat_message.content}}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="w-full flex justify-end">
|
||||
<div
|
||||
class="w-fit px-3 py-2 rounded-l-3xl rounded-tr-3xl text-white shadow-md text-sm leading-6 bg-opacity-70 bg-osiblue fade-in-up">
|
||||
<p class="break-all">{{chat_message.content}}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<style>
|
||||
@keyframes fadeInAndUp {
|
||||
from { opacity: 0; transform: translateY(12px); }
|
||||
to { opacity: 1; transform: translateY(0px); }
|
||||
}
|
||||
.fade-in-up {
|
||||
animation: fadeInAndUp 0.6s ease;
|
||||
}
|
||||
</style>
|
After Width: | Height: | Size: 115 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 937 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 57 KiB |
@ -0,0 +1,37 @@
|
||||
(function() {
|
||||
// FUNCTION TO ADJUST TEXTAREA HEIGHT AND SUBMIT BUTTON VISIBILITY
|
||||
function adjustTextAreaAndButton(textarea, submitButton) {
|
||||
if (textarea.value.trim() === '') {
|
||||
textarea.style.height = '50px';
|
||||
} else {
|
||||
textarea.style.height = textarea.scrollHeight + 'px';
|
||||
}
|
||||
|
||||
if (textarea.value.trim() === '') {
|
||||
submitButton.classList.add('hidden');
|
||||
} else {
|
||||
submitButton.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// INITIALIZE ELEMENTS
|
||||
const chatRoomId = document.getElementById('chatRoomId').textContent.trim();
|
||||
const form = document.querySelector('#sendMessage');
|
||||
const textarea = document.querySelector('#dynamicTextarea');
|
||||
const conversationContainer = document.getElementById('conversation');
|
||||
const submitButton = document.getElementById('submitMessageButton');
|
||||
|
||||
// EVENT LISTENERS
|
||||
textarea.addEventListener('input', () => adjustTextAreaAndButton(textarea, submitButton));
|
||||
|
||||
form.addEventListener('submit', (event) => {
|
||||
textarea.style.height = '50px';
|
||||
submitButton.classList.add('hidden');
|
||||
|
||||
setTimeout(() => {
|
||||
conversationContainer.scrollTop = conversationContainer.scrollHeight;
|
||||
}, 100);
|
||||
});
|
||||
|
||||
console.log('hi from textarea script');
|
||||
})();
|