Skip to content

Add weekly riding input, inline feedback, and weekly-based savings calculations#1

Open
moustyb wants to merge 1 commit into
mainfrom
codex/upgrade-the-code
Open

Add weekly riding input, inline feedback, and weekly-based savings calculations#1
moustyb wants to merge 1 commit into
mainfrom
codex/upgrade-the-code

Conversation

@moustyb
Copy link
Copy Markdown
Owner

@moustyb moustyb commented Feb 14, 2026

Motivation

  • Provide a more realistic usage model by letting users specify how many days per week they bike so savings scale with actual riding frequency.
  • Improve UX by replacing blocking alert()s with an inline, accessible status message to communicate validation and success.
  • Make monthly/yearly projections more consistent by deriving them from weekly totals and present results with clearer number formatting.

Description

  • Added a Days biked per week numeric input and an accessible inline message element (#formMessage) to index.html.
  • Reworked script.js to add constants for DAYS_PER_WEEK, WEEKS_PER_YEAR, and MONTHS_PER_YEAR, to validate the new input, and to replace alert-based validation with setMessage() which updates the inline status element.
  • Changed calculations to compute CO₂, gas, and money saved on a weekly basis and derive monthly/yearly projections from weekly totals, adjusted the medal logic to compare annual biking distance using the chosen weekly schedule, and added formatNumber() for locale-friendly output.
  • Added .form-message success/error styles to style.css for the inline status feedback.

Testing

  • Ran a static JavaScript syntax check with node --check script.js, which completed successfully.
  • Served the app with python3 -m http.server 4173 and ran an automated Playwright script that fills the form, submits a sample calculation, and captured a screenshot to verify UI and result rendering, which succeeded.
  • Manual visual verification was captured via the generated screenshot from the headless run.

Codex Task

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 14, 2026

Deploying co2-calculator with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1b861d5
Status: ✅  Deploy successful!
Preview URL: https://40bee685.co2-calculator-atb.pages.dev
Branch Preview URL: https://codex-upgrade-the-code.co2-calculator-atb.pages.dev

View logs

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
co-2-calculator Ready Ready Preview, Comment Feb 14, 2026 11:16pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant