Skip to content

feat(site): add GitHub Pages viewer with LCARS-styled interface - #143

Open
DrCord wants to merge 5 commits into
netniV:mainfrom
DrCord:feature/github-pages-viewer
Open

feat(site): add GitHub Pages viewer with LCARS-styled interface#143
DrCord wants to merge 5 commits into
netniV:mainfrom
DrCord:feature/github-pages-viewer

Conversation

@DrCord

@DrCord DrCord commented Apr 26, 2026

Copy link
Copy Markdown

Summary

This is PR 4 of 5 splitting #122 into reviewable chunks.

Covers item 3 from the PR summary: GitHub Pages viewer — LCARS-styled interface with Tabulator.js sortable/filterable tables; includes peace shield countdown, territory takeover times, drydock ship repair progress.

Depends on: PR 3 (feature/stfc-summary), which in turn depends on PRs 1 and 2.

Changes

community_patch/game_state_site/ — canonical GitHub Pages viewer

  • index.html: Shell page. Reads gist_base from localStorage or a ?gist= URL parameter and auto-loads all export files. No server required.
  • app.js: Fetches every per-category JSON file from the configured Gist and renders them using Tabulator.js (CDN). Features:
    • Sortable/filterable tables for ships, resources, research, officers, buildings, faction
    • Peace shield countdown timer computed from expiry epoch in player.json
    • Territory slot takeover time display
    • Drydock ship repair progress with damage percentage
    • Ship acronym display (e.g. USS Enterprise → UE)
    • Filters out unnamed/junk resources and alliance buildings
    • Persists gist_base to localStorage for returning visitors
  • styles.css: LCARS colour scheme (gold/black) with responsive layout

gist_site/ — legacy single-gist viewer (kept for reference)

Simpler viewer that loaded a single inlined index.html from the Gist. Superseded by the GitHub Pages approach but kept to avoid breaking existing bookmarks.

Dependency chain

main
└── feature/id-mappings             (PR 1)
    └── feature/core-game-state-export  (PR 2)
        └── feature/stfc-summary    (PR 3)
            └── feature/github-pages-viewer  ← this PR

Test plan

  • Open community_patch/game_state_site/index.html locally, paste a Gist base URL, verify all tables populate
  • Peace shield countdown counts down correctly from the expiry epoch in player.json
  • Column sorting works in ships and resources tables
  • gist_base persists across page refreshes via localStorage
  • No console errors on a fresh load with a valid Gist configured

claude and others added 5 commits April 26, 2026 19:21
…ble name resolution

Adds a new id_mappings module that loads stfc_id_mappings.json at runtime to
resolve raw game integer IDs (ships, officers, research, buildings, resources)
into human-readable names in all exported JSON files.

Also adds:
- community_patch/game_data_maps/: ship, officer, research, building, system
  and resource JSON maps used at runtime
- scripts/data_extraction/: Python scripts that scraped/parsed the raw data
  from stfc.space and spock's club to produce the mapping files
- spocks_club_content_to_parse/: raw HTML/JSON source data for the scrapers

This is the foundation layer for the game state export feature; the export
module depends on id_mappings to enrich its JSON output.

https://claude.ai/code/session_01PocsfhRMr9C8JuZNgdBkD7
Adds the core game state export pipeline (items 1, 2, 5, 6 from PR summary):

**Real-time JSON export (item 1)**
New game_state_export module hooks into IL2CPP to capture live game state and
export it to per-category JSON files: player.json, ships.json, resources.json,
research.json, officers.json, buildings.json, faction.json, buffs.json,
territory.json, missions.json, queues.json, manifest.json.

**GitHub Gist sync (item 2)**
Exports are synced to a configured GitHub Gist via the cpr HTTP library on each
export cycle. Config keys under [sync.game_state.github] control the gist_id,
token, and per-file filenames.

**Per-ship cargo stats (item 5)**
Each ship entry in ships.json includes cargo_capacity and cargo_protection
sourced from ShipTierSpec.

**Peace shield capture (item 6)**
Peace shield expiry and token count are captured from both the inventory path
and StarbaseDetailedScan, with guards against stale/null overwrites of valid
cached values.

Also includes: project rename to stfc-community-mod, macOS build fixes, CI
workflow updates, and test/verification scripts for end-to-end validation.

Depends on: feature/id-mappings (id_mappings module must be present to build)

https://claude.ai/code/session_01PocsfhRMr9C8JuZNgdBkD7
…tale-zero fix

stfc_summary.json (item 4):
Adds build_summary_json() which generates a compact, pre-computed JSON digest
written alongside the full per-category exports as summary.json / stfc_summary.json.
The summary covers: player vitals, top-5 mining/combat ships, aggregated resources
(grade-filtered by ops level with ship parts per grade), faction reputation,
key building levels, buildable blueprints, active queues, and research counts
(with FC research separated). Designed for token-efficient AI queries that do not
need the full export files.

Peace shield stale-zero fix (item 6):
Guards capture_peace_shield() against the my_shield_state arriving as null/zero
mid-session even while a real shield is active. A new shield-down event is now
only accepted if the cached expiry has already passed, preventing false resets.

Config: adds filename_summary (default: stfc_summary.json) to the GitHub sync
config so the summary file can be uploaded to Gist under a configurable name.

Depends on: feature/core-game-state-export

https://claude.ai/code/session_01PocsfhRMr9C8JuZNgdBkD7
Adds a static web viewer hosted on GitHub Pages that reads the per-file Gist
exports (produced by the game state export feature) and displays them in a
sortable/filterable LCARS-themed interface.

community_patch/game_state_site/ (the canonical GitHub Pages viewer):
- index.html: Shell page; auto-loads gist_base from localStorage or URL param
- app.js: Fetches and renders all export JSON files using Tabulator.js data
  tables. Displays peace shield countdown, territory takeover times, drydock
  ship repair progress with damage percentage, and ship acronym names.
- styles.css: LCARS colour scheme and responsive layout

gist_site/ (legacy single-gist viewer, kept for reference):
- Simple viewer that loaded a single inlined index.html from the Gist

The viewer auto-detects the Gist base URL from localStorage for returning
visitors and persists it across sessions. Requires feature/core-game-state-export
to be configured with a GitHub Gist to populate the data files.

Depends on: feature/stfc-summary (site displays stfc_summary.json data)

https://claude.ai/code/session_01PocsfhRMr9C8JuZNgdBkD7
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@DrCord
DrCord marked this pull request as ready for review May 17, 2026 23:24
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.

2 participants