Repository navigation
[render preview] Closes #120 - #130
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR establishes a centralized Web Components-based frontend architecture for reusable UI behaviors, updates templates to use the new custom elements, and keeps legacy scripts as deprecated compatibility adapters.
Changes:
- Added a component registry (
static/js/components/index.js+registry.js) and new Web Components for buttons, copy-to-clipboard, section toggles, datetime inputs, timezone select, and chart wheel. - Refactored
static/js/chart-wheel.jsto expose an initializer usable by both legacy pages and the new<astro-chart-wheel>lifecycle. - Updated templates and frontend tests/docs to reflect the new component-driven integration and deprecation of legacy adapters.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_frontend.py | Updates/extends frontend regression coverage to assert component tags and registry asset presence. |
| templates/base.html | Loads the centralized component module (type="module") for global registration. |
| templates/index.html | Wraps datetime/timezone UI in <astro-datetime-input> / <astro-timezone-select> and removes legacy script includes. |
| templates/chart.html | Replaces legacy copy behavior with <astro-copy-analysis> wrapper. |
| templates/full_chart.html | Wraps chart wheel and toggles with <astro-chart-wheel> / <astro-section-toggle> and updates copy behavior. |
| templates/ask_anything.html | Migrates copy + submit UX to <astro-copy-analysis> / <astro-button> and moves page JS into a static asset. |
| templates/live_mas.html | Migrates copy behavior to <astro-copy-analysis> and removes legacy include. |
| static/js/components/index.js | Registers all Astro components from a single entrypoint. |
| static/js/components/registry.js | Central registry for defining all custom elements once. |
| static/js/components/helpers.js | Shared utilities for components (events, storage, attribute parsing, spinner markup). |
| static/js/components/astro-button.js | New submit-button loading/validation component behavior. |
| static/js/components/astro-copy-analysis.js | New copy-to-clipboard component with feedback and emitted events. |
| static/js/components/astro-datetime-input.js | Componentized digit-only datetime input formatting + native picker sync. |
| static/js/components/astro-timezone-select.js | Componentized Select2 init + localStorage sync for timezone selection. |
| static/js/components/astro-section-toggle.js | Componentized collapsible section behavior with persisted state + events. |
| static/js/components/astro-chart-wheel.js | Component wrapper that delegates lifecycle to window.initChartWheel. |
| static/js/chart-wheel.js | Refactors wheel initialization into initializeChartWheel() with cleanup support and a legacy fallback path. |
| static/js/button-loading.js | Deprecates legacy adapter and scopes legacy loading behavior behind an attribute gate. |
| static/js/copy-analysis.js | Deprecates legacy adapter and forwards copyAnalysis() into <astro-copy-analysis> when present. |
| static/js/section-toggle.js | Deprecates legacy adapter and hardens legacy toggling behavior + warnings. |
| static/js/ask-anything-page.js | Extracts ask-anything page UX behavior into a dedicated static script. |
| README.md | Documents the new component system, APIs, and legacy adapter status. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
LindseyB
temporarily deployed
to
web-components-120 - astro PR #130
June 28, 2026 19:05 — with
Render
Destroyed
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new frontend architecture based on Web Components for reusable UI behavior, deprecates legacy JavaScript adapters, and refactors related code to support the new system. The main changes include adding new custom elements for buttons, section toggles, copy-to-clipboard, date/time input, timezone selection, and the chart wheel, along with documentation and compatibility updates.
Closes #120
Frontend Componentization and Web Components
static/js/components/for reusable UI features, includingastro-button,astro-section-toggle,astro-copy-analysis,astro-datetime-input,astro-timezone-select, andastro-chart-wheel. These components encapsulate UI logic and are registered from a central index.astro-button(astro-button.js),astro-copy-analysis(astro-copy-analysis.js), andastro-chart-wheel(astro-chart-wheel.js) with clear APIs, event emission, and slot/attribute-based configuration. [1] [2] [3]Chart Wheel Refactor
chart-wheel.jsto expose aninitializeChartWheelfunction that supports both legacy and Web Component lifecycles, with configurable selectors and download filename. It now automatically initializes only if noastro-chart-wheelis present. [1] [2] [3]Legacy Adapter Deprecation
button-loading.js, etc.) to emit deprecation warnings and only support old templates. All new behavior is now handled by Web Components.Documentation
README.mdto document the new component system, their APIs, attributes, and usage patterns, and clarified the deprecation of legacy scripts.Other Improvements
ask-anything-page.jsfor improved chat input UX, including auto-grow and submit-on-Enter behavior.These changes modernize the frontend codebase, improve maintainability, and provide a clear migration path away from legacy scripts toward a component-based architecture.