minor tweaks and fixes (#16)

* style: revive -^> resuscitate

* build(adapter): we can just use adapter-auto

* fix(subspecies): allows for custom subspecies names

* chore(+page): file input is stateful
This commit is contained in:
lew 2026-03-24 22:20:16 +00:00 committed by GitHub
parent 4c3348db5d
commit b05094b4d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 934 deletions

936
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,7 @@
"validate": "scripts/validate-xml.sh" "validate": "scripts/validate-xml.sh"
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/adapter-vercel": "^6.3.3", "@sveltejs/adapter-auto": "^7.0.1",
"@sveltejs/kit": "^2.50.2", "@sveltejs/kit": "^2.50.2",
"@sveltejs/vite-plugin-svelte": "^6.2.4", "@sveltejs/vite-plugin-svelte": "^6.2.4",
"@tailwindcss/vite": "^4.2.2", "@tailwindcss/vite": "^4.2.2",

View file

@ -101,6 +101,11 @@ describe('formatFieldOutput', () => {
expect(formatFieldOutput(field, 'hharar', stubSpecies, 'tajara')).toBe('Ethnicity: Hharar'); expect(formatFieldOutput(field, 'hharar', stubSpecies, 'tajara')).toBe('Ethnicity: Hharar');
}); });
it('formats custom subspecies with dynamic label', () => {
const field: FieldDef = { label: 'Subspecies', type: 'subspecies' };
expect(formatFieldOutput(field, 'asdfg', stubSpecies, 'tajara')).toBe('Ethnicity: asdfg');
});
it('returns null for empty subspecies', () => { it('returns null for empty subspecies', () => {
const field: FieldDef = { label: 'Subspecies', type: 'subspecies' }; const field: FieldDef = { label: 'Subspecies', type: 'subspecies' };
expect(formatFieldOutput(field, '', stubSpecies, 'tajara')).toBeNull(); expect(formatFieldOutput(field, '', stubSpecies, 'tajara')).toBeNull();

View file

@ -48,7 +48,7 @@ export function formatFieldOutput(
const sp = speciesData.find((s) => s.id === currentSpecies); const sp = speciesData.find((s) => s.id === currentSpecies);
if (!sp) return null; if (!sp) return null;
const sub = sp.subspecies.find((s) => s.id === value); const sub = sp.subspecies.find((s) => s.id === value);
return sub ? `${sp.subspeciesLabel}: ${sub.name}` : null; return sub ? `${sp.subspeciesLabel}: ${sub.name}` : `${sp.subspeciesLabel}: ${value}`;
} }
case 'languages': { case 'languages': {

View file

@ -15,7 +15,7 @@
let importError = $state<string | null>(null); let importError = $state<string | null>(null);
let mobileView = $state<'edit' | 'preview' | 'split'>('split'); let mobileView = $state<'edit' | 'preview' | 'split'>('split');
let showPicker = $state(false); let showPicker = $state(false);
let emptyFileInput: HTMLInputElement; let emptyFileInput = $state<HTMLInputElement>();
function checkHash() { function checkHash() {
const hash = window.location.hash.slice(1); const hash = window.location.hash.slice(1);

View file

@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-vercel'; import adapter from '@sveltejs/adapter-auto';
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */
const config = { const config = {