Commit graph

2 commits

Author SHA1 Message Date
9ccd4ca772 Per-player playtime tracking + sparkline hover tooltips
- New GET /api/players/playtime (authed): reads each vanilla stats file
  under /home/minecraft/server/world/stats and maps uuid→name via
  usercache.json. Returns playtime in ticks and hours, plus file mtime
  as "last seen". Memoized 60s via lib/cache#memoAsync.
- New PlaytimeLeaderboard card in the Players tab:
    - Rank, avatar (click → PlayerDrawer), relative last-seen, hours.
    - Top 10 by default with toggle to show all; combined hours badge.
- PlayerDrawer surfaces the player's total hours + last-seen using the
  same cached playtime query, plus fills in UUID if the player is not
  in ops/whitelist/banned.
- lib/time.ts: formatHours() — minutes under 1h, "H.Hh" under a day,
  "Dd Hh" above.
- Analytics sparklines gain hover/touch tooltips:
    - Timestamps threaded through from each MetricEntry.
    - SVG overlay captures onMouseMove/onTouchMove, computes nearest
      index by x, draws a dashed guide line + focus dot.
    - Floating tooltip shows HH:MM + formatted value with unit; edge
      clamping keeps it in-frame at the extremes.
    - Per-chart formatValue so RAM shows GB, CPU 0 decimals, Players
      integer, TPS 1 decimal. Keeps the peak-player marker intact.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 06:24:13 -06:00
f9ae1afac1 UX polish pass 2: toasts, optimistic updates, mod update detection
- Install sonner; <Toaster> mounted in Providers, auto-tracks theme.
- Toasts replace inline result Alerts across ServerControls, PlayerManager,
  BackupManager, ModManager (install/remove/restore/delete/start/stop).
- PlayerManager: optimistic op/deop/whitelist/ban/pardon via onMutate +
  rollback; UI updates instantly before RCON round-trip.
- Modrinth search results now show author + "updated Xd ago" with full
  timestamp on hover; downloads on its own row.
- New /api/mods/updates endpoint: per-installed-mod Modrinth latest-version
  lookup (parallel, 30min memo). Amber "Update available" badge rendered
  next to installed mod rows when filenames differ.
- PlayerAvatar + Modrinth icons migrated to next/image (unoptimized, size
  hints) — fewer layout shifts.
- Login page surfaces ?error= + NextAuth error codes (CredentialsSignin,
  SessionRequired, etc.), preserves callbackUrl, adds autocomplete hints
  and role="alert". Wrapped in Suspense per Next 16 requirement.
- Snapshots + backups show relative "Xh ago" with exact timestamp on hover
  via new lib/time.ts helper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 05:11:17 -06:00