Skip to content

Commit 23e5ffc

Browse files
committed
consistent styling across sessions
1 parent 5883b6c commit 23e5ffc

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

popup/popup.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@
3939
font-size: 12px;
4040
font-weight: bold;
4141
margin-bottom: 2px;
42-
opacity: 0.8;
42+
opacity: 0.9;
43+
color: #e0e0e0;
44+
}
45+
46+
.currentUser .speakerName {
47+
color: #b0c4de;
48+
}
49+
50+
.otherUser .speakerName {
51+
color: #e0e0e0;
4352
}
4453

4554
.chatBubble {

popup/popup.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,11 @@ const createChatMessageElement = (chatInstance) => {
4848
}
4949
}
5050

51-
// Create speaker name element (only show for others, not for current user)
52-
if (!chatInstance.isCurrentUser) {
53-
const speakerNameDiv = document.createElement("div");
54-
speakerNameDiv.classList.add("speakerName");
55-
speakerNameDiv.textContent = chatInstance.role;
56-
messageDiv.appendChild(speakerNameDiv);
57-
}
51+
// Create speaker name element (show for ALL users now, including current user)
52+
const speakerNameDiv = document.createElement("div");
53+
speakerNameDiv.classList.add("speakerName");
54+
speakerNameDiv.textContent = chatInstance.role;
55+
messageDiv.appendChild(speakerNameDiv);
5856

5957
// Create chat bubble
6058
const bubbleDiv = document.createElement("div");
@@ -164,21 +162,17 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
164162
});
165163
}
166164

165+
// Clear the entire container and recreate all messages for consistent styling
166+
chatContainer.innerHTML = '';
167+
168+
// Recreate all messages with consistent styling
167169
chat.forEach((chatInstance) => {
168-
const existingElement = document.querySelector(`[ticId="${chatInstance.ticId}"]`);
169-
170-
if (!existingElement) {
171-
// Create new message element
172-
const messageElement = createChatMessageElement(chatInstance);
173-
chatContainer.appendChild(messageElement);
174-
} else {
175-
// Update existing message content
176-
const bubbleElement = existingElement.querySelector('.chatBubble');
177-
if (bubbleElement) {
178-
bubbleElement.textContent = chatInstance.content;
179-
}
180-
}
170+
const messageElement = createChatMessageElement(chatInstance);
171+
chatContainer.appendChild(messageElement);
181172
});
173+
174+
// Reapply selection highlighting if any
175+
reactToSelectedChats();
182176
}
183177
if (request.type === "CHATGPT_RESPONSE") {
184178
responseStartContentEx.innerText = chat[request.data.startChat].content;

0 commit comments

Comments
 (0)