Skip to content

enhancement: competitions dataset isn't wired through studymap.config.ts like places is #253

Description

@yakew7

Problem

studymap.config.ts exists specifically so a self-hoster can point StudyMap at their own dataset without touching any other file — that's the whole point of #30 ("data-source abstraction") and #29 ("config-driven region"), and SELF-HOSTING.md step 3 says exactly that: "places: swap the sample imports for your own data/places/*.json files".

That abstraction was never extended to competitions. src/lib/competitions.ts imports every category file directly and hardcodes it:

import artsDesign from "../../data/competitions/arts_design.json";
import business from "../../data/competitions/business.json";
import coding from "../../data/competitions/coding.json";
// ...12 more direct imports, one per category file

There is no competitions field in StudyMapConfig (studymap.config.ts) the way there is a places field. A self-hoster following SELF-HOSTING.md's pattern for places has no equivalent lever for competitions — forking the repo for a different competitions catalog means editing src/lib/competitions.ts directly, not the one config file the rest of the self-host story is built around.

Fix

Mirror the places pattern: add a competitions: Competition[] field to StudyMapConfig in studymap.config.ts, move the 15 category imports there, and have src/lib/competitions.ts read from the config the way src/lib/places.ts reads places from it.

Acceptance criteria

  • studymap.config.ts has a competitions field, populated the same way places is
  • src/lib/competitions.ts no longer imports data/competitions/*.json directly
  • SELF-HOSTING.md updated to mention swapping competitions the same way it already covers places
  • Existing competitions tests still pass

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestself-hostSelf-host / bring-your-own-data

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions