fixed activity incident highlight

This commit is contained in:
Андрей Бабушкин 2025-05-27 11:03:19 +02:00
parent e880c27e54
commit 94b0a99f63
3 changed files with 9 additions and 13 deletions

View file

@ -190,7 +190,7 @@ function TabChange({ from, to, activeUrl, onClick }) {
);
};
function Incident({ label, onClick, isCurrent }: { label: string; onClick: () => void; isCurrent?: boolean }) {
function Incident({ label, onClick }: { label: string; onClick: () => void }) {
const { t } = useTranslation();
return (
<div

View file

@ -118,16 +118,16 @@ function EventsBlock(props: IProps) {
zoomStartTs,
zoomEndTs,
uiPlayerStore.showOnlySearchEvents,
incidents,
]);
const findLastFitting = React.useCallback(
(time: number) => {
if (!usedEvents.length) return 0;
let i = usedEvents.length - 1;
const allEvents = usedEvents.concat(incidents);
if (!allEvents.length) return 0;
let i = allEvents.length - 1;
if (time > endTime / 2) {
while (i >= 0) {
const event = usedEvents[i];
while (i > 0) {
const event = allEvents[i];
if ('time' in event && event.time <= time) break;
i--;
}
@ -135,18 +135,18 @@ function EventsBlock(props: IProps) {
}
let l = 0;
while (l < i) {
const event = usedEvents[l];
const event = allEvents[l];
if ('time' in event && event.time >= time) break;
l++;
}
return l;
},
[usedEvents, time, endTime],
[usedEvents, incidents, time, endTime],
);
useEffect(() => {
setCurrentTimeEventIndex(findLastFitting(time));
}, []);
}, [time]);
const write = ({
target: { value },

View file

@ -452,7 +452,6 @@ export default class Session {
userTestingEvents: any[] = [],
incidents: any[] = [],
) {
console.log('ADD EVENTS', errors, issues, sessionEvents, incidents);
const exceptions =
(errors as IError[])?.map((e) => new SessionError(e)) || [];
const issuesList =
@ -523,12 +522,10 @@ export default class Session {
);
this.events = events;
console.log('notesWithEvents 0', this.notesWithEvents, mixedEventsWithIssues);
// @ts-ignore
this.notesWithEvents = [
...this.notesWithEvents,
...mixedEventsWithIssues,
...incidentsList,
].sort(sortEvents);
this.errors = exceptions;
this.issues = issuesList;
@ -538,7 +535,6 @@ export default class Session {
this.crashes = crashes || [];
this.addedEvents = true;
this.incidents = incidentsList;
console.log('notesWithEvents', this.notesWithEvents, mixedEventsWithIssues);
return this;
}