refactor: rename Account to Admin across filenames, routes, and docs

- Rename account.{rs,html} → admin.{rs,html} in app, api, and templates
- Update route /account → /admin
- Rename AccountTemplate → AdminTemplate, account_page → admin_page
- Update nav link, test function names, and CLAUDE.md references
This commit is contained in:
Jon Seager 2026-02-08 09:39:37 +00:00
parent de3ee1b4b7
commit 35e1812879
No known key found for this signature in database
8 changed files with 23 additions and 23 deletions

View file

@ -429,7 +429,7 @@ Main container from `base.html`: `mx-auto flex w-full max-w-5xl flex-col gap-8 p
Cards use `rounded-lg border bg-surface` — no shadows. Padding varies by context:
- `p-4` — compact cards (brew cards, bag cards, stat cards)
- `p-5` — form sections, account sections, timeline cards
- `p-5` — form sections, admin sections, timeline cards
- `p-6` — auth pages (login, register)
#### Typography
@ -474,7 +474,7 @@ Entity-type icon mapping (consistent across all pages):
| Size | Context |
|------|---------|
| `h-3 w-3` | Timeline card category labels (inline with `text-xs`) |
| `h-4 w-4` | Buttons with text, tab buttons, account page actions, list action links, form indicator icons |
| `h-4 w-4` | Buttons with text, tab buttons, admin page actions, list action links, form indicator icons |
| `h-5 w-5` | Nav icons, quick action buttons, loading spinners, homepage activity rows, timeline expand/collapse chevrons |
| `h-6 w-6` | Stat cards on homepage |

View file

@ -1,4 +1,4 @@
pub(crate) mod account;
pub(crate) mod admin;
pub(crate) mod backup;
pub(crate) mod bags;
pub(crate) mod brews;
@ -80,10 +80,10 @@ pub(super) fn router() -> axum::Router<AppState> {
post(tokens::create_token).get(tokens::list_tokens),
)
.route("/tokens/{id}/revoke", post(tokens::revoke_token))
.route("/passkeys", get(account::list_passkeys))
.route("/passkeys", get(admin::list_passkeys))
.route(
"/passkeys/{id}",
axum::routing::delete(account::delete_passkey),
axum::routing::delete(admin::delete_passkey),
)
.route("/backup", get(backup::export_backup))
.route(

View file

@ -65,8 +65,8 @@ fn format_date(dt: DateTime<Utc>) -> String {
// --- Templates ---
#[derive(Template)]
#[template(path = "pages/account.html")]
struct AccountTemplate {
#[template(path = "pages/admin.html")]
struct AdminTemplate {
nav_active: &'static str,
is_authenticated: bool,
version_info: &'static crate::VersionInfo,
@ -77,7 +77,7 @@ struct AccountTemplate {
// --- Page handler ---
pub(crate) async fn account_page(
pub(crate) async fn admin_page(
State(state): State<AppState>,
cookies: Cookies,
) -> Result<Response, StatusCode> {
@ -95,7 +95,7 @@ pub(crate) async fn account_page(
.list_by_user(auth_user.id)
.await
.map_err(|err| {
error!(error = %err, "failed to list passkeys for account page");
error!(error = %err, "failed to list passkeys for admin page");
StatusCode::INTERNAL_SERVER_ERROR
})?
.into_iter()
@ -112,7 +112,7 @@ pub(crate) async fn account_page(
.list_by_user(auth_user.id)
.await
.map_err(|err| {
error!(error = %err, "failed to list tokens for account page");
error!(error = %err, "failed to list tokens for admin page");
StatusCode::INTERNAL_SERVER_ERROR
})?
.into_iter()
@ -138,8 +138,8 @@ pub(crate) async fn account_page(
cost: format_cost(s.total_cost),
});
let template = AccountTemplate {
nav_active: "account",
let template = AdminTemplate {
nav_active: "admin",
is_authenticated: true,
version_info: &crate::VERSION_INFO,
ai_usage,
@ -167,7 +167,7 @@ async fn extract_user_from_session(
{
Ok(s) => s,
Err(err) => {
warn!(error = %err, "session lookup failed on account page");
warn!(error = %err, "session lookup failed on admin page");
return None;
}
};

View file

@ -1,5 +1,5 @@
mod account;
mod add;
mod admin;
pub(super) mod auth;
mod checkin;
mod data;
@ -17,7 +17,7 @@ pub(super) fn router() -> axum::Router<AppState> {
.route("/", get(home::home_page))
.route("/login", get(auth::login_page))
.route("/logout", post(auth::logout))
.route("/account", get(account::account_page))
.route("/admin", get(admin::admin_page))
.route("/register/{token}", get(webauthn::register_page))
.route("/auth/cli-callback", get(webauthn::cli_callback_page))
.route("/data", get(data::data_page))

View file

@ -1,11 +1,11 @@
{% extends "base.html" %} {% import "partials/icons.html" as icons %}
{% block title %}Brewlog · Account{% endblock %}
{% block title %}Brewlog · Admin{% endblock %}
{% block head %}
<script src="/webauthn.js"></script>
{% endblock %}
{% block content %}
<header class="flex flex-col gap-2">
<h1 class="text-3xl font-semibold">Account</h1>
<h1 class="text-3xl font-semibold">Admin</h1>
<p class="max-w-2xl text-sm text-text-secondary">Manage your passkeys, API tokens, and data.</p>
</header>
@ -295,7 +295,7 @@
<div class="flex flex-col gap-4">
<div>
<h2 class="text-lg font-semibold text-text">Sign Out</h2>
<p class="mt-1 text-sm text-text-secondary">Sign out of your account on this device.</p>
<p class="mt-1 text-sm text-text-secondary">Sign out on this device.</p>
</div>
<div>
<form method="post" action="/logout">

View file

@ -13,7 +13,7 @@
<span class="theme-icon-dark hidden">{{ icons::sun("h-5 w-5") }}</span>
</button>
{% if is_authenticated %}
<a class="rounded-md p-1.5 transition {% if nav_active == "account" %}text-accent{% else %}text-text-muted hover:text-text-secondary{% endif %}" href="/account" title="Account" aria-label="Account">
<a class="rounded-md p-1.5 transition {% if nav_active == "admin" %}text-accent{% else %}text-text-muted hover:text-text-secondary{% endif %}" href="/admin" title="Admin" aria-label="Admin">
{{ icons::user("h-5 w-5") }}
</a>
{% else %}

View file

@ -186,7 +186,7 @@ async fn add_page_returns_200_when_authenticated() {
}
#[tokio::test]
async fn account_page_redirects_unauthenticated_to_login() {
async fn admin_page_redirects_unauthenticated_to_login() {
let app = spawn_app().await;
let client = reqwest::Client::builder()
.redirect(Policy::none())
@ -194,7 +194,7 @@ async fn account_page_redirects_unauthenticated_to_login() {
.expect("Failed to build client");
let response = client
.get(app.page_url("/account"))
.get(app.page_url("/admin"))
.send()
.await
.expect("Failed to execute request");
@ -212,7 +212,7 @@ async fn account_page_redirects_unauthenticated_to_login() {
}
#[tokio::test]
async fn account_page_returns_200_when_authenticated() {
async fn admin_page_returns_200_when_authenticated() {
let app = spawn_app_with_auth().await;
let session_token = create_session(&app).await;
@ -222,7 +222,7 @@ async fn account_page_returns_200_when_authenticated() {
.expect("Failed to build client");
let response = client
.get(app.page_url("/account"))
.get(app.page_url("/admin"))
.header("Cookie", format!("brewlog_session={session_token}"))
.send()
.await