Skip to content

Commit

Permalink
Clear data on mode change and handle click on small circles
Browse files Browse the repository at this point in the history
  • Loading branch information
mayan-000 committed Dec 30, 2024
1 parent bd079da commit 5c5ce6d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ const Panel = ({

useEffect(() => {
setTopicsTableData({});
}, [isInteractiveModeOn, setTopicsTableData]);
setActiveTab(0);
setEpochCompleted({});
setPAStorage('');
}, [isInteractiveModeOn, setActiveTab, setPAStorage, setTopicsTableData]);

const extraInterface = (
<div className="flex gap-2 items-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,17 +416,13 @@ export function topicsAnimation(
app.resetInfoBox(app.inspectedCircleIndex);
}

if (app.inspectedCircleIndex === index) {
return;
}

app.drawInfoBox(index, epoch[index].website);
app.inspectedCircleIndex = index;
}
});

app.smallCirclePositions[app.inspectedCircleIndex]?.forEach(
(position) => {
Object.values(app.smallCirclePositions).forEach((smallCircles) => {
smallCircles?.forEach((position) => {
const { x: smallCircleX, y: smallCircleY } = position;
const smallCircleDiameter = config.timeline.circleProps.diameter / 5;

Expand All @@ -439,8 +435,8 @@ export function topicsAnimation(
app.showHandCursor = true;
isInspecting = true;
}
}
);
});
});

if (!isInspecting) {
app.showHandCursor = false;
Expand All @@ -466,20 +462,27 @@ export function topicsAnimation(
y > circleY - diameter / 2 &&
y < circleY + diameter / 2
) {
if (app.prevVisitedCircleIndex === index) {
return;
}

if (app.prevVisitedCircleIndex !== -1) {
app.userVisitDone(app.prevVisitedCircleIndex);
}

if (app.smallCirclePositions[index] === undefined) {
app.handleUserVisit(index);
app.prevVisitedCircleIndex = index;
} else {
app.drawInfoBox(index, epoch[index].website);
app.prevVisitedCircleIndex = index;
}
}
});
}

app.smallCirclePositions[app.inspectedCircleIndex]?.forEach(
(position, index) => {
Object.values(app.smallCirclePositions).forEach((smallCircles) => {
smallCircles?.forEach((position, index) => {
const { x: smallCircleX, y: smallCircleY } = position;
const smallCircleDiameter = config.timeline.circleProps.diameter / 5;

Expand All @@ -490,11 +493,11 @@ export function topicsAnimation(
y < smallCircleY + smallCircleDiameter / 2
) {
setHighlightAdTech(
siteAdTechs[epoch[app.inspectedCircleIndex].website][index]
siteAdTechs[epoch[app.prevVisitedCircleIndex].website][index]
);
}
}
);
});
});
},
};

Expand Down

0 comments on commit 5c5ce6d

Please sign in to comment.