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';
|
import Marker from './ElementsMarker/Marker';
|
||||||
|
|
||||||
export default function ElementsMarker({ targets, activeIndex }) {
|
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`,
|
height: `${ target.boundingRect.height }px`,
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className={ cn(stl.marker, { [stl.active] : active }) } style={ style } onClick={() => activeTarget(target.index - 1)}>
|
<div className={ cn(stl.marker, { [stl.active] : active }) } style={ style } onClick={() => activeTarget(target.index)}>
|
||||||
<div className={stl.index}>{target.index}</div>
|
<div className={stl.index}>{target.index + 1}</div>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
open={active}
|
open={active}
|
||||||
arrow
|
arrow
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ const setClient = (state, data) => {
|
||||||
|
|
||||||
const reducer = (state = initialState, action = {}) => {
|
const reducer = (state = initialState, action = {}) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
case RESET_PASSWORD.SUCCESS:
|
||||||
case UPDATE_PASSWORD.SUCCESS:
|
case UPDATE_PASSWORD.SUCCESS:
|
||||||
case LOGIN.SUCCESS:
|
case LOGIN.SUCCESS:
|
||||||
return setClient(
|
return setClient(
|
||||||
|
|
|
||||||
|
|
@ -101,21 +101,23 @@ export default class StatedScreen extends Screen {
|
||||||
setMarkedTargets(selections: { selector: string, count: number }[] | null) {
|
setMarkedTargets(selections: { selector: string, count: number }[] | null) {
|
||||||
if (selections) {
|
if (selections) {
|
||||||
const targets: MarkedTarget[] = [];
|
const targets: MarkedTarget[] = [];
|
||||||
const totalCount = selections.reduce((a, b) => {
|
let index = 0;
|
||||||
return a + b.count
|
selections.forEach((s) => {
|
||||||
}, 0);
|
|
||||||
selections.forEach((s, index) => {
|
|
||||||
const el = this.getElementBySelector(s.selector);
|
const el = this.getElementBySelector(s.selector);
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
targets.push({
|
targets.push({
|
||||||
...s,
|
...s,
|
||||||
el,
|
el,
|
||||||
index,
|
index: index++,
|
||||||
percent: Math.round((s.count * totalCount) / 100),
|
percent: 0,
|
||||||
boundingRect: this.calculateRelativeBoundingRect(el),
|
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 {
|
} else {
|
||||||
update({ markedTargets: null });
|
update({ markedTargets: null });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue