nixaut-codelabs commited on
Commit
75ffade
·
verified ·
1 Parent(s): 81ef0d0

make chat cards more modern but don't make absurt designs. Minimal and more modern.

Browse files
Files changed (3) hide show
  1. index.html +9 -9
  2. script.js +17 -17
  3. style.css +85 -16
index.html CHANGED
@@ -67,17 +67,17 @@
67
  <!-- Messages Container -->
68
  <div id="chatContainer" class="flex-1 overflow-y-auto scroll-smooth p-4 space-y-4" style="scrollbar-width: thin; scrollbar-color: #525252 #18181b;">
69
  <!-- AI Welcome Message -->
70
- <div class="flex items-start space-x-2 message-slide-in">
71
- <div class="w-8 h-8 rounded-full bg-zinc-800 flex items-center justify-center flex-shrink-0">
72
- <i data-feather="cpu" class="w-4 h-4 text-zinc-400"></i>
73
- </div>
74
- <div class="flex-1 max-w-3xl">
75
- <div class="bg-zinc-900 rounded-lg p-3">
76
- <p class="text-white text-sm">Hello!</p>
77
- <p class="text-zinc-500 text-sm mt-1">How can I help you today?</p>
 
78
  </div>
79
  </div>
80
- </div>
81
  <div id="typingIndicator" class="hidden flex items-start space-x-3">
82
  <div class="w-8 h-8 rounded-full bg-zinc-800 flex items-center justify-center flex-shrink-0">
83
  <i data-feather="cpu" class="w-4 h-4 text-zinc-400"></i>
 
67
  <!-- Messages Container -->
68
  <div id="chatContainer" class="flex-1 overflow-y-auto scroll-smooth p-4 space-y-4" style="scrollbar-width: thin; scrollbar-color: #525252 #18181b;">
69
  <!-- AI Welcome Message -->
70
+ <div class="flex items-start gap-3 message-slide-in group">
71
+ <div class="w-9 h-9 rounded-xl bg-gradient-to-br from-zinc-800 to-zinc-900 flex items-center justify-center flex-shrink-0 ring-1 ring-zinc-800/50 group-hover:ring-zinc-700/50 transition-all duration-200">
72
+ <i data-feather="cpu" class="w-4.5 h-4.5 text-zinc-300"></i>
73
+ </div>
74
+ <div class="flex-1 max-w-4xl">
75
+ <div class="bg-zinc-900/60 backdrop-blur-sm rounded-2xl p-4 border border-zinc-800/50 hover:border-zinc-700/50 transition-all duration-200">
76
+ <p class="text-white text-sm leading-relaxed">Hello!</p>
77
+ <p class="text-zinc-400 text-sm mt-2 leading-relaxed">How can I help you today?</p>
78
+ </div>
79
  </div>
80
  </div>
 
81
  <div id="typingIndicator" class="hidden flex items-start space-x-3">
82
  <div class="w-8 h-8 rounded-full bg-zinc-800 flex items-center justify-center flex-shrink-0">
83
  <i data-feather="cpu" class="w-4 h-4 text-zinc-400"></i>
