switched to svelte 5

front gets a bit to complex to do in vanilla
This commit is contained in:
2025-05-16 18:59:19 +02:00
parent bccf019c11
commit d764e9699b
14 changed files with 994 additions and 419 deletions

View File

@@ -1,26 +1,9 @@
import './style.css'
import { IDMap, Name, requestMappings } from './idMapping'
import { mount } from "svelte"
import "./app.css"
import App from "./App.svelte"
function createTableRow(a: string, b: string, c: string): HTMLTableRowElement {
const tr = document.createElement('tr');
[a, b, c].forEach(value => {
const td = document.createElement('td');
td.textContent = value;
tr.appendChild(td);
});
return tr;
}
function orderByFirstName(obj: IDMap): { id: string, name: Name }[] {
return Object.entries(obj)
.sort(([, a], [, b]) => a.first.localeCompare(b.first))
.map(([id, { first, last }]) => ({ id, name: { first, last } }));
}
requestMappings().then(r => {
orderByFirstName(r.id_map).forEach(e => {
let row = createTableRow(e.id, e.name.last, e.name.first);
document.querySelector("#mappingTable")?.appendChild(row);
})
const app = mount(App, {
target: document.getElementById('app')!,
})
export default app