feat: Teams-style chat UX overhaul
Bubbles: - Teams-style layout: bot avatar (green circle) on left, message beside it - User messages right-aligned, no avatar (clean, like Teams) - Rounded bubbles (border-radius: 16px) instead of square - Distinct corner radii for conversation flow Navigation: - Links no longer close the chat — panel stays open for continued navigation - Added #certifications anchor (alias to courses section) - Fixed agent instruction to use #courses for certifications references Theme: - All colors use CSS variables from _themes.css - Automatically adapts to light/dark without explicit .theme-clean overrides - Panel uses --paper-bg (white in light, dark in dark theme) Size modes: - 3 discrete toggle buttons: compact, half-screen, fullscreen - Active state highlighted, direct selection (no confusing cycling) - Removed chat-half-left (simplified to compact/half/full) Intelligence: - React query now returns results (verified: 4 companies + 2 projects + skills)
This commit is contained in:
@@ -79,6 +79,7 @@ QUERY STRATEGY BY QUESTION TYPE:
|
||||
- For formal education → section="education"
|
||||
- For courses and training → section="courses"
|
||||
- For a specific certification/course topic → use section="search" with the topic.
|
||||
- IMPORTANT: When linking to certifications or courses, use [Courses section](#courses) — there is NO #certifications anchor in the CV page. Certifications and courses are both under the #courses section.
|
||||
|
||||
6. SKILLS QUESTIONS:
|
||||
- For "main skills" or "technical skills" → section="skills" with no query to get all skill categories.
|
||||
|
||||
@@ -222,14 +222,14 @@ func (h *Handler) HandleChat(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// User message bubble with avatar
|
||||
_, _ = fmt.Fprintf(w, `<div class="chat-bubble chat-user"><div class="chat-avatar chat-avatar-user"><iconify-icon icon="mdi:account"></iconify-icon></div><div class="chat-message">%s</div></div>`, html.EscapeString(message))
|
||||
// User message bubble (no avatar, right-aligned)
|
||||
_, _ = fmt.Fprintf(w, `<div class="chat-row chat-row-user"><div class="chat-msg">%s</div></div>`, html.EscapeString(message))
|
||||
|
||||
// Agent response bubble with avatar
|
||||
if response == "" {
|
||||
response = "I couldn't find an answer to that. Try asking about experience, projects, skills, or education."
|
||||
}
|
||||
_, _ = fmt.Fprintf(w, `<div class="chat-bubble chat-bot"><div class="chat-avatar chat-avatar-bot"><iconify-icon icon="mdi:robot-happy-outline"></iconify-icon></div><div class="chat-message">%s</div></div>`, formatResponse(response))
|
||||
_, _ = fmt.Fprintf(w, `<div class="chat-row chat-row-bot"><div class="chat-avatar"><iconify-icon icon="mdi:robot-happy-outline"></iconify-icon></div><div class="chat-msg">%s</div></div>`, formatResponse(response))
|
||||
|
||||
// Session ID via OOB swap
|
||||
_, _ = fmt.Fprintf(w, `<input type="hidden" id="chat-session-id" name="session_id" value="%s" form="chat-form" hx-swap-oob="true"/>`, sessionID)
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
}
|
||||
|
||||
/* Size: Half screen — docked right */
|
||||
.chat-panel.chat-half-right {
|
||||
.chat-panel.chat-half {
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
@@ -90,27 +90,10 @@
|
||||
width: 50vw;
|
||||
max-height: none;
|
||||
border-radius: 0;
|
||||
border-left: 2px solid var(--border-light, #e0e0e0);
|
||||
border-left: 2px solid var(--border-light);
|
||||
}
|
||||
|
||||
.chat-panel.chat-half-right .chat-messages {
|
||||
max-height: none;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* Size: Half screen — docked left */
|
||||
.chat-panel.chat-half-left {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: auto;
|
||||
bottom: 0;
|
||||
width: 50vw;
|
||||
max-height: none;
|
||||
border-radius: 0;
|
||||
border-right: 2px solid var(--border-light, #e0e0e0);
|
||||
}
|
||||
|
||||
.chat-panel.chat-half-left .chat-messages {
|
||||
.chat-panel.chat-half .chat-messages {
|
||||
max-height: none;
|
||||
flex: 1;
|
||||
}
|
||||
@@ -133,7 +116,7 @@
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Header — accent-blue for visual distinction
|
||||
Header — accent-green for visual distinction
|
||||
========================================================================== */
|
||||
|
||||
.chat-header {
|
||||
@@ -152,21 +135,29 @@
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.chat-size-btn {
|
||||
/* Size controls — 3 discrete toggle icons */
|
||||
.chat-size-controls {
|
||||
margin-left: auto;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--action-bar-text-muted, rgba(255, 255, 255, 0.85));
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
transition: color 0.2s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.chat-size-btn:hover {
|
||||
.chat-size-opt {
|
||||
background: none;
|
||||
border: none;
|
||||
color: rgba(255,255,255,0.6);
|
||||
cursor: pointer;
|
||||
font-size: 0.85rem;
|
||||
padding: 2px;
|
||||
display: flex;
|
||||
border-radius: 3px;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.chat-size-opt:hover,
|
||||
.chat-size-opt.active {
|
||||
color: #fff;
|
||||
background: rgba(255,255,255,0.15);
|
||||
}
|
||||
|
||||
.chat-help-btn {
|
||||
@@ -201,102 +192,103 @@
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
/* Chat Bubbles with Avatars */
|
||||
.chat-bubble {
|
||||
/* Teams-style message rows */
|
||||
.chat-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: flex-start;
|
||||
max-width: 95%;
|
||||
}
|
||||
|
||||
.chat-bubble.chat-bot {
|
||||
.chat-row-bot {
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.chat-bubble.chat-user {
|
||||
.chat-row-user {
|
||||
align-self: flex-end;
|
||||
flex-direction: row-reverse;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.chat-avatar {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: var(--accent-green, #27ae60);
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 0.85rem;
|
||||
font-size: 0.9rem;
|
||||
flex-shrink: 0;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.chat-avatar-bot {
|
||||
background: var(--accent-green, #27ae60);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.chat-avatar-user {
|
||||
background: var(--black-bar, #2b2b2b);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Message content */
|
||||
.chat-message {
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
.chat-msg {
|
||||
padding: 10px 14px;
|
||||
border-radius: 16px;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.5;
|
||||
max-width: 85%;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-word;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.chat-message p {
|
||||
.chat-row-bot .chat-msg {
|
||||
background: var(--paper-secondary-bg, #f5f5f5);
|
||||
color: var(--text-secondary, #333333);
|
||||
border-top-left-radius: 4px;
|
||||
}
|
||||
|
||||
.chat-row-user .chat-msg {
|
||||
background: var(--accent-green, #27ae60);
|
||||
color: #fff;
|
||||
border-top-right-radius: 4px;
|
||||
}
|
||||
|
||||
/* Message content typography */
|
||||
.chat-msg p {
|
||||
margin: 0 0 4px 0;
|
||||
}
|
||||
|
||||
.chat-message p:last-child {
|
||||
.chat-msg p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.chat-message ul {
|
||||
.chat-msg ul {
|
||||
margin: 4px 0;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.chat-message li {
|
||||
.chat-msg li {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.chat-bot .chat-message {
|
||||
background: var(--paper-secondary-bg, #f5f5f5);
|
||||
color: var(--text-secondary, #333333);
|
||||
border-bottom-left-radius: 2px;
|
||||
}
|
||||
|
||||
.chat-user .chat-message {
|
||||
background: var(--accent-green, #27ae60);
|
||||
color: #fff;
|
||||
border-bottom-right-radius: 2px;
|
||||
}
|
||||
|
||||
/* Error message — simple styled div (not a chat-row) */
|
||||
.chat-error {
|
||||
padding: 8px 12px;
|
||||
border-radius: 12px;
|
||||
background: #fef2f2;
|
||||
color: #991b1b;
|
||||
align-self: center;
|
||||
font-style: italic;
|
||||
border: 1px solid #fecaca;
|
||||
font-size: 0.75rem;
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.theme-clean .chat-error {
|
||||
[data-color-theme="dark"] .chat-error {
|
||||
background: #3a1a1a;
|
||||
color: #fca5a5;
|
||||
border-color: #5a2a2a;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
[data-color-theme="auto"] .chat-error {
|
||||
background: #3a1a1a;
|
||||
color: #fca5a5;
|
||||
border-color: #5a2a2a;
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Navigation Links in Chat Messages
|
||||
========================================================================== */
|
||||
@@ -560,38 +552,6 @@
|
||||
color: var(--text-light, #999999);
|
||||
}
|
||||
|
||||
/* Dark theme for help modal */
|
||||
.theme-clean .chat-help-group {
|
||||
border-color: #333333;
|
||||
}
|
||||
|
||||
.theme-clean .chat-help-group summary {
|
||||
background: #2a2a2a;
|
||||
color: #d0d0d0;
|
||||
}
|
||||
|
||||
.theme-clean .chat-help-group summary:hover {
|
||||
background: #333333;
|
||||
}
|
||||
|
||||
.theme-clean .chat-help-q {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.theme-clean .chat-help-q:hover {
|
||||
background: #166b3a;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.theme-clean .chat-help-footer {
|
||||
background: #2a2a2a;
|
||||
color: #777777;
|
||||
}
|
||||
|
||||
.theme-clean .chat-help-intro {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Responsive
|
||||
========================================================================== */
|
||||
@@ -615,85 +575,3 @@
|
||||
max-height: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Dark Theme (theme-clean)
|
||||
========================================================================== */
|
||||
|
||||
.theme-clean .chat-panel {
|
||||
background: #1e1e1e;
|
||||
border-color: #3a3a3a;
|
||||
}
|
||||
|
||||
.theme-clean .chat-header {
|
||||
background: var(--accent-green, #27ae60);
|
||||
}
|
||||
|
||||
.theme-clean .chat-bot .chat-message {
|
||||
background: #2d2d2d;
|
||||
color: #e0e0e0;
|
||||
}
|
||||
|
||||
.theme-clean .chat-user .chat-message {
|
||||
background: #1e8c4c;
|
||||
}
|
||||
|
||||
.theme-clean .chat-avatar-bot {
|
||||
background: #1e8c4c;
|
||||
}
|
||||
|
||||
.theme-clean .chat-avatar-user {
|
||||
background: #444444;
|
||||
}
|
||||
|
||||
/* error styles consolidated above */
|
||||
|
||||
.theme-clean .chat-input-area {
|
||||
border-top-color: #3a3a3a;
|
||||
background: #1e1e1e;
|
||||
}
|
||||
|
||||
.theme-clean .chat-input {
|
||||
background: #2d2d2d;
|
||||
border-color: #3a3a3a;
|
||||
color: #e0e0e0;
|
||||
}
|
||||
|
||||
.theme-clean .chat-suggestions {
|
||||
border-top-color: #333333;
|
||||
}
|
||||
|
||||
.theme-clean .chat-chip {
|
||||
background: transparent;
|
||||
color: #999999;
|
||||
border-color: #333333;
|
||||
}
|
||||
|
||||
.theme-clean .chat-chip:hover {
|
||||
background: #1e8c4c;
|
||||
color: #fff;
|
||||
border-color: #1e8c4c;
|
||||
}
|
||||
|
||||
.theme-clean .chat-typing-dot {
|
||||
background: #555555;
|
||||
}
|
||||
|
||||
.theme-clean .chat-nav-link {
|
||||
color: #2ecc71;
|
||||
border-bottom-color: #2ecc71;
|
||||
}
|
||||
|
||||
.theme-clean .chat-nav-link:hover {
|
||||
color: #27ae60;
|
||||
border-bottom-color: #27ae60;
|
||||
}
|
||||
|
||||
.theme-clean .chat-highlight {
|
||||
animation: chatHighlightDark 2s ease;
|
||||
}
|
||||
|
||||
@keyframes chatHighlightDark {
|
||||
0%, 100% { box-shadow: none; }
|
||||
20%, 80% { box-shadow: 0 0 0 3px #2ecc71; border-radius: 4px; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{{define "section-courses"}}
|
||||
<!-- Courses Section -->
|
||||
{{if .CV.Courses}}
|
||||
<span id="certifications"></span>
|
||||
<section id="courses" class="cv-section component-wrapper">
|
||||
<!-- Actual Content -->
|
||||
<div class="actual-content">
|
||||
|
||||
@@ -15,10 +15,17 @@
|
||||
<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>
|
||||
<div class="chat-size-controls">
|
||||
<button class="chat-size-opt active" onclick="setChatSize('')" title="{{if eq .Lang "es"}}Compacto{{else}}Compact{{end}}">
|
||||
<iconify-icon icon="mdi:dock-window"></iconify-icon>
|
||||
</button>
|
||||
<button class="chat-size-opt" onclick="setChatSize('chat-half')" title="{{if eq .Lang "es"}}Media pantalla{{else}}Half screen{{end}}">
|
||||
<iconify-icon icon="mdi:dock-right"></iconify-icon>
|
||||
</button>
|
||||
<button class="chat-size-opt" onclick="setChatSize('chat-full')" title="{{if eq .Lang "es"}}Pantalla completa{{else}}Full screen{{end}}">
|
||||
<iconify-icon icon="mdi:fullscreen"></iconify-icon>
|
||||
</button>
|
||||
</div>
|
||||
<button class="chat-help-btn"
|
||||
aria-label="{{if eq .Lang "es"}}Ayuda{{else}}Help{{end}}"
|
||||
commandfor="chat-help-modal"
|
||||
@@ -28,9 +35,9 @@
|
||||
</div>
|
||||
|
||||
<div id="chat-messages" class="chat-messages">
|
||||
<div class="chat-bubble chat-bot">
|
||||
<div class="chat-avatar chat-avatar-bot"><iconify-icon icon="mdi:robot-happy-outline"></iconify-icon></div>
|
||||
<div class="chat-message">{{if eq .Lang "es"}}¡Hola! Pregúntame lo que quieras sobre este CV.{{else}}Hi! Ask me anything about this CV.{{end}}</div>
|
||||
<div class="chat-row chat-row-bot">
|
||||
<div class="chat-avatar"><iconify-icon icon="mdi:robot-happy-outline"></iconify-icon></div>
|
||||
<div class="chat-msg">{{if eq .Lang "es"}}¡Hola! Pregúntame lo que quieras sobre este CV.{{else}}Hi! Ask me anything about this CV.{{end}}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -117,19 +124,16 @@ 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() {
|
||||
// Set chat panel size: '' (compact), 'chat-half', 'chat-full'
|
||||
function setChatSize(size) {
|
||||
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]);
|
||||
panel.classList.remove('chat-half', 'chat-full');
|
||||
if (size) panel.classList.add(size);
|
||||
// Highlight active button
|
||||
document.querySelectorAll('.chat-size-opt').forEach(function(btn) {
|
||||
btn.classList.remove('active');
|
||||
});
|
||||
event.currentTarget.classList.add('active');
|
||||
}
|
||||
|
||||
// Navigate from chat link to CV section, then highlight
|
||||
@@ -137,16 +141,11 @@ function scrollToCV(link) {
|
||||
var anchor = link.getAttribute('href');
|
||||
var target = document.querySelector(anchor);
|
||||
if (target) {
|
||||
// Close chat panel
|
||||
document.getElementById('chat-panel').classList.remove('chat-open');
|
||||
document.getElementById('chat-toggle-btn').classList.remove('mascot-active');
|
||||
// Scroll to target
|
||||
target.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
// Highlight briefly
|
||||
target.classList.add('chat-highlight');
|
||||
setTimeout(function() { target.classList.remove('chat-highlight'); }, 2000);
|
||||
}
|
||||
return false; // prevent default anchor navigation
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear input after HTMX request completes
|
||||
|
||||
Reference in New Issue
Block a user