Files
timetracker/ts/add_game.ts
T
lukas 97aeb23d31 feat(add-game): sync original year from year released until dirty (#35) (#83)
* fix(make): run migrate before loadplatforms in init target

make init loaded platform fixtures without first creating the database
schema, failing with 'no such table: games_platform' on a clean repo.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(add-game): sync original year from year released until dirty (#35)

Mirror year_released into original_year_released live as the user types,
stopping once original is edited directly — same sync-until-dirty pattern
already used for name -> sort_name. Reorder the two year fields so
year_released renders first, otherwise the user would fill original first
and negate the sync.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 19:13:33 +02:00

21 lines
532 B
TypeScript

import { syncSelectInputUntilChanged } from "./utils.js";
const syncData = [
{
source: "#id_name",
source_value: "value",
target: "#id_sort_name",
target_value: "value",
},
{
source: "#id_year_released",
source_value: "value",
target: "#id_original_year_released",
target_value: "value",
},
];
// Scope to the add form (#add-form), not "form": the first <form> on the page
// is the navbar logout form, which never contains these fields.
syncSelectInputUntilChanged(syncData, "#add-form");