Skip to content

Commit f6afaac

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 f6afaac

2 files changed

Lines changed: 45 additions & 19 deletions

File tree

Public/app/css/main.css

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,8 +2256,11 @@ 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));
2261+
display: flex;
2262+
flex-direction: column;
2263+
gap: 2px;
22612264
}
22622265

22632266
.message-author-name {
@@ -2294,8 +2297,9 @@ input[type="text"]:disabled, textarea:disabled {
22942297
}
22952298

22962299
.message-row.own .message-bubble {
2297-
background: linear-gradient(-10deg, hsl(var(--primary)), hsl(var(--primary) / 0.9));
2300+
background: linear-gradient(-10deg, hsl(var(--primary)), hsl(var(--primary) / 1.0));
22982301
color: hsl(var(--primary-foreground));
2302+
border-color: hsl(var(--primary));
22992303
}
23002304

23012305
/* Message grouping corner radius styles with higher specificity */
@@ -2348,7 +2352,6 @@ input[type="text"]:disabled, textarea:disabled {
23482352
word-wrap: break-word;
23492353
align-self: flex-start; /* Align text to top of bubble */
23502354
font-size: 1rem;
2351-
margin: 1px;
23522355
flex: 1;
23532356
display: flex;
23542357
align-items: center;
@@ -2829,7 +2832,7 @@ input[type="text"]:disabled, textarea:disabled {
28292832

28302833
.message-attachment-container {
28312834
position: relative;
2832-
border-radius: 11px;
2835+
border-radius: 4px;
28332836
overflow: hidden;
28342837
box-sizing: border-box;
28352838
display: block;
@@ -2982,16 +2985,34 @@ input[type="text"]:disabled, textarea:disabled {
29822985
}
29832986

29842987
.message-reply-preview {
2988+
display: flex;
2989+
align-items: center;
2990+
gap: 5px;
29852991
padding: 5px;
2986-
margin: 3px;
2987-
margin-bottom: 1px;
29882992
background-color: hsl(var(--foreground) / 0.05);
2989-
border-left: 2px solid hsl(var(--foreground) / 0.3);
2990-
color: hsl(var(--foreground));
2993+
color: hsl(var(--foreground) / 0.9);
2994+
font-style: italic;
2995+
font-size: 0.9rem;
29912996
max-height: 50px;
29922997
overflow: hidden;
29932998
text-overflow: ellipsis;
29942999
border-radius: 4px;
3000+
border-bottom: 1px solid hsl(var(--foreground) / 0.05);
3001+
}
3002+
3003+
.message-row.own .message-reply-preview {
3004+
background-color: hsl(var(--primary-foreground) / 0.1);
3005+
color: hsl(var(--primary-foreground) / 0.9);
3006+
border-bottom: 1px solid hsl(var(--primary-foreground) / 0.1);
3007+
}
3008+
3009+
.message-highlight {
3010+
animation: message-highlight-fade 1.5s ease;
3011+
}
3012+
3013+
@keyframes message-highlight-fade {
3014+
0%, 30% { background-color: hsl(var(--primary) / 0.15); }
3015+
100% { background-color: transparent; }
29953016
}
29963017

29973018
.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)