Skip to content

Commit

Permalink
Resolved merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dhairyashiil committed Jan 8, 2025
2 parents 2c53ef2 + 4d80839 commit 47968c2
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 13 deletions.
1 change: 1 addition & 0 deletions packages/react/src/views/GlobalStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const getGlobalStyles = (theme) => css`
.ec-embedded-chat ::-webkit-scrollbar-thumb:hover {
background: ${theme.colors.primary};
cursor: pointer;
}
.ec-embedded-chat ::-webkit-scrollbar-button {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,76 @@ export const MessageAggregator = ({
);

const setShowSidebar = useSidebarStore((state) => state.setShowSidebar);
const openThread = useMessageStore((state) => state.openThread);
const closeThread = useMessageStore((state) => state.closeThread);

const setJumpToMessage = (msg) => {
if (!msg || !msg._id) {
console.error('Invalid message object:', msg);
return;
}

const { _id: msgId, tmid: threadId } = msg;

const setJumpToMessage = (msgId) => {
if (msgId) {
const childElement = document.getElementById(`ec-message-body-${msgId}`);
const element = childElement.closest('.ec-message');
let element;
if (threadId) {
const parentMessage = messages.find((m) => m._id === threadId);

if (parentMessage) {
closeThread();

setTimeout(() => {
openThread(parentMessage);
setShowSidebar(false);

setTimeout(() => {
const childElement = document.getElementById(
`ec-message-body-${msgId}`
);
element = childElement.closest('.ec-message');

if (element) {
setShowSidebar(false);
element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
if (element) {
element.scrollIntoView({
behavior: 'smooth',
block: 'nearest',
});

element.style.backgroundColor =
mode === 'light'
? darken(theme.colors.warning, 0.03)
: lighten(theme.colors.warningForeground, 0.03);
element.style.backgroundColor =
mode === 'light'
? darken(theme.colors.warning, 0.03)
: lighten(theme.colors.warningForeground, 0.03);

setTimeout(() => {
element.style.backgroundColor = '';
}, 2000);
}
}, 300);
}, 300);
}
} else {
closeThread();

setTimeout(() => {
element.style.backgroundColor = '';
}, 2000);
const childElement = document.getElementById(
`ec-message-body-${msgId}`
);
element = childElement.closest('.ec-message');

if (element) {
setShowSidebar(false);
element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });

element.style.backgroundColor =
mode === 'light'
? darken(theme.colors.warning, 0.03)
: lighten(theme.colors.warningForeground, 0.03);

setTimeout(() => {
element.style.backgroundColor = '';
}, 2000);
}
}, 300);
}
}
};
Expand Down Expand Up @@ -157,7 +209,7 @@ export const MessageAggregator = ({
<ActionButton
square
ghost
onClick={() => setJumpToMessage(msg._id)}
onClick={() => setJumpToMessage(msg)}
css={{
position: 'relative',
zIndex: 10,
Expand Down

0 comments on commit 47968c2

Please sign in to comment.