fix(ui): fix ontabclick

This commit is contained in:
nick-delirium 2023-06-08 16:44:47 +02:00
parent e2201affe0
commit b21b69e09f
3 changed files with 8 additions and 5 deletions

View file

@ -108,7 +108,7 @@ class EventGroupWrapper extends React.Component {
isLastInGroup={isLastInGroup}
whiteBg={true}
/>
) : isTabChange ? (<TabChange from={event.fromTab} to={event.toTab} activeUrl={event.activeUrl} />) : (
) : isTabChange ? (<TabChange onClick={this.onEventClick} from={event.fromTab} to={event.toTab} activeUrl={event.activeUrl} />) : (
<Event
key={event.key}
event={event}
@ -130,12 +130,15 @@ class EventGroupWrapper extends React.Component {
}
}
function TabChange({ from, to, activeUrl }) {
function TabChange({ from, to, activeUrl, onClick }) {
if (!from) {
return null;
}
return (
<div className={'p-2 bg-gray-lightest w-full my-2 border-gray-light border-t border-b !border-l-0 !border-r-0'}>
<div
onClick={onClick}
className={'p-2 cursor-pointer bg-gray-lightest w-full border-gray-light border-t border-b !border-l-0 !border-r-0'}
>
<div className={'flex items-center gap-2 px-4'}>
<span style={{ fontWeight: 500 }}>
{from}

View file

@ -61,7 +61,7 @@ function EventsBlock(props: IProps) {
let i = urlsList.length - 1;
while (!found && i >= 0) {
const item = urlsList[i]
if (item.url && item.time <= ev.mTime) {
if (item.url && item.time <= ev.time) {
found = true;
ev.activeUrl = item.url.replace(/.*\/\/[^\/]*/, '');
}

View file

@ -258,7 +258,7 @@ export default class MessageManager {
if (!prevChange || prevChange.tabId !== msg.tabId) {
this.tabChangeEvents.push({
tabId: msg.tabId,
mTime: msg.time,
time: msg.time,
timestamp: this.sessionStart + msg.time,
toTab: mapTabs(this.tabs)[msg.tabId],
fromTab: prevChange?.tabId ? mapTabs(this.tabs)[prevChange.tabId] : '',