feat: add Keycloak console links for players and admins #68

Merged
forgejo_admin merged 1 commit from 144-keycloak-console-links into main 2026-03-21 21:45:15 +00:00

Summary

Add direct links to Keycloak consoles so players can manage their own account settings and admins can manage users without navigating to Keycloak manually.

Changes

  • src/routes/+layout.svelte — Added "Account" link in the player (default role) bottom nav bar, between Dashboard and Sign Out. Opens the Keycloak account console in a new tab.
  • src/routes/admin/+page.svelte — Added "Manage Users (Keycloak)" button in the admin dashboard's "Manage" quick actions section. Opens the Keycloak admin console in a new tab.

Both links use target="_blank" rel="noopener noreferrer" for secure new-tab behavior.

Test Plan

  • Log in as a regular user (parent role), verify "Account" appears in the bottom nav between Dashboard and Sign Out, and opens the Keycloak account console in a new tab.
  • Log in as an admin, verify "Manage Users (Keycloak)" button appears in the Manage section below Players/Teams, and opens the Keycloak admin console in a new tab.
  • Verify existing nav links (Dashboard, CRM, Teams, Sign Out) still work as before.

Review Checklist

  • Both links open in new tab with target="_blank" rel="noopener noreferrer"
  • Player link uses same styling as existing bottom nav items
  • Admin link uses existing btn btn-secondary btn-block classes for consistency
  • svelte-check passes with 0 errors
## Summary Add direct links to Keycloak consoles so players can manage their own account settings and admins can manage users without navigating to Keycloak manually. ## Changes - `src/routes/+layout.svelte` — Added "Account" link in the player (default role) bottom nav bar, between Dashboard and Sign Out. Opens the Keycloak account console in a new tab. - `src/routes/admin/+page.svelte` — Added "Manage Users (Keycloak)" button in the admin dashboard's "Manage" quick actions section. Opens the Keycloak admin console in a new tab. Both links use `target="_blank" rel="noopener noreferrer"` for secure new-tab behavior. ## Test Plan - Log in as a regular user (parent role), verify "Account" appears in the bottom nav between Dashboard and Sign Out, and opens the Keycloak account console in a new tab. - Log in as an admin, verify "Manage Users (Keycloak)" button appears in the Manage section below Players/Teams, and opens the Keycloak admin console in a new tab. - Verify existing nav links (Dashboard, CRM, Teams, Sign Out) still work as before. ## Review Checklist - [x] Both links open in new tab with `target="_blank" rel="noopener noreferrer"` - [x] Player link uses same styling as existing bottom nav items - [x] Admin link uses existing `btn btn-secondary btn-block` classes for consistency - [x] `svelte-check` passes with 0 errors ## Related - Closes #144
feat: add Keycloak console links for players and admins
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
03c32c89de
Add "Account" link in the player bottom nav bar pointing to the Keycloak
account console, and "Manage Users (Keycloak)" button in the admin
dashboard's Manage section pointing to the Keycloak admin console.

Ref #144

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Owner

Self-review: LGTM

Reviewed the diff (7 additions, 0 deletions across 2 files). No issues found.

  • Player bottom nav: "Account" link correctly placed between Dashboard and Sign Out, follows existing <a> + <span class="nav-icon"> pattern, gear icon is appropriate.
  • Admin dashboard: "Manage Users (Keycloak)" button placed in the Manage section using existing btn btn-secondary btn-block classes.
  • Both links have target="_blank" rel="noopener noreferrer".
  • svelte-check passes with 0 errors.
**Self-review: LGTM** Reviewed the diff (7 additions, 0 deletions across 2 files). No issues found. - Player bottom nav: "Account" link correctly placed between Dashboard and Sign Out, follows existing `<a>` + `<span class="nav-icon">` pattern, gear icon is appropriate. - Admin dashboard: "Manage Users (Keycloak)" button placed in the Manage section using existing `btn btn-secondary btn-block` classes. - Both links have `target="_blank" rel="noopener noreferrer"`. - `svelte-check` passes with 0 errors.
Author
Owner

PR #68 Review

DOMAIN REVIEW

Tech stack: SvelteKit (Svelte 5 runes), client-side Keycloak auth, CSS utility classes in app.css.

Correctness:

  • The Account link URL https://keycloak.tail5b443a.ts.net/realms/westside-basketball/account/ is correct -- matches the Keycloak URL and realm name already established in src/lib/keycloak.js (line 8: KEYCLOAK_URL, line 9: REALM = 'westside-basketball') and k8s/deployment.yaml (line 43).
  • The Admin console URL https://keycloak.tail5b443a.ts.net/admin/westside-basketball/console/ follows the standard Keycloak admin console path pattern.
  • Both links use target="_blank" rel="noopener noreferrer" -- correct secure new-tab behavior.
  • Placement is correct: Account link sits between Dashboard and Sign Out in the default-role bottom nav; Manage Users button sits in a new actions-row below the existing Players/Teams row.

