Skip to content

Commit be76d91

Browse files
veilletteclaude
andcommitted
feat(pages): filter and group the landing page by subject
The landing page had grown to 55 simulations in three fixed lineage buckets. Add a toolbar with subject chips (Physics, Chemistry, Astronomy, Earth Science) with live counts, a search box over names, descriptions and all topics, a collection filter, and a group-by control (subject, collection, or A-Z). The view state is mirrored in the query string so filtered views can be shared. Without JS the page renders grouped by subject. Catalog: add a required `subject` to every simulation (schema 1.4.0), enforced by check-repos-catalog.sh; create-sim.sh gains --subject (default physics). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 69f68cd commit be76d91

11 files changed

Lines changed: 1383 additions & 324 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Pages simulation landing page.
3333
| [`screenshots/`](screenshots/) | Full-size sim screenshots the landing-page thumbnails are made from |
3434
| [`config/`](config/) | Canonical Dependabot, Claude-settings, and GitHub-repo-settings baselines |
3535
| [`structure/repos.json`](structure/repos.json) | Machine-readable catalog of org repositories |
36-
| [`structure/repos.schema.json`](structure/repos.schema.json) | JSON Schema for the catalog (`schemaVersion` 1.3.0) |
36+
| [`structure/repos.schema.json`](structure/repos.schema.json) | JSON Schema for the catalog (`schemaVersion` 1.4.0) |
3737
| [`CONVENTIONS.md`](CONVENTIONS.md) | Shared codebase structure every SceneryStack sim must follow |
3838
| [`ACCESSIBILITY.md`](ACCESSIBILITY.md) | Shared accessibility pattern for SceneryStack sims |
3939
| [`skills/`](skills/) | SceneryStack development reference docs for AI assistants |

‎doc/add-simulation.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Edit [`structure/repos.json`](../structure/repos.json). Insert a new object in `
7070
"type": "simulation",
7171
"isSimulation": true,
7272
"lineage": "original",
73+
"subject": "physics",
7374
"upstream": null,
7475
"language": ["TypeScript"],
7576
"framework": "SceneryStack",
@@ -90,6 +91,7 @@ Edit [`structure/repos.json`](../structure/repos.json). Insert a new object in `
9091
| `name` | Must match the GitHub repo name (and the sibling folder name in the workspace). |
9192
| `displayName` | Human title on the landing-page card (and for docs). |
9293
| `lineage` | Landing-page bucket: `"original"`, `"phet"`, or `"naap"`. Non-simulations use `null`. |
94+
| `subject` | Required for simulations: `"physics"`, `"chemistry"`, `"astronomy"`, or `"earth-science"`. Drives the landing page's subject filter and default grouping. `create-sim.sh --subject` sets it (default `physics`). |
9395
| `upstream` | For `phet` / `naap` ports: `{ "org", "name", "url" }` pointing at the source lab. Otherwise `null`. |
9496
| `description` | Full blurb on the Pages card. |
9597
| `shortDescription` | Optional. GitHub About text (≤350 chars). When omitted, metadata sync uses `description` (truncated if needed). |

‎docs/index.html‎

Lines changed: 527 additions & 199 deletions
Large diffs are not rendered by default.

‎scripts/check-repos-catalog.sh‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ assert_jq "simulations have lineage + non-empty screens" '
7878
)
7979
'
8080

81+
assert_jq "simulations have a known subject" '
82+
all(.repos[] | select(.isSimulation);
83+
(.subject == "physics" or .subject == "chemistry" or .subject == "astronomy"
84+
or .subject == "earth-science")
85+
)
86+
'
87+
8188
assert_jq "simulations have non-empty physicsTopics" '
8289
all(.repos[] | select(.isSimulation);
8390
(.physicsTopics | type == "array" and length > 0)

‎scripts/create-sim.sh‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ SIM_ID=""
2929
SIM_NAME=""
3030
SCREENS=""
3131
TOPICS=""
32+
SUBJECT="physics"
3233
GITHUB_TOPICS=""
3334
TARGET_PATH=""
3435
LOCAL_ONLY=0
@@ -57,6 +58,8 @@ Options:
5758
Default: one screen named after --name.
5859
Catalog stores {id, title} (id from kebab: or slug of title).
5960
--topics LIST Comma-separated physicsTopics (required with --catalog/--onboard)
61+
--subject SUBJECT Landing-page discipline: physics (default), chemistry,
62+
astronomy, or earth-science
6063
--github-topics LIST Optional extra GitHub topics (kebab-case), e.g. game,pwa
6164
--shared-model Scaffold src/common/model/SharedModel.ts; each screen composes it
6265
--path DIR Checkout path (default: $FLEET_WORKSPACE/<repo>)
@@ -329,6 +332,10 @@ while [[ $# -gt 0 ]]; do
329332
TOPICS="${2:?Missing value for --topics}"
330333
shift 2
331334
;;
335+
--subject)
336+
SUBJECT="${2:?Missing value for --subject}"
337+
shift 2
338+
;;
332339
--github-topics)
333340
GITHUB_TOPICS="${2:?Missing value for --github-topics}"
334341
shift 2
@@ -525,6 +532,14 @@ if [[ "$CATALOG" -eq 1 || "$ONBOARD" -eq 1 ]]; then
525532
fi
526533
fi
527534

535+
case "$SUBJECT" in
536+
physics | chemistry | astronomy | earth-science) ;;
537+
*)
538+
echo "error: --subject must be physics, chemistry, astronomy, or earth-science (got '$SUBJECT')" >&2
539+
exit 1
540+
;;
541+
esac
542+
528543
if [[ -n "$SHORT_DESCRIPTION" && ${#SHORT_DESCRIPTION} -gt 350 ]]; then
529544
echo "error: --short-description must be ≤350 characters (got ${#SHORT_DESCRIPTION})" >&2
530545
exit 1
@@ -536,6 +551,7 @@ echo " name: $SIM_NAME"
536551
echo " path: $TARGET_PATH"
537552
echo " screens: ${SCREENS:-"(default: $SIM_NAME)"}"
538553
echo " topics: ${TOPICS:-"(none)"}"
554+
echo " subject: $SUBJECT"
539555
echo " shared: $([[ "$SHARED_MODEL" -eq 1 ]] && echo yes || echo no)"
540556
echo " onboard: $([[ "$ONBOARD" -eq 1 ]] && echo yes || echo no)"
541557
echo " existing: $([[ "$EXISTING" -eq 1 ]] && echo "yes (adopt already-on-GitHub repo)" || echo "no (create from template)")"
@@ -646,6 +662,7 @@ entry="$(jq -n \
646662
--arg desc "$DESCRIPTION" \
647663
--arg short "$SHORT_DESCRIPTION" \
648664
--arg url "${PAGES_BASE}/${REPO}" \
665+
--arg subject "$SUBJECT" \
649666
--argjson screens "$catalog_screens_json" \
650667
--argjson topics "$catalog_topics_json" \
651668
--argjson githubTopics "$catalog_github_topics_json" \
@@ -656,6 +673,7 @@ entry="$(jq -n \
656673
type: "simulation",
657674
isSimulation: true,
658675
lineage: "original",
676+
subject: $subject,
659677
upstream: null,
660678
language: ["TypeScript"],
661679
framework: "SceneryStack",

0 commit comments

Comments
 (0)