feat: resizable chat panel (compact → half-right → half-left → full)

4 size modes cycled via expand button in header:
- Compact: 360px (default, bottom-right corner)
- Half-right: 50vw docked to right edge, full height
- Half-left: 50vw docked to left edge, full height
- Full: 100% viewport overlay

Also fixes text overflow in chat messages (overflow-wrap, word-break).
Messages area expands to fill available height in larger modes.
Size button uses mdi icons: arrow-expand, dock-right, dock-left, arrow-collapse.
CSS transitions for smooth size changes.
This commit is contained in:
juanatsap
2026-04-08 17:24:35 +01:00
parent 465af719e9
commit 5448c3cf7a
2 changed files with 92 additions and 1 deletions
@@ -15,6 +15,10 @@
<div class="chat-header">
<iconify-icon icon="mdi:robot-happy-outline"></iconify-icon>
<span>{{if eq .Lang "es"}}Asistente del CV{{else}}CV Assistant{{end}}</span>
<button class="chat-size-btn" onclick="cycleChatSize()"
aria-label="{{if eq .Lang "es"}}Cambiar tamaño{{else}}Resize{{end}}">
<iconify-icon icon="mdi:arrow-expand" id="chat-size-icon"></iconify-icon>
</button>
<button class="chat-help-btn"
aria-label="{{if eq .Lang "es"}}Ayuda{{else}}Help{{end}}"
commandfor="chat-help-modal"
@@ -112,6 +116,21 @@ function closeChatHelpAndAsk(question) {
sendChatQuestion(question);
}
// Cycle chat panel size: compact → half-right → half-left → full → compact
var chatSizes = ['', 'chat-half-right', 'chat-half-left', 'chat-full'];
var chatSizeIcons = ['mdi:arrow-expand', 'mdi:dock-right', 'mdi:dock-left', 'mdi:arrow-collapse'];
var chatSizeIndex = 0;
function cycleChatSize() {
var panel = document.getElementById('chat-panel');
var icon = document.getElementById('chat-size-icon');
// Remove current size class
chatSizes.forEach(function(cls) { if (cls) panel.classList.remove(cls); });
// Next size
chatSizeIndex = (chatSizeIndex + 1) % chatSizes.length;
if (chatSizes[chatSizeIndex]) panel.classList.add(chatSizes[chatSizeIndex]);
icon.setAttribute('icon', chatSizeIcons[chatSizeIndex]);
}
// Navigate from chat link to CV section, then highlight
function scrollToCV(link) {
var anchor = link.getAttribute('href');