home.php 3.9 KB

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