script.js CHANGED
@@ -119,24 +119,24 @@ function addMessage(content, sender) {
119
  messageDiv.className = `flex items-start space-x-3 message-slide-in ${sender === 'user' ? 'flex-row-reverse space-x-reverse' : ''}`;
120
  if (sender === 'user') {
121
  messageDiv.innerHTML = `
122
- <div class="w-8 h-8 rounded-full bg-zinc-800 flex items-center justify-center flex-shrink-0">
123
- <i data-feather="user" class="w-4 h-4 text-zinc-400"></i>
124
  </div>
125
- <div class="flex-1 max-w-3xl">
126
- <div class="bg-zinc-700 rounded-lg p-3">
127
- <p class="text-white text-sm break-words">${content}</p>
128
  </div>
129
  </div>
130
  `;
131
  } else {
132
  const processedContent = marked.parse(content);
133
  messageDiv.innerHTML = `
134
- <div class="w-8 h-8 rounded-full bg-zinc-700 flex items-center justify-center flex-shrink-0">
135
- <i data-feather="cpu" class="w-4 h-4 text-zinc-300"></i>
136
  </div>
137
- <div class="flex-1 max-w-3xl">
138
- <div class="bg-zinc-800 rounded-lg p-3">
139
- <div class="markdown text-white text-sm">${processedContent}</div>
140
  </div>
141
  </div>
142
  `;
@@ -361,14 +361,14 @@ function clearChat() {
361
  if (confirm('Are you sure you want to clear the entire chat history?')) {
362
  const chatContainer = document.getElementById('chatContainer');
363
  chatContainer.innerHTML = `
364
- <div class="flex items-start space-x-2 message-slide-in">
365
- <div class="w-8 h-8 rounded-full bg-zinc-800 flex items-center justify-center flex-shrink-0">
366
- <i data-feather="cpu" class="w-4 h-4 text-zinc-400"></i>
367
  </div>
368
- <div class="flex-1 max-w-3xl">
369
- <div class="bg-zinc-900 rounded-lg p-3">
370
- <p class="text-white text-sm">Hello!</p>
371
- <p class="text-zinc-500 text-sm mt-1">How can I help you today?</p>
372
  </div>
373
  </div>
374
  </div>
 
119
  messageDiv.className = `flex items-start space-x-3 message-slide-in ${sender === 'user' ? 'flex-row-reverse space-x-reverse' : ''}`;
120
  if (sender === 'user') {
121
  messageDiv.innerHTML = `
122
+ <div class="w-9 h-9 rounded-xl bg-gradient-to-br from-blue-600 to-blue-700 flex items-center justify-center flex-shrink-0 ring-1 ring-blue-600/30 group-hover:ring-blue-500/50 transition-all duration-200">
123
+ <i data-feather="user" class="w-4.5 h-4.5 text-white"></i>
124
  </div>
125
+ <div class="flex-1 max-w-4xl">
126
+ <div class="bg-gradient-to-br from-zinc-800/80 to-zinc-900/80 backdrop-blur-sm rounded-2xl p-4 border border-zinc-700/50 hover:border-zinc-600/50 transition-all duration-200 shadow-sm shadow-zinc-900/20">
127
+ <p class="text-white text-sm leading-relaxed break-words">${content}</p>
128
  </div>
129
  </div>
130
  `;
131
  } else {
132
  const processedContent = marked.parse(content);
133
  messageDiv.innerHTML = `
134
+ <div class="w-9 h-9 rounded-xl bg-gradient-to-br from-zinc-800 to-zinc-900 flex items-center justify-center flex-shrink-0 ring-1 ring-zinc-800/50 group-hover:ring-zinc-700/50 transition-all duration-200">
135
+ <i data-feather="cpu" class="w-4.5 h-4.5 text-zinc-300"></i>
136
  </div>
137
+ <div class="flex-1 max-w-4xl">
138
+ <div class="bg-gradient-to-br from-zinc-900/60 to-zinc-950/60 backdrop-blur-sm rounded-2xl p-4 border border-zinc-800/50 hover:border-zinc-700/50 transition-all duration-200 shadow-sm shadow-zinc-900/20">
139
+ <div class="markdown text-white text-sm leading-relaxed">${processedContent}</div>
140
  </div>
141
  </div>
142
  `;
 
361
  if (confirm('Are you sure you want to clear the entire chat history?')) {
362
  const chatContainer = document.getElementById('chatContainer');
363
  chatContainer.innerHTML = `
364
+ <div class="flex items-start gap-3 message-slide-in group">
365
+ <div class="w-9 h-9 rounded-xl bg-gradient-to-br from-zinc-800 to-zinc-900 flex items-center justify-center flex-shrink-0 ring-1 ring-zinc-800/50 group-hover:ring-zinc-700/50 transition-all duration-200">
366
+ <i data-feather="cpu" class="w-4.5 h-4.5 text-zinc-300"></i>
367
  </div>
368
+ <div class="flex-1 max-w-4xl">
369
+ <div class="bg-gradient-to-br from-zinc-900/60 to-zinc-950/60 backdrop-blur-sm rounded-2xl p-4 border border-zinc-800/50 hover:border-zinc-700/50 transition-all duration-200 shadow-sm shadow-zinc-900/20">
370
+ <p class="text-white text-sm leading-relaxed">Hello!</p>
371
+ <p class="text-zinc-400 text-sm mt-2 leading-relaxed">How can I help you today?</p>
372
  </div>
373
  </div>
374
  </div>
style.css CHANGED
@@ -70,31 +70,100 @@ body {
70
  .float-animation {
71
  animation: float 3s ease-in-out infinite;
72
  }
73
- /* Markdown Styling */
74
- .markdown h1 { @apply text-lg font-bold text-white mb-2 mt-3; }
75
- .markdown h2 { @apply text-base font-semibold text-white mb-2 mt-2; }
76
- .markdown h3 { @apply text-sm font-medium text-white mb-1 mt-2; }
77
- .markdown p { @apply text-zinc-200 mb-2 leading-relaxed; }
78
- .markdown code { @apply bg-zinc-700 px-1 py-0.5 rounded text-xs text-green-400; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  .markdown pre {
80
- @apply bg-zinc-900 rounded p-2 overflow-x-auto mb-2 text-xs;
81
- font-family: 'Courier New', monospace;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
83
- .markdown pre code { @apply bg-transparent text-zinc-300; }
84
- .markdown ul { @apply list-disc list-inside text-zinc-200 mb-2 space-y-1 text-sm; }
85
- .markdown ol { @apply list-decimal list-inside text-zinc-200 mb-2 space-y-1 text-sm; }
86
  .markdown blockquote {
87
- @apply border-l-2 border-zinc-600 pl-3 italic text-zinc-400 mb-2 text-sm;
 
 
 
 
 
 
 
88
  }
89
- .markdown a { @apply text-white underline hover:text-zinc-300 text-sm; }
90
  .markdown table {
91
- @apply w-full border-collapse mb-2 text-sm;
 
92
  }
93
  .markdown th {
94
- @apply border border-zinc-700 px-2 py-1 bg-zinc-900 text-left text-sm;
95
  }
96
  .markdown td {
97
- @apply border border-zinc-700 px-2 py-1 text-zinc-300 text-sm;
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
  /* Transition Classes */
100
  .transition-all {
 
70
  .float-animation {
71
  animation: float 3s ease-in-out infinite;
72
  }
73
+ /* Enhanced Message Cards */
74
+ .message-slide-in {
75
+ animation: slideInFade 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
76
+ }
77
+
78
+ @keyframes slideInFade {
79
+ from {
80
+ opacity: 0;
81
+ transform: translateY(10px) scale(0.98);
82
+ }
83
+ to {
84
+ opacity: 1;
85
+ transform: translateY(0) scale(1);
86
+ }
87
+ }
88
+
89
+ /* Modern Message Container */
90
+ .max-w-4xl {
91
+ max-width: 56rem;
92
+ }
93
+
94
+ /* Enhanced Markdown Styling */
95
+ .markdown h1 {
96
+ @apply text-lg font-semibold text-white mb-3 mt-4 tracking-tight;
97
+ background: linear-gradient(to right, #ffffff, #e5e5e5);
98
+ -webkit-background-clip: text;
99
+ background-clip: text;
100
+ -webkit-text-fill-color: transparent;
101
+ }
102
+ .markdown h2 {
103
+ @apply text-base font-medium text-white mb-3 mt-3 tracking-tight;
104
+ color: #f4f4f5;
105
+ }
106
+ .markdown h3 {
107
+ @apply text-sm font-medium text-zinc-200 mb-2 mt-3 tracking-tight;
108
+ }
109
+ .markdown p {
110
+ @apply text-zinc-100 mb-3 leading-relaxed;
111
+ line-height: 1.6;
112
+ }
113
+ .markdown code {
114
+ @apply bg-zinc-800/60 px-2 py-1 rounded-md text-xs text-emerald-400 font-mono;
115
+ border: 1px solid rgba(34, 197, 94, 0.1);
116
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
117
+ }
118
  .markdown pre {
119
+ @apply bg-gradient-to-br from-zinc-900 to-zinc-950 rounded-xl p-4 overflow-x-auto mb-4 text-xs;
120
+ font-family: 'Fira Code', 'Monaco', 'Courier New', monospace;
121
+ border: 1px solid #27272a;
122
+ box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
123
+ }
124
+ .markdown pre code {
125
+ @apply bg-transparent text-zinc-200 py-0 px-0;
126
+ border: none;
127
+ box-shadow: none;
128
+ }
129
+ .markdown ul {
130
+ @apply list-disc list-inside text-zinc-100 mb-3 space-y-2 text-sm;
131
+ line-height: 1.6;
132
+ }
133
+ .markdown ol {
134
+ @apply list-decimal list-inside text-zinc-100 mb-3 space-y-2 text-sm;
135
+ line-height: 1.6;
136
  }
 
 
 
137
  .markdown blockquote {
138
+ @apply border-l-3 border-zinc-600 pl-4 italic text-zinc-300 mb-3 text-sm;
139
+ background: linear-gradient(to right, rgba(113, 113, 122, 0.1), transparent);
140
+ padding: 12px 16px;
141
+ border-radius: 0 8px 8px 0;
142
+ line-height: 1.6;
143
+ }
144
+ .markdown a {
145
+ @apply text-blue-400 underline decoration-1 underline-offset-2 hover:text-blue-300 hover:decoration-blue-300 transition-colors duration-200 text-sm;
146
  }
 
147
  .markdown table {
148
+ @apply w-full border-collapse mb-4 text-sm rounded-lg overflow-hidden;
149
+ border: 1px solid #27272a;
150
  }
151
  .markdown th {
152
+ @apply border border-zinc-700 px-3 py-2 bg-zinc-900/80 text-left text-sm font-medium text-zinc-200;
153
  }
154
  .markdown td {
155
+ @apply border border-zinc-800 px-3 py-2 text-zinc-300;
156
+ }
157
+
158
+ /* Message hover effects */
159
+ .group:hover .group-hover\\:ring-zinc-700\\/50 {
160
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px * var(--tw-ring-inset-width)) var(--tw-ring-color);
161
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
162
+ }
163
+
164
+ .group:hover .group-hover\\:ring-blue-500\\/50 {
165
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px * var(--tw-ring-inset-width)) var(--tw-ring-color);
166
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
167
  }
168
  /* Transition Classes */
169
  .transition-all {