-
Notifications
You must be signed in to change notification settings - Fork 1
Two small UI tweaks #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds two UI enhancements to the price history graph: a double-click gesture to reset zoom levels and a hover display showing the price and date at the cursor position.
- Implements double-click to reset graph zoom using uPlot's hooks system
- Adds real-time price/date display when hovering over the graph
- Provides user guidance with instructional text below the chart
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
87703e2 to
ac77c7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| u.over.addEventListener('dblclick', handleDblClick); | ||
| // Store handler for cleanup when chart is destroyed | ||
| (u as any)._dblClickHandler = handleDblClick; | ||
| }, | ||
| ], | ||
| destroy: [ | ||
| (u) => { | ||
| const handler = (u as any)._dblClickHandler; | ||
| if (handler) { | ||
| u.over.removeEventListener('dblclick', handler); | ||
| } |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The double-click to reset zoom feature is not keyboard accessible. Consider adding keyboard support (e.g., pressing 'R' or 'Escape' to reset) for users who cannot use a mouse. You could add a keydown event listener in the init hook similar to the double-click handler.
| u.over.addEventListener('dblclick', handleDblClick); | |
| // Store handler for cleanup when chart is destroyed | |
| (u as any)._dblClickHandler = handleDblClick; | |
| }, | |
| ], | |
| destroy: [ | |
| (u) => { | |
| const handler = (u as any)._dblClickHandler; | |
| if (handler) { | |
| u.over.removeEventListener('dblclick', handler); | |
| } | |
| const handleKeyDown = (event: KeyboardEvent) => { | |
| // Allow 'r' or 'Escape' to reset zoom | |
| if ( | |
| (event.key === 'r' || event.key === 'R') || | |
| event.key === 'Escape' | |
| ) { | |
| if (originalScales) { | |
| u.setScale('x', originalScales); | |
| } | |
| } | |
| }; | |
| u.over.addEventListener('dblclick', handleDblClick); | |
| window.addEventListener('keydown', handleKeyDown); | |
| // Store handlers for cleanup when chart is destroyed | |
| (u as any)._dblClickHandler = handleDblClick; | |
| (u as any)._keyDownHandler = handleKeyDown; | |
| }, | |
| ], | |
| destroy: [ | |
| (u) => { | |
| const dblClickHandler = (u as any)._dblClickHandler; | |
| if (dblClickHandler) { | |
| u.over.removeEventListener('dblclick', dblClickHandler); | |
| } | |
| const keyDownHandler = (u as any)._keyDownHandler; | |
| if (keyDownHandler) { | |
| window.removeEventListener('keydown', keyDownHandler); | |
| } |
The build warned that `chartContainer` was updated but not declared with `$state(...)`. In Svelte 5, variables used with `bind:this` must be declared as reactive state to properly track DOM element bindings. Changed from: let chartContainer: HTMLDivElement; To: let chartContainer = $state<HTMLDivElement>(null!); The `null!` non-null assertion tells TypeScript the value will be assigned before use (which is guaranteed by `bind:this` at mount time). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
ac77c7f to
5f0a3e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Users can now double-click the chart or press r/Esc to reset the zoom level after dragging to zoom in. Also adds a hint below the chart explaining the zoom controls. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Display the price and date in the chart header when hovering over the price history graph, providing easier readability of specific data points. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
5f0a3e9 to
3cc7631
Compare
Allow double-clicking to reset the graph zoom level (Claude told me it's a common pattern) and show the price when hovering the graph.