File size: 5,306 Bytes
3376581 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
class CustomChat extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: flex;
flex-direction: column;
height: 100%;
}
.chat-container {
flex: 1;
background: white;
border: 1px solid #e5e7eb;
border-radius: 0.75rem;
margin-bottom: 1.5rem;
overflow-y: auto;
padding: 1.5rem;
display: flex;
flex-direction: column;
gap: 1rem;
}
.empty-state {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
text-align: center;
}
.empty-icon {
width: 5rem;
height: 5rem;
background: linear-gradient(135deg, #3b82f6, #8b5cf6);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 2.5rem;
margin: 0 auto 1rem;
}
.empty-title {
font-size: 1.125rem;
font-weight: 700;
color: #111827;
margin-bottom: 0.5rem;
}
.empty-description {
color: #6b7280;
margin-bottom: 0.25rem;
}
.empty-hint {
color: #9ca3af;
font-size: 0.875rem;
}
.message-user {
display: flex;
justify-content: flex-end;
}
.message-ai {
display: flex;
justify-content: flex-start;
}
.message-bubble {
max-width: 42rem;
padding: 1rem;
border-radius: 1rem;
font-size: 0.875rem;
line-height: 1.5;
white-space: pre-wrap;
}
.user-bubble {
background: #3b82f6;
color: white;
border-bottom-right-radius: 0;
}
.ai-bubble {
background: #f3f4f6;
color: #111827;
border-bottom-left-radius: 0;
}
.message-time {
font-size: 0.75rem;
margin-top: 0.5rem;
}
.user-time {
color: #bfdbfe;
}
.ai-time {
color: #9ca3af;
}
.input-container {
display: flex;
align-items: center;
gap: 0.5rem;
background: white;
border: 1px solid #e5e7eb;
border-radius: 0.75rem;
padding: 1rem;
}
.chat-input {
flex: 1;
border: none;
outline: none;
font-size: 0.875rem;
}
.send-btn {
padding: 0.75rem;
background: #3b82f6;
color: white;
border-radius: 0.5rem;
transition: all 0.2s;
}
.send-btn:hover {
background: #2563eb;
}
</style>
<div class="chat-container" id="chat-messages">
<div class="empty-state">
<div>
<div class="empty-icon">🤖</div>
<h3 class="empty-title">Rosalinda</h3>
<p class="empty-description">Votre IA générateur de code 100% propriétaire</p>
<p class="empty-hint">Demandez n'importe quoi pour générer du code !</p>
</div>
</div>
</div>
<div class="input-container">
<input type="text" class="chat-input" id="chat-input" placeholder="Décrivez votre projet, Rosalinda génère le code...">
<button class="send-btn" onclick="sendMessage()">
<i data-feather="send"></i>
</button>
</div>
`;
feather.replace();
}
}
customElements.define('custom-chat', CustomChat); |