Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ window.clearTeams = clearSelections;

window.filterPlayers = filterPlayerList;

window.recordMatch = recordMatch;
window.recordDoublesMatch = recordDoublesMatch;
window.addPlayer = addPlayer;
window.recordMatch = () => recordMatch().catch(err => showError(err.message));
window.recordDoublesMatch = () => recordDoublesMatch().catch(err => showError(err.message));
window.addPlayer = () => addPlayer().catch(err => showError(err.message));

// ================= INITIALISIERUNG =================

Expand All @@ -81,6 +81,7 @@ window.onload = async function() {

if (!_cfg.SUPABASE_URL || !_cfg.SUPABASE_ANON_KEY) {
showError('Supabase nicht konfiguriert. Bitte config.js anlegen (siehe config.example.js).');
return;
}

await loadPlayers();
Expand Down Expand Up @@ -325,6 +326,7 @@ async function saveMatch(match, playerEntries) {
await Promise.all(playerEntries.map(({ id }) => updatePlayer(id, state.players[id])));
} catch (revertErr) {
console.error('ELO-Revert fehlgeschlagen:', revertErr);
showError('ELO-Synchronisation fehlgeschlagen. Bitte Seite neu laden.');
}
showError('Fehler beim Speichern. Match wurde nicht übertragen.');
} finally {
Expand Down
2 changes: 2 additions & 0 deletions src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ export function getAvatarEmoji(playerId) {

export function showError(message) {
const el = document.getElementById('errorMessage');
if (!el) { console.error(message); return; }
el.textContent = message;
el.style.display = 'block';
setTimeout(() => { el.style.display = 'none'; }, 5000);
}

export function showSuccess(message) {
const el = document.getElementById('successMessage');
if (!el) { console.log(message); return; }
el.textContent = message;
el.style.display = 'block';
setTimeout(() => { el.style.display = 'none'; }, 5000);
Expand Down
Loading