home.php 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /** @var int $schemaVersion */
  3. /** @var string $dbPath */
  4. /** @var string $appEnv */
  5. /** @var \App\Domain\User|null $currentUser */
  6. /** @var bool $oidcConfigured */
  7. /** @var bool $authError */
  8. use function App\Http\e;
  9. ?>
  10. <section class="space-y-6">
  11. <?php if ($authError ?? false): ?>
  12. <div class="rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800">
  13. Sign-in failed. Check the server logs or the audit log for details.
  14. </div>
  15. <?php endif; ?>
  16. <?php if ($currentUser === null): ?>
  17. <div class="rounded-lg border bg-white p-6">
  18. <h1 class="text-2xl font-semibold tracking-tight">Sprint Planner</h1>
  19. <p class="text-slate-600 mt-2 max-w-prose">
  20. Sign in with your Microsoft account to get started. The first person
  21. to sign in becomes the admin automatically.
  22. </p>
  23. <div class="mt-4">
  24. <?php if ($oidcConfigured): ?>
  25. <a href="/auth/login"
  26. class="inline-flex items-center gap-2 rounded-md bg-slate-900 text-white px-4 py-2 text-sm font-medium hover:bg-slate-800">
  27. Sign in with Microsoft
  28. </a>
  29. <?php else: ?>
  30. <span class="inline-block rounded-md bg-slate-100 text-slate-600 px-3 py-2 text-sm">
  31. OIDC not configured — set <code>ENTRA_*</code> in <code>.env</code>.
  32. </span>
  33. <?php endif; ?>
  34. </div>
  35. </div>
  36. <?php else: ?>
  37. <div>
  38. <h1 class="text-2xl font-semibold tracking-tight">
  39. Welcome, <?= e($currentUser->displayName) ?>.
  40. </h1>
  41. <p class="text-slate-600 mt-1">
  42. <?= $currentUser->isAdmin
  43. ? 'You have admin rights.'
  44. : 'You are signed in.' ?>
  45. Sprints and tasks land in the next phases.
  46. </p>
  47. </div>
  48. <?php endif; ?>
  49. <div class="rounded-lg border bg-white p-4">
  50. <h2 class="text-sm font-semibold text-slate-700 uppercase tracking-wider">Runtime</h2>
  51. <dl class="mt-3 grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1 text-sm">
  52. <dt class="text-slate-500">PHP</dt>
  53. <dd class="font-mono"><?= e(PHP_VERSION) ?></dd>
  54. <dt class="text-slate-500">APP_ENV</dt>
  55. <dd class="font-mono"><?= e($appEnv) ?></dd>
  56. <dt class="text-slate-500">SQLite file</dt>
  57. <dd class="font-mono break-all"><?= e($dbPath) ?></dd>
  58. <dt class="text-slate-500">Schema version</dt>
  59. <dd class="font-mono"><?= e($schemaVersion) ?></dd>
  60. <dt class="text-slate-500">OIDC</dt>
  61. <dd class="font-mono"><?= $oidcConfigured ? 'configured' : 'not configured' ?></dd>
  62. </dl>
  63. </div>
  64. <div class="rounded-lg border bg-white p-4">
  65. <h2 class="text-sm font-semibold text-slate-700 uppercase tracking-wider">Health checks</h2>
  66. <ul class="mt-3 text-sm space-y-1">
  67. <li><a class="text-blue-700 hover:underline" href="/healthz"><code>/healthz</code></a> — liveness probe</li>
  68. </ul>
  69. </div>
  70. </section>