feat: evolve chat into CV Assistant mascot with help popup and suggestions
- Mascot identity: robot-happy-outline icon, "CV Assistant" branding - Help popup: onboarding card explaining what the mascot can do (EN/ES) - Suggested questions: 5 clickable chips that auto-submit (bilingual) - Typing indicator: three bouncing dots during agent response - Icon swap: mascot icon ↔ close icon via Hyperscript class toggle - Dark theme support for all new elements - Modular CSS loading in development, chat CSS always loaded separately
This commit is contained in:
@@ -1,41 +1,108 @@
|
||||
{{define "chat-widget"}}
|
||||
{{if .ChatEnabled}}
|
||||
<!-- AI Chat Widget -->
|
||||
<!-- AI Chat Widget — CV Assistant Mascot -->
|
||||
<button
|
||||
id="chat-toggle-btn"
|
||||
class="fixed-btn chat-toggle-btn no-print has-tooltip"
|
||||
aria-label="Ask about this CV"
|
||||
data-tooltip="Ask AI about this CV"
|
||||
aria-label="{{if eq .Lang "es"}}Asistente del CV{{else}}CV Assistant{{end}}"
|
||||
data-tooltip="{{if eq .Lang "es"}}Asistente del CV{{else}}CV Assistant{{end}}"
|
||||
_="on click toggle .chat-open on #chat-panel
|
||||
then if #chat-panel matches .chat-open
|
||||
then add .mascot-active to me
|
||||
then set #chat-input.focus to true
|
||||
then call #chat-input.focus()
|
||||
else
|
||||
remove .mascot-active from me
|
||||
end">
|
||||
<iconify-icon icon="mdi:chat-outline" id="chat-icon-open"></iconify-icon>
|
||||
<iconify-icon icon="mdi:close" id="chat-icon-close" style="display:none"></iconify-icon>
|
||||
<iconify-icon icon="mdi:robot-happy-outline" class="chat-icon-open"></iconify-icon>
|
||||
<iconify-icon icon="mdi:close" class="chat-icon-close"></iconify-icon>
|
||||
</button>
|
||||
|
||||
<div id="chat-panel" class="chat-panel no-print">
|
||||
<div class="chat-header">
|
||||
<iconify-icon icon="mdi:robot-outline"></iconify-icon>
|
||||
<span>{{if eq .Lang "es"}}Pregunta sobre este CV{{else}}Ask about this CV{{end}}</span>
|
||||
<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-help-btn"
|
||||
aria-label="{{if eq .Lang "es"}}Ayuda{{else}}Help{{end}}"
|
||||
_="on click toggle .visible on #chat-help-card">
|
||||
<iconify-icon icon="mdi:help-circle-outline"></iconify-icon>
|
||||
</button>
|
||||
<button class="chat-close-btn"
|
||||
_="on click remove .chat-open from #chat-panel">
|
||||
_="on click remove .chat-open from #chat-panel
|
||||
then remove .mascot-active from #chat-toggle-btn">
|
||||
<iconify-icon icon="mdi:close"></iconify-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Help / Onboarding Card -->
|
||||
<div id="chat-help-card" class="chat-help-card visible">
|
||||
<div class="chat-help-icon">
|
||||
<iconify-icon icon="mdi:robot-happy-outline"></iconify-icon>
|
||||
</div>
|
||||
<p class="chat-help-text">
|
||||
{{if eq .Lang "es"}}¡Soy el Asistente del CV! Puedo responder preguntas sobre la experiencia profesional, proyectos, habilidades y formación de Juan. Prueba a hacer clic en una sugerencia o escribe tu propia pregunta.{{else}}I'm the CV Assistant! I can answer questions about Juan's professional experience, projects, skills, and education. Try clicking a suggestion or type your own question.{{end}}
|
||||
</p>
|
||||
<button class="chat-help-dismiss"
|
||||
_="on click remove .visible from #chat-help-card">
|
||||
{{if eq .Lang "es"}}Entendido{{else}}Got it{{end}}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="chat-messages" class="chat-messages">
|
||||
<div class="chat-message chat-agent">
|
||||
{{if eq .Lang "es"}}¡Hola! Puedo responder preguntas sobre este currículum. Prueba a preguntar sobre experiencia, proyectos, tecnologías o formación.{{else}}Hi! I can answer questions about this CV. Try asking about experience, projects, technologies, or education.{{end}}
|
||||
{{if eq .Lang "es"}}¡Hola! Pregúntame lo que quieras sobre este CV.{{else}}Hi! Ask me anything about this CV.{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Typing Indicator -->
|
||||
<div id="chat-typing" class="chat-typing">
|
||||
<span class="chat-typing-dot"></span>
|
||||
<span class="chat-typing-dot"></span>
|
||||
<span class="chat-typing-dot"></span>
|
||||
</div>
|
||||
|
||||
<!-- Suggested Questions -->
|
||||
<div class="chat-suggestions">
|
||||
{{if eq .Lang "es"}}
|
||||
<button class="chat-chip"
|
||||
_="on click set #chat-input.value to '¿Qué proyectos en Go ha hecho?'
|
||||
then send submit to #chat-form">¿Proyectos en Go?</button>
|
||||
<button class="chat-chip"
|
||||
_="on click set #chat-input.value to '¿Cuántos años de experiencia tiene?'
|
||||
then send submit to #chat-form">¿Años de experiencia?</button>
|
||||
<button class="chat-chip"
|
||||
_="on click set #chat-input.value to '¿En qué empresas ha trabajado?'
|
||||
then send submit to #chat-form">¿Empresas?</button>
|
||||
<button class="chat-chip"
|
||||
_="on click set #chat-input.value to '¿Conoce React?'
|
||||
then send submit to #chat-form">¿Conoce React?</button>
|
||||
<button class="chat-chip"
|
||||
_="on click set #chat-input.value to '¿Qué certificaciones tiene?'
|
||||
then send submit to #chat-form">¿Certificaciones?</button>
|
||||
{{else}}
|
||||
<button class="chat-chip"
|
||||
_="on click set #chat-input.value to 'What Go projects has he built?'
|
||||
then send submit to #chat-form">Go projects?</button>
|
||||
<button class="chat-chip"
|
||||
_="on click set #chat-input.value to 'How many years of experience?'
|
||||
then send submit to #chat-form">Years of experience?</button>
|
||||
<button class="chat-chip"
|
||||
_="on click set #chat-input.value to 'What companies has he worked at?'
|
||||
then send submit to #chat-form">Companies?</button>
|
||||
<button class="chat-chip"
|
||||
_="on click set #chat-input.value to 'Does he know React?'
|
||||
then send submit to #chat-form">Knows React?</button>
|
||||
<button class="chat-chip"
|
||||
_="on click set #chat-input.value to 'What certifications?'
|
||||
then send submit to #chat-form">Certifications?</button>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<form id="chat-form" class="chat-input-area"
|
||||
hx-post="/api/chat"
|
||||
hx-target="#chat-messages"
|
||||
hx-swap="beforeend scroll:#chat-messages:bottom"
|
||||
hx-indicator="#chat-spinner"
|
||||
hx-indicator="#chat-typing"
|
||||
_="on htmx:afterRequest set #chat-input.value to ''">
|
||||
<input type="hidden" name="session_id" value="">
|
||||
<input type="hidden" name="lang" value="{{.Lang}}">
|
||||
@@ -44,15 +111,12 @@
|
||||
id="chat-input"
|
||||
name="message"
|
||||
class="chat-input"
|
||||
placeholder="{{if eq .Lang "es"}}Escribe una pregunta...{{else}}Type a question...{{end}}"
|
||||
placeholder="{{if eq .Lang "es"}}Pregunta algo sobre el CV...{{else}}Ask something about the CV...{{end}}"
|
||||
autocomplete="off"
|
||||
required>
|
||||
<button type="submit" class="chat-send-btn" aria-label="Send">
|
||||
<iconify-icon icon="mdi:send"></iconify-icon>
|
||||
</button>
|
||||
<div id="chat-spinner" class="chat-spinner htmx-indicator">
|
||||
<iconify-icon icon="mdi:loading" class="spin"></iconify-icon>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user