Gate pedigree behind a dog id set in settings

The pedigree view is now opt-in and tied to your own dog rather than an
always-present free-text search. Add the dog's SKK chip or registration
number in Settings (it rides the synced profile alongside name and
birthday); the 🌳 button stays hidden until one is set, then opens the
page and loads that dog's ancestry directly.

Make repeat opens cheap: memoise the id->hundid resolution server-side so
a cached tree is served without contacting SKK at all, and mirror the
finished tree in localStorage so the page paints instantly and shows the
last-known tree offline.

Adds config.pedigree_id (with an in-place migration for existing DBs).
This commit is contained in:
Alexander Heldt
2026-07-26 09:36:49 +00:00
parent 26ebe3bd86
commit c2f74e64c8
7 changed files with 147 additions and 88 deletions
+10 -9
View File
@@ -70,7 +70,7 @@
<div id="puppy-age" class="puppy-age" hidden></div>
</div>
<div class="header-actions">
<button type="button" id="pedigree-btn" class="ghost icon-btn" aria-label="Pedigree" title="Pedigree">🌳</button>
<button type="button" id="pedigree-btn" class="ghost icon-btn" aria-label="Pedigree" title="Pedigree" hidden>🌳</button>
<button type="button" id="settings-btn" class="ghost icon-btn" aria-label="Settings" title="Settings">⚙️</button>
<button type="button" id="logout-btn" class="ghost icon-btn" aria-label="Log out" title="Log out">🚪</button>
<div id="online-status" class="status-pill"></div>
@@ -282,15 +282,11 @@
<h1>🌳 Pedigree</h1>
</header>
<main class="pedigree-main">
<form id="pedigree-form" class="pedigree-form">
<input type="text" id="pedigree-q" autocomplete="off" spellcheck="false"
placeholder="Chip or registration number" aria-label="Dog chip or registration number" />
<button type="submit" id="pedigree-lookup">Look up</button>
</form>
<p class="muted-note pedigree-hint">
Looks up a dog in <strong>SKK Hunddata</strong> by ISO chip number
(e.g. 752095600044144) or registration number (e.g. SE23536/2026),
then traces its ancestry. Needs an internet connection.
Your dog's ancestry from <strong>SKK Hunddata</strong>, traced from the
ID set in Settings. The first generations show at once, then the line
fills in further back.
<button type="button" id="pedigree-refresh" class="linklike">Refresh</button>
</p>
<p id="pedigree-status" class="pedigree-status" hidden></p>
<div id="pedigree-choose" class="pedigree-choose" hidden></div>
@@ -319,6 +315,11 @@
<label>Birthday
<input type="date" id="settings-birthday" />
</label>
<label>Pedigree ID
<input type="text" id="settings-pedigree" autocomplete="off" spellcheck="false"
placeholder="SKK chip or reg. number (optional)" />
</label>
<p class="settings-hint">Set your dog's SKK chip or registration number to unlock the 🌳 pedigree page.</p>
<label class="toggle-row">
<span>Dark mode</span>
<input type="checkbox" id="settings-theme" role="switch" class="switch" />