Skip to content

feat: show icons when threhsolds are reached, remove threhsold lines#123

Merged
MatteoGabriele merged 2 commits into
MatteoGabriele:mainfrom
graphieros:account-timeline-chart-improvements
May 15, 2026
Merged

feat: show icons when threhsolds are reached, remove threhsold lines#123
MatteoGabriele merged 2 commits into
MatteoGabriele:mainfrom
graphieros:account-timeline-chart-improvements

Conversation

@graphieros
Copy link
Copy Markdown
Contributor

@graphieros graphieros commented May 15, 2026

This removes the threshold lines from the account timeline chart, and displays icons above datapoints that actually exceed the threshold:

image

Icons will be displayed above exceeding datapoints for the forks and PR series.

Summary by CodeRabbit

  • Bug Fixes & Improvements

    • Updated threshold alert rendering to use custom SVG icons for better visibility and clarity.
    • Improved chart scale calculation to focus on dataset values only.
    • Adjusted chart layout spacing for optimal icon display.
  • Style

    • Removed certain CSS transition effects for smoother, cleaner visual rendering.

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for agentscan ready!

Name Link
🔨 Latest commit e9143c0
🔍 Latest deploy log https://app.netlify.com/projects/agentscan/deploys/6a075ed6beb9d3000858b7ef
😎 Deploy Preview https://deploy-preview-123--agentscan.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

📝 Walkthrough

Walkthrough

AccountEventsTimeline.vue refactors threshold visualization from built-in chart annotations to custom SVG alert icons. The component now enriches dataset items with threshold values, computes alert icon coordinates by comparing data against thresholds, removes annotation-based scale logic, adjusts layout and scale to accommodate icons, and renders icons through an SVG slot.

Changes

Threshold rendering refactor: annotations to SVG alert icons

Layer / File(s) Summary
Type imports and dataset enrichment
app/components/Chart/AccountEventsTimeline.vue
Adds VueUiXyDatasetLineItem import and enriches each plotted dataset line item with a threshold field derived from event config.
Alert icon coordinate computation
app/components/Chart/AccountEventsTimeline.vue
Introduces Datapoints and PlotAlert helper types and an alertIcons function that maps datapoints into alert icon coordinates by comparing absoluteValues against each datapoint's threshold.
Remove annotation-based thresholds
app/components/Chart/AccountEventsTimeline.vue
Removes the computed thresholds annotation property and its VueUiXyAnnotation typing that previously drove chart annotations.
Scale and layout adjustments
app/components/Chart/AccountEventsTimeline.vue
Replaces chart scale calculation to use only dataset series values via a new maxValue computed property (excluding thresholds), and adds top padding to chart layout to accommodate alert icon rendering.
SVG rendering and CSS cleanup
app/components/Chart/AccountEventsTimeline.vue
Renders alert icons through the #svg slot by iterating over computed alert coordinates and conditionally drawing path markers; removes .svg-element-transition CSS rules from both standard and reduced-motion transition selectors.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • MatteoGabriele/agentscan#110: Prior PR that introduced XY thresholds annotations and scale computation; this PR replaces that approach with custom SVG alert icons.
  • MatteoGabriele/agentscan#90: Earlier PR that reworked timeline dataset building from events; this PR further modifies per-series threshold rendering.
  • MatteoGabriel/agentscan#89: Related timeline rendering changes to the same chart component.

Suggested reviewers

  • MatteoGabriele

Poem

🐰 From annotations once so bold,
Alert icons now take hold!
SVG paths mark the way,
Where thresholds cross today.
Cleaner scales, a fresher sight—
Hop along, the chart feels right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title describes showing icons when thresholds are reached and removing threshold lines, which aligns with the main change of shifting from threshold line annotations to custom SVG alert icons.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@graphieros graphieros marked this pull request as draft May 15, 2026 17:33
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
app/components/Chart/AccountEventsTimeline.vue (1)

260-291: ⚡ Quick win

Datapoints.threshold should reflect that the field can be null/undefined.