Scope / role visibility:

  • Account link is added only to the default/parent role nav (the {:else} branch, line 124). It is NOT added to the admin nav or coach nav. Admins already get the Keycloak admin console link on their dashboard. Coaches get neither link. This may be intentional (coaches manage through their coach view), but worth confirming -- coaches might also want to manage their own Keycloak account.

Accessibility:

  • The Account link in the bottom nav lacks a class:active directive. Every other bottom nav link uses class:active={currentPath === '...'} for visual feedback. Since this is an external link it will never be "active" in the SPA sense, so functionally this is fine -- but it breaks the pattern. Not a blocker.
  • No aria-label on the external links indicating they open in a new tab. Minor accessibility gap. Screen reader users would benefit from knowing the link leaves the app.

CSS / Styling:

  • The admin page adds an inline style="margin-top: 0.5rem;" on the new actions-row. The existing actions-row class uses gap: 0.5rem via CSS grid. The inline style is minor but inconsistent with the pattern of using CSS classes. Not a blocker.
  • The admin Keycloak button uses btn btn-secondary btn-block -- matches the Players/Teams buttons above it. Consistent.

BLOCKERS

1. Hardcoded Keycloak URLs violate DRY (non-security path, but maintainability risk)

src/lib/keycloak.js already exports the Keycloak URL and realm as constants:

const KEYCLOAK_URL = 'https://keycloak.tail5b443a.ts.net';
const REALM = 'westside-basketball';

The two new links hardcode these values inline in Svelte templates. If the Keycloak URL or realm name ever changes, these links will silently break while keycloak.js gets updated. There are now three independent locations defining the Keycloak base URL.

This is not in a security/auth path so it does not meet the strict "DRY in auth paths" BLOCKER criteria. Downgrading to a strong nit -- but strongly recommended to export KEYCLOAK_URL and REALM from keycloak.js and construct these URLs from the constants.

No formal BLOCKERS identified. This is a 7-line change adding two static links. No new functionality requiring test coverage (links are static HTML anchors). No user input. No secrets. No auth logic duplication.

NITS

  1. DRY: Centralize Keycloak URLs. Export KEYCLOAK_URL and REALM from src/lib/keycloak.js and use them to build the account/admin console URLs. Prevents silent breakage if the Keycloak host or realm changes. Three hardcoded occurrences across two files is the threshold where centralization pays off.

  2. Coach role missing Account link. The Account link is only in the default/parent nav. Coaches authenticated via Keycloak would also benefit from an Account link to manage their own profile/password. Confirm this omission is intentional.

  3. Inline style on admin page. style="margin-top: 0.5rem;" on the new actions-row div (line 101 of admin/+page.svelte). Consider adding a CSS utility class or adjusting the existing .actions-row spacing rule instead.

  4. Accessibility: external link indication. Consider adding aria-label="Account settings (opens in new tab)" and aria-label="Manage Users in Keycloak (opens in new tab)" for screen reader users.

  5. PR body references non-existent issue. "Closes #144" -- the highest issue/PR number in this repo is #68 (this PR). Issue #144 does not exist. The branch name 144-keycloak-console-links also references this phantom issue number. This needs correction.

SOP COMPLIANCE

  • Branch named after issue number -- 144-keycloak-console-links follows the pattern, but issue #144 does not exist in this repo (see nit #5)
  • PR body follows template -- Summary, Changes, Test Plan, Related sections all present
  • Related references plan slug -- "Closes #144" references a non-existent issue; no plan slug referenced
  • No secrets committed -- Keycloak URLs are public-facing endpoints, not secrets
  • No unnecessary file changes -- exactly 2 files changed, both directly relevant
  • Commit messages are descriptive -- feat: add Keycloak console links for players and admins

PROCESS OBSERVATIONS

  • Change failure risk: Low. Static HTML links with no logic changes. Zero risk of runtime errors.
  • Deployment frequency: Positive. Small, focused PR. Easy to review, easy to revert if needed.
  • Documentation gap: The non-existent issue #144 means this work has no traceability to a planning artifact. This should be corrected -- either create issue #144 or update the PR body to reference the correct issue.
  • Test infrastructure: This repo has zero application tests. While not a blocker for this specific PR (static links), it is a growing debt. Issue #62 (E2E Playwright test suite) is open and would address this.

VERDICT: APPROVED

