Skip to content

Commit ecdfc3c

Browse files
committed
Fix reply balloon style and behavior.
Balloon border instead of margin for easier grouping (attachments no longer break the group).
1 parent d68899a commit ecdfc3c

2 files changed

Lines changed: 42 additions & 19 deletions

File tree

Public/app/css/main.css

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,8 +2256,8 @@ input[type="text"]:disabled, textarea:disabled {
22562256
background-color: hsl(var(--chat-bubble-received));
22572257
color: hsl(var(--chat-bubble-received-foreground));
22582258
box-shadow: var(--shadow-soft);
2259-
padding: 1px;
22602259
overflow: hidden;
2260+
border: 2px solid hsl(var(--chat-bubble-received));
22612261
}
22622262

22632263
.message-author-name {
@@ -2294,8 +2294,9 @@ input[type="text"]:disabled, textarea:disabled {
22942294
}
22952295

22962296
.message-row.own .message-bubble {
2297-
background: linear-gradient(-10deg, hsl(var(--primary)), hsl(var(--primary) / 0.9));
2297+
background: linear-gradient(-10deg, hsl(var(--primary)), hsl(var(--primary) / 1.0));
22982298
color: hsl(var(--primary-foreground));
2299+
border-color: hsl(var(--primary));
22992300
}
23002301

23012302
/* Message grouping corner radius styles with higher specificity */
@@ -2348,7 +2349,6 @@ input[type="text"]:disabled, textarea:disabled {
23482349
word-wrap: break-word;
23492350
align-self: flex-start; /* Align text to top of bubble */
23502351
font-size: 1rem;
2351-
margin: 1px;
23522352
flex: 1;
23532353
display: flex;
23542354
align-items: center;
@@ -2829,7 +2829,7 @@ input[type="text"]:disabled, textarea:disabled {
28292829

28302830
.message-attachment-container {
28312831
position: relative;
2832-
border-radius: 11px;
2832+
border-radius: 4px;
28332833
overflow: hidden;
28342834
box-sizing: border-box;
28352835
display: block;
@@ -2982,16 +2982,34 @@ input[type="text"]:disabled, textarea:disabled {
29822982
}
29832983

29842984
.message-reply-preview {
2985+
display: flex;
2986+
align-items: center;
2987+
gap: 5px;
29852988
padding: 5px;
2986-
margin: 3px;
2987-
margin-bottom: 1px;
29882989
background-color: hsl(var(--foreground) / 0.05);
2989-
border-left: 2px solid hsl(var(--foreground) / 0.3);
2990-
color: hsl(var(--foreground));
2990+
color: hsl(var(--foreground) / 0.9);
2991+
font-style: italic;
2992+
font-size: 0.9rem;
29912993
max-height: 50px;
29922994
overflow: hidden;
29932995
text-overflow: ellipsis;
29942996
border-radius: 4px;
2997+
border-bottom: 1px solid hsl(var(--foreground) / 0.05);
2998+
}
2999+
3000+
.message-row.own .message-reply-preview {
3001+
background-color: hsl(var(--primary-foreground) / 0.1);
3002+
color: hsl(var(--primary-foreground) / 0.9);
3003+
border-bottom: 1px solid hsl(var(--primary-foreground) / 0.1);
3004+
}
3005+
3006+
.message-highlight {
3007+
animation: message-highlight-fade 1.5s ease;
3008+
}
3009+
3010+
@keyframes message-highlight-fade {
3011+
0%, 30% { background-color: hsl(var(--primary) / 0.15); }
3012+
100% { background-color: transparent; }
29953013
}
29963014

29973015
.message-deleted {

Public/app/js/chat.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,18 @@ function scrollMessagesToBottom(instant = false) {
112112
}
113113
}
114114

115+
// Scroll to a specific message by ID and briefly highlight it
116+
function scrollToMessage(messageId) {
117+
const messageElement = document.querySelector(`[data-message-id="${messageId}"]`);
118+
if (!messageElement) return;
119+
120+
const row = messageElement.closest('.message-row') || messageElement;
121+
row.scrollIntoView({ behavior: 'smooth', block: 'center' });
122+
123+
row.classList.add('message-highlight');
124+
setTimeout(() => row.classList.remove('message-highlight'), 1500);
125+
}
126+
115127
// Setup infinite scroll for messages container
116128
function setupInfiniteScroll(chatId) {
117129
const messagesContainer = document.getElementById('messagesContainer');
@@ -203,16 +215,9 @@ function updateSingleMessageGrouping(messageElement, index, allMessageElements)
203215
}
204216
}
205217

206-
// Check if messages have attachments (by checking for attachment container in DOM)
207-
const currentHasAttachments = messageElement.querySelector('.message-attachment-container') !== null;
208-
const prevHasAttachments = prevElement && prevElement.querySelector('.message-attachment-container') !== null;
209-
const nextHasAttachments = nextElement && nextElement.querySelector('.message-attachment-container') !== null;
210-
211-
// Messages should be grouped if same author AND within 10 minutes AND no attachments AND same date
212-
const shouldGroupWithPrev = sameAuthorAsPrev && !timeGapWithPrev &&
213-
!currentHasAttachments && !prevHasAttachments && !dateDiffersFromPrev;
214-
const shouldGroupWithNext = sameAuthorAsNext && !timeGapWithNext &&
215-
!currentHasAttachments && !nextHasAttachments && !dateDiffersFromNext;
218+
// Messages should be grouped if same author AND within 10 minutes AND same date
219+
const shouldGroupWithPrev = sameAuthorAsPrev && !timeGapWithPrev && !dateDiffersFromPrev;
220+
const shouldGroupWithNext = sameAuthorAsNext && !timeGapWithNext && !dateDiffersFromNext;
216221

217222
let groupPosition;
218223
if (!shouldGroupWithPrev && !shouldGroupWithNext) {
@@ -460,7 +465,7 @@ function createMessageElement(message) {
460465

461466
replyPreviewHTML = `
462467
<div class="message-reply-preview">
463-
${escapeHtml(replyPreviewText)}
468+
<div data-reply-to="${message.replyTo}" onclick="scrollToMessage('${message.replyTo}')" style="cursor: pointer;">${quoteIcon}</div><div>${escapeHtml(replyPreviewText)}</div>
464469
</div>
465470
`;
466471
}

0 commit comments

Comments
 (0)