Skip to content

[render preview] Closes #120 - #130

Merged
LindseyB merged 10 commits into
mainfrom
web-components-120
Jun 28, 2026
Merged

LindseyB merged 10 commits into
mainfrom
web-components-120

Conversation

@LindseyB

Copy link
Copy Markdown
Owner

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

  • Introduced a set of custom Web Components under static/js/components/ for reusable UI features, including astro-button, astro-section-toggle, astro-copy-analysis, astro-datetime-input, astro-timezone-select, and astro-chart-wheel. These components encapsulate UI logic and are registered from a central index.
  • Added new implementations for astro-button (astro-button.js), astro-copy-analysis (astro-copy-analysis.js), and astro-chart-wheel (astro-chart-wheel.js) with clear APIs, event emission, and slot/attribute-based configuration. [1] [2] [3]

Chart Wheel Refactor

  • Refactored chart-wheel.js to expose an initializeChartWheel function that supports both legacy and Web Component lifecycles, with configurable selectors and download filename. It now automatically initializes only if no astro-chart-wheel is present. [1] [2] [3]

Legacy Adapter Deprecation

  • Updated legacy compatibility adapters (button-loading.js, etc.) to emit deprecation warnings and only support old templates. All new behavior is now handled by Web Components.

Documentation

  • Updated README.md to document the new component system, their APIs, attributes, and usage patterns, and clarified the deprecation of legacy scripts.

Other Improvements

  • Added ask-anything-page.js for 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.

Copilot AI review requested due to automatic review settings June 28, 2026 06:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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.js to 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.

Comment thread static/js/components/astro-timezone-select.js
Comment thread static/js/components/astro-timezone-select.js
Comment thread static/js/components/astro-copy-analysis.js
Comment thread static/js/chart-wheel.js
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 22 out of 22 changed files in this pull request and generated 2 comments.

Comment thread static/js/copy-analysis.js
Comment thread static/js/button-loading.js Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 22 out of 22 changed files in this pull request and generated 4 comments.

Comment thread static/js/components/astro-section-toggle.js
Comment thread templates/full_chart.html Outdated
Comment thread templates/full_chart.html Outdated
Comment thread static/js/copy-analysis.js
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 22 out of 22 changed files in this pull request and generated 2 comments.

Comment thread static/js/button-loading.js Outdated
Comment thread static/js/ask-anything-page.js
LindseyB and others added 2 commits June 28, 2026 10:18
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 22 out of 22 changed files in this pull request and generated 6 comments.

Comment thread README.md
Comment thread README.md
Comment thread static/js/components/astro-timezone-select.js
Comment thread static/js/components/astro-timezone-select.js Outdated
Comment thread static/js/components/astro-timezone-select.js
Comment thread tests/test_frontend.py
LindseyB and others added 4 commits June 28, 2026 11:52
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 LindseyB changed the title Closes #120 [render preview] Closes #120 Jun 28, 2026
@LindseyB
LindseyB temporarily deployed to web-components-120 - astro PR #130 June 28, 2026 19:05 — with Render Destroyed
@LindseyB
LindseyB merged commit aad496c into main Jun 28, 2026
2 checks passed
@LindseyB
LindseyB deleted the web-components-120 branch June 28, 2026 19:09

This branch was successfully deployed

No deployments
web-components-120 - astro PR #130 — c1af9943 Deployed Jun 28, 2026 by LindseyB
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.

Migrate frontend UI architecture to Web Components (incremental migration plan)

2 participants