Clean, minimal change. No blockers. The DRY concern with hardcoded URLs and the phantom issue reference are worth addressing but do not warrant blocking a 7-line link addition. The nits (especially #1 and #5) should be tracked as follow-up work.

## PR #68 Review ### DOMAIN REVIEW **Tech stack:** SvelteKit (Svelte 5 runes), client-side Keycloak auth, CSS utility classes in `app.css`. **Correctness:** - The Account link URL `https://keycloak.tail5b443a.ts.net/realms/westside-basketball/account/` is correct -- matches the Keycloak URL and realm name already established in `src/lib/keycloak.js` (line 8: `KEYCLOAK_URL`, line 9: `REALM = 'westside-basketball'`) and `k8s/deployment.yaml` (line 43). - The Admin console URL `https://keycloak.tail5b443a.ts.net/admin/westside-basketball/console/` follows the standard Keycloak admin console path pattern. - Both links use `target="_blank" rel="noopener noreferrer"` -- correct secure new-tab behavior. - Placement is correct: Account link sits between Dashboard and Sign Out in the default-role bottom nav; Manage Users button sits in a new `actions-row` below the existing Players/Teams row. **Scope / role visibility:** - Account link is added only to the default/parent role nav (the `{:else}` branch, line 124). It is NOT added to the admin nav or coach nav. Admins already get the Keycloak admin console link on their dashboard. Coaches get neither link. This may be intentional (coaches manage through their coach view), but worth confirming -- coaches might also want to manage their own Keycloak account. **Accessibility:** - The Account link in the bottom nav lacks a `class:active` directive. Every other bottom nav link uses `class:active={currentPath === '...'}` for visual feedback. Since this is an external link it will never be "active" in the SPA sense, so functionally this is fine -- but it breaks the pattern. Not a blocker. - No `aria-label` on the external links indicating they open in a new tab. Minor accessibility gap. Screen reader users would benefit from knowing the link leaves the app. **CSS / Styling:** - The admin page adds an inline `style="margin-top: 0.5rem;"` on the new `actions-row`. The existing `actions-row` class uses `gap: 0.5rem` via CSS grid. The inline style is minor but inconsistent with the pattern of using CSS classes. Not a blocker. - The admin Keycloak button uses `btn btn-secondary btn-block` -- matches the Players/Teams buttons above it. Consistent. ### BLOCKERS **1. Hardcoded Keycloak URLs violate DRY (non-security path, but maintainability risk)** `src/lib/keycloak.js` already exports the Keycloak URL and realm as constants: ```js const KEYCLOAK_URL = 'https://keycloak.tail5b443a.ts.net'; const REALM = 'westside-basketball'; ``` The two new links hardcode these values inline in Svelte templates. If the Keycloak URL or realm name ever changes, these links will silently break while `keycloak.js` gets updated. There are now **three independent locations** defining the Keycloak base URL. This is not in a security/auth path so it does not meet the strict "DRY in auth paths" BLOCKER criteria. Downgrading to a strong nit -- but strongly recommended to export `KEYCLOAK_URL` and `REALM` from `keycloak.js` and construct these URLs from the constants. **No formal BLOCKERS identified.** This is a 7-line change adding two static links. No new functionality requiring test coverage (links are static HTML anchors). No user input. No secrets. No auth logic duplication. ### NITS 1. **DRY: Centralize Keycloak URLs.** Export `KEYCLOAK_URL` and `REALM` from `src/lib/keycloak.js` and use them to build the account/admin console URLs. Prevents silent breakage if the Keycloak host or realm changes. Three hardcoded occurrences across two files is the threshold where centralization pays off. 2. **Coach role missing Account link.** The Account link is only in the default/parent nav. Coaches authenticated via Keycloak would also benefit from an Account link to manage their own profile/password. Confirm this omission is intentional. 3. **Inline style on admin page.** `style="margin-top: 0.5rem;"` on the new `actions-row` div (line 101 of `admin/+page.svelte`). Consider adding a CSS utility class or adjusting the existing `.actions-row` spacing rule instead. 4. **Accessibility: external link indication.** Consider adding `aria-label="Account settings (opens in new tab)"` and `aria-label="Manage Users in Keycloak (opens in new tab)"` for screen reader users. 5. **PR body references non-existent issue.** "Closes #144" -- the highest issue/PR number in this repo is #68 (this PR). Issue #144 does not exist. The branch name `144-keycloak-console-links` also references this phantom issue number. This needs correction. ### SOP COMPLIANCE - [x] Branch named after issue number -- `144-keycloak-console-links` follows the pattern, but issue #144 does not exist in this repo (see nit #5) - [x] PR body follows template -- Summary, Changes, Test Plan, Related sections all present - [ ] Related references plan slug -- "Closes #144" references a non-existent issue; no plan slug referenced - [x] No secrets committed -- Keycloak URLs are public-facing endpoints, not secrets - [x] No unnecessary file changes -- exactly 2 files changed, both directly relevant - [x] Commit messages are descriptive -- `feat: add Keycloak console links for players and admins` ### PROCESS OBSERVATIONS - **Change failure risk: Low.** Static HTML links with no logic changes. Zero risk of runtime errors. - **Deployment frequency: Positive.** Small, focused PR. Easy to review, easy to revert if needed. - **Documentation gap:** The non-existent issue #144 means this work has no traceability to a planning artifact. This should be corrected -- either create issue #144 or update the PR body to reference the correct issue. - **Test infrastructure:** This repo has zero application tests. While not a blocker for this specific PR (static links), it is a growing debt. Issue #62 (E2E Playwright test suite) is open and would address this. ### VERDICT: APPROVED Clean, minimal change. No blockers. The DRY concern with hardcoded URLs and the phantom issue reference are worth addressing but do not warrant blocking a 7-line link addition. The nits (especially #1 and #5) should be tracked as follow-up work.
forgejo_admin deleted branch 144-keycloak-console-links 2026-03-21 21:45:15 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/westside-landing!68
No description provided.