config.threshold is null for CreateEvent (Line 78), so the data items written on Line 144 carry threshold: number | null. Declaring threshold: number here means the runtime filter on Line 274 (d.threshold !== null && d.threshold !== undefined) looks redundant to TypeScript, and the >= d.threshold comparison on Line 286 silently relies on the (incorrect) number type rather than narrowing through the filter. Tightening the type and using a type predicate makes the null-handling intent explicit and keeps TS honest:

♻️ Proposed type refinement
-type Datapoints = Array<VueUiXyDatasetLineItem & { threshold: number }>;
+type Datapoint = VueUiXyDatasetLineItem & { threshold: number | null | undefined };
+type Datapoints = Array<Datapoint>;
@@
-function alertIcons(data: Datapoints, zoomOffset = 0): PlotAlert[] {
-  return data
-    .filter((d) => d.threshold !== null && d.threshold !== undefined)
-    .map((d) => {
+function alertIcons(data: Datapoints, zoomOffset = 0): PlotAlert[] {
+  return data
+    .filter((d): d is Datapoint & { threshold: number } =>
+      d.threshold !== null && d.threshold !== undefined,
+    )
+    .map((d) => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/components/Chart/AccountEventsTimeline.vue` around lines 260 - 291,
Update the Datapoints type so threshold can be null/undefined (e.g., threshold:
number | null | undefined) and change the filter in alertIcons to a type
predicate that narrows d to the non-null-threshold case before mapping; this
ensures TypeScript knows d.threshold is a number when used in the isAlert
comparison inside alertIcons (refer to Datapoints, PlotAlert, and the alertIcons
function and its filter/map logic).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/components/Chart/AccountEventsTimeline.vue`:
- Around line 206-208: The current top chart padding in
AccountEventsTimeline.vue (padding.top = 24) is too small for the lightning-bolt
alert icon drawn by the path using plot.x/plot.y (see the path at line with "M
${plot.x - 4} ${plot.y - 6} l 12 -17 ..." which extends ~36px above the
datapoint); increase padding.top to ~36–40 (or reduce the icon's vertical extent
in the lightning-bolt path) so the icon has sufficient headroom and won't be
clipped or overlap chart chrome—update the padding.top value or adjust the path
coordinates accordingly in the component.
- Around line 173-179: The computed maxValue currently calls
Math.max(...datasetLine.value.filter(s =>
selectedLegendItems.value.includes(s.name)).flatMap(d => d.series.map(v => v ??
0))) which can produce -Infinity when the filtered array is empty; update the
maxValue computed (referencing datasetLine and selectedLegendItems) to first
build the flattened values array, check if it is empty, and return a safe
fallback (e.g., 0) in that case, or alternatively call Math.max with a fallback
like Math.max(0, ...values) so scaleMax (the value used later to set the y-axis)
never receives -Infinity.

---

Nitpick comments:
In `@app/components/Chart/AccountEventsTimeline.vue`:
- Around line 260-291: Update the Datapoints type so threshold can be
null/undefined (e.g., threshold: number | null | undefined) and change the
filter in alertIcons to a type predicate that narrows d to the
non-null-threshold case before mapping; this ensures TypeScript knows
d.threshold is a number when used in the isAlert comparison inside alertIcons
(refer to Datapoints, PlotAlert, and the alertIcons function and its filter/map
logic).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 303f7e52-3a17-430e-8c52-c72e777ff266

📥 Commits

Reviewing files that changed from the base of the PR and between ad8dee9 and 22ed472.

📒 Files selected for processing (1)
  • app/components/Chart/AccountEventsTimeline.vue

Comment thread app/components/Chart/AccountEventsTimeline.vue
Comment thread app/components/Chart/AccountEventsTimeline.vue
@graphieros graphieros marked this pull request as ready for review May 15, 2026 17:59
Copy link
Copy Markdown
Owner

@MatteoGabriele MatteoGabriele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MatteoGabriele MatteoGabriele merged commit c62783d into MatteoGabriele:main May 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants