diff --git a/app/actions/generate-key.js b/app/actions/generate-key.js index b17c8af..b9d871b 100644 --- a/app/actions/generate-key.js +++ b/app/actions/generate-key.js @@ -76,8 +76,10 @@ export async function generateKey() { * Resolve a reserve() conflict: existing active key, reclaimable stale pending, * or an in-progress request. * + * Returns either a fresh reservation id to mint against, or a terminal result. + * * @param {{ githubUserId: string, githubUsername: string }} identity - * @returns {Promise<{ reclaimedId?: string, result: GenerateKeyResult }>} + * @returns {Promise<{ reclaimedId?: string, result?: GenerateKeyResult }>} */ async function resolveConflict(identity) { const row = await repo.findByGithubUserId(identity.githubUserId); @@ -88,7 +90,7 @@ async function resolveConflict(identity) { if (row && isStale(row.created_at, STALE_PENDING_MS)) { await repo.deletePending(row.id); const retryId = await repo.reserve(identity.githubUserId, identity.githubUsername); - if (retryId) return { reclaimedId: retryId, result: { status: "error" } }; + if (retryId) return { reclaimedId: retryId }; } return { result: { status: "error", message: "A key request is already in progress. Try again shortly." }, diff --git a/app/globals.css b/app/globals.css index 5003ea3..d1c898b 100644 --- a/app/globals.css +++ b/app/globals.css @@ -52,6 +52,12 @@ header.site-header { color: var(--text); } +.site-nav { + display: flex; + align-items: center; + gap: 1rem; +} + .panel { background: var(--panel); border: 1px solid var(--border); diff --git a/app/layout.js b/app/layout.js index b030363..5263ffa 100644 --- a/app/layout.js +++ b/app/layout.js @@ -9,7 +9,7 @@ export const metadata = { }; /** - * Root layout. The session-aware header is added in Phase 3. + * Root layout wrapping every page with the session-aware site header. * * @param {{ children: React.ReactNode }} props */ diff --git a/components/site-header.js b/components/site-header.js index 4d8783a..3f5d023 100644 --- a/components/site-header.js +++ b/components/site-header.js @@ -23,7 +23,7 @@ export async function SiteHeader() { llmapikey -