fix(ui) - heatmaps and reset token
This commit is contained in:
parent
afc621ec4a
commit
b3a8ff3ed1
4 changed files with 13 additions and 10 deletions
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import Marker from './ElementsMarker/Marker';
|
||||
|
||||
export default function ElementsMarker({ targets, activeIndex }) {
|
||||
return targets && targets.map(t => <Marker target={t} active={activeIndex === t.index - 1}/>)
|
||||
return targets && targets.map(t => <Marker target={t} active={activeIndex === t.index}/>)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ export default function Marker({ target, active }: Props) {
|
|||
height: `${ target.boundingRect.height }px`,
|
||||
}
|
||||
return (
|
||||
<div className={ cn(stl.marker, { [stl.active] : active }) } style={ style } onClick={() => activeTarget(target.index - 1)}>
|
||||
<div className={stl.index}>{target.index}</div>
|
||||
<div className={ cn(stl.marker, { [stl.active] : active }) } style={ style } onClick={() => activeTarget(target.index)}>
|
||||
<div className={stl.index}>{target.index + 1}</div>
|
||||
<Tooltip
|
||||
open={active}
|
||||
arrow
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ const setClient = (state, data) => {
|
|||
|
||||
const reducer = (state = initialState, action = {}) => {
|
||||
switch (action.type) {
|
||||
case RESET_PASSWORD.SUCCESS:
|
||||
case UPDATE_PASSWORD.SUCCESS:
|
||||
case LOGIN.SUCCESS:
|
||||
return setClient(
|
||||
|
|
|
|||
|
|
@ -101,21 +101,23 @@ export default class StatedScreen extends Screen {
|
|||
setMarkedTargets(selections: { selector: string, count: number }[] | null) {
|
||||
if (selections) {
|
||||
const targets: MarkedTarget[] = [];
|
||||
const totalCount = selections.reduce((a, b) => {
|
||||
return a + b.count
|
||||
}, 0);
|
||||
selections.forEach((s, index) => {
|
||||
let index = 0;
|
||||
selections.forEach((s) => {
|
||||
const el = this.getElementBySelector(s.selector);
|
||||
if (!el) return;
|
||||
targets.push({
|
||||
...s,
|
||||
el,
|
||||
index,
|
||||
percent: Math.round((s.count * totalCount) / 100),
|
||||
index: index++,
|
||||
percent: 0,
|
||||
boundingRect: this.calculateRelativeBoundingRect(el),
|
||||
})
|
||||
});
|
||||
update({ markedTargets: targets });
|
||||
|
||||
const totalCount = targets.reduce((a, b) => {
|
||||
return a + b.count
|
||||
}, 0);
|
||||
update({ markedTargets: targets.map(i => ({...i, percent: Math.round((i.count * 100) / totalCount) })) });
|
||||
} else {
|
||||
update({ markedTargets: null });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue