feat: ATM10-Statistikportal

Statistikportal für den All-the-Mods-10-Server (Minecraft 1.21.1, NeoForge 21.1):

- mod/: serverseitige NeoForge-Mod atmstats – Ereignisse, Live-Zähler, Servergesundheit,
  FTB-Dateien; Outbox auf der Festplatte, signierter gzip-Versand per HTTPS mit Backoff
- backend/: Fastify + PostgreSQL – idempotenter Ingest, Projektionen, Parser für SNBT,
  FTB Quests/Teams, world/stats, world/advancements und latest.log; Ranglisten, Snapshots,
  Retention, öffentliche API, SSE-Live-Updates, Admin mit argon2/CSRF, SFTP-Worker
- web/: Next.js-Dashboard – Übersicht, Ranglisten, Spielerprofile, ATM10, Server,
  Datenquellen, Verwaltung
- shared/: Protokoll v1 und API-Typen; tools/: Simulator, Log-Anonymisierer, RCON-Client
- deploy/: Docker Compose hinter Traefik, Backup; docs/: Architektur, Datenquellen, Betrieb

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lucashahmannandClaude Opus 5.5 committed 2026-10-13 09:33:25 +02:00
1 parent 56d2078e6a
commit e66f89f49e
214 files changed
+27077

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { ActivityHeatmap } from '@/components/ActivityHeatmap';
describe('ActivityHeatmap', () => {
it('renders 168 cells with aria labels', () => {
const grid = Array.from({ length: 7 }, () => Array.from({ length: 24 }, () => 0));
grid[0]![20] = 45;
grid[6]![9] = 5;
render(<ActivityHeatmap grid={grid} />);
const cells = screen.getAllByRole('img');
expect(cells).toHaveLength(168);
expect(screen.getByRole('img', { name: 'Montag, 20 Uhr: 45 Minuten' })).toBeInTheDocument();
expect(screen.getByRole('img', { name: 'Sonntag, 9 Uhr: 5 Minuten' })).toBeInTheDocument();
});
it('shows an empty note when there is no activity', () => {
const grid = Array.from({ length: 7 }, () => Array.from({ length: 24 }, () => 0));
render(<ActivityHeatmap grid={grid} />);
expect(screen.getByText('In den letzten 90 Tagen keine Sitzungen erfasst.')).toBeInTheDocument();
});
});
+29
View File
@@ -0,0 +1,29 @@
import { render, screen, within } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { LeaderboardCard } from '@/components/LeaderboardCard';
const board = { id: 'deaths', title: 'Friedhof', description: 'Häufigste Tode', unit: 'count' as const };
const entries = Array.from({ length: 10 }, (_, i) => ({
rank: i + 1,
uuid: `00000000-0000-4000-8000-00000000000${i}`,
name: `Spieler${i}`,
value: 100 - i,
}));
describe('LeaderboardCard', () => {
it('renders 10 rows with names, values and a link to the full board', () => {
render(<LeaderboardCard board={board} entries={entries} />);
const rows = screen.getAllByRole('listitem');
expect(rows).toHaveLength(10);
expect(within(rows[0]!).getByText('Spieler0')).toBeInTheDocument();
expect(within(rows[0]!).getByText('100')).toBeInTheDocument();
expect(screen.getByRole('link', { name: /Friedhof/ })).toHaveAttribute('href', '/leaderboards/deaths');
expect(rows[0]!.querySelector('a')).toHaveAttribute('href', '/players/Spieler0');
});
it('renders an empty state', () => {
render(<LeaderboardCard board={board} entries={[]} />);
expect(screen.queryAllByRole('listitem')).toHaveLength(0);
expect(screen.getByText('Noch keine Daten')).toBeInTheDocument();
});
});
+47
View File
@@ -0,0 +1,47 @@
import { describe, expect, it } from 'vitest';
import { formatCount, formatDuration, formatHours, formatKm, formatRelative, formatUnit, prettyId } from '@/lib/format';
describe('format', () => {
it('formats counts with German grouping', () => {
expect(formatCount(1234)).toBe('1.234');
expect(formatCount(1234567)).toBe('1.234.567');
expect(formatCount(0)).toBe('0');
});
it('formats hours with one decimal and unit', () => {
expect(formatHours(1175736 / 72000)).toBe('16,3 h');
expect(formatHours(1234.5)).toBe('1.234,5 h');
});
it('formats kilometres', () => {
expect(formatKm(2)).toBe('2,0 km');
expect(formatKm(32.337)).toBe('32,3 km');
});
it('formats by board unit', () => {
expect(formatUnit(16.33, 'hours')).toBe('16,3 h');
expect(formatUnit(5, 'count')).toBe('5');
expect(formatUnit(1200, 'blocks')).toBe('1.200');
expect(formatUnit(2, 'km')).toBe('2,0 km');
});
it('formats relative times', () => {
const now = Date.UTC(2026, 9, 13, 12, 0, 0);
expect(formatRelative(now - 20_000, now)).toBe('gerade eben');
expect(formatRelative(now - 5 * 60_000, now)).toBe('vor 5 Min.');
expect(formatRelative(now - 3 * 3600_000, now)).toBe('vor 3 Std.');
expect(formatRelative(now - 2 * 86_400_000, now)).toBe('vor 2 Tagen');
expect(formatRelative(null, now)).toBe('nie');
});
it('formats durations', () => {
expect(formatDuration(45 * 60_000)).toBe('45 Min.');
expect(formatDuration(125 * 60_000)).toBe('2 Std. 5 Min.');
});
it('turns resource ids into readable names', () => {
expect(prettyId('minecraft:wither_skeleton')).toBe('Wither Skeleton');
expect(prettyId('minecraft:play_time')).toBe('Play Time');
expect(prettyId('allthemodium:the_other')).toBe('The Other');
});
});
+5
View File
@@ -0,0 +1,5 @@
import '@testing-library/jest-dom/vitest';
import { cleanup } from '@testing-library/react';
import { afterEach } from 'vitest';
afterEach(cleanup);