Skip to content

Add static Kaohsiung parking site (HTML/CSS/JS)#4

Closed
ethan-CCY wants to merge 1 commit intomainfrom
codex/create-static-web-page-for-kaohsiung-parking-eefbt9
Closed

Add static Kaohsiung parking site (HTML/CSS/JS)#4
ethan-CCY wants to merge 1 commit intomainfrom
codex/create-static-web-page-for-kaohsiung-parking-eefbt9

Conversation

@ethan-CCY
Copy link
Owner

Motivation

  • Provide a simple, framework-free static site to browse 高雄市停車場資料 with search, filters, grouping, and quick Google Maps access.
  • Prefer the schema file that contains thumbnail (place photo / street view) information while keeping a curated JSON fallback for robustness.
  • Keep Google API usage optional by leaving YOUR_API_KEY placeholders in constructed photo URLs so the site can be deployed without an API key.
  • Make the site easily deployable on GitHub Pages with downloadable CSV/JSON links in the footer.

Description

  • Added index.html (UI and controls), assets/styles.css (responsive card-based styling), and assets/app.js (client logic) implementing modular functions loadData(), normalizeItem(), getThumbnailUrl(), applyFilters(), and renderList().
  • Data loading prefers kaohsiung_parking_lots_2025-12-25_schema_placephoto_fallback.json and falls back to kaohsiung_parking_lots_2025-12-25_curated.json, with normalizeItem() unifying both formats into a single internal shape.
  • Implemented filtering (keyword, vehicle type, pricing-difference, contains month-cap phrases), sorting (by name or by first numeric value in pricing.weekday), grouping by administrative district, and card rendering that shows name, address (copy button), vehicle types, pricing, Google rating text, thumbnail resolution, and an "Open in Google Maps" link.
  • Thumbnail resolution follows the requested rules: use thumbnail.place_photo.url, or construct a URL from photo_reference via templates.classic_photoreference_url_template or from photo_resource_name via templates.new_photo_resource_url_template (both left with YOUR_API_KEY), otherwise use thumbnail.street_view.url, and finally show a placeholder when no image is available.

Testing

  • Ran a small JSON inspection script to load and sample the primary schema file and confirmed it contains 33 items (succeeded).
  • Served the site locally with python -m http.server to verify static assets are reachable and the page loads (server started successfully).
  • Attempted an automated Playwright screenshot to validate rendering, but the headless Chromium crashed and the Playwright run failed.
  • No automated unit tests were added; visual/manual verification is expected after deployment.

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<div class="container footer-content">
<span>資料檔下載:</span>
<a href="/kaohsiung_parking_lots_2025-12-25_curated.csv" download>CSV</a>
<a href="/kaohsiung_parking_lots_2025-12-25_curated.json" download>JSON</a>

Choose a reason for hiding this comment

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

P2 Badge Point JSON download to an existing file

The footer links to kaohsiung_parking_lots_2025-12-25_curated.json, but a repo search (rg -n "curated.json") only finds references and no actual file in the tree (only the schema JSON is present). That means this download link will 404 for users, and the fallback fetch in assets/app.js will also fail if the primary fetch fails. Either add the missing JSON file or update the link/fallback to an existing JSON asset.

Useful? React with 👍 / 👎.

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>高雄市停車場資訊</title>
<link rel="stylesheet" href="/assets/styles.css" />

Choose a reason for hiding this comment

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

P2 Badge Avoid root-relative asset/data URLs

The stylesheet is referenced with a root-relative URL (/assets/styles.css). When this is deployed as a GitHub Pages project site (e.g., https://user.github.io/repo/), root-relative URLs resolve to the domain root and return 404, so CSS/JS/data fail to load. Use relative paths (or a <base> tag) so assets resolve under the project subpath.

Useful? React with 👍 / 👎.

@ethan-CCY ethan-CCY closed this Dec 30, 2025
@ethan-CCY ethan-CCY deleted the codex/create-static-web-page-for-kaohsiung-parking-eefbt9 branch December 30, 2025 12:37
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