diff --git a/CLAUDE.md b/CLAUDE.md index 36dfaa6..1baa231 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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 | diff --git a/src/application/routes/api/account.rs b/src/application/routes/api/admin.rs similarity index 100% rename from src/application/routes/api/account.rs rename to src/application/routes/api/admin.rs diff --git a/src/application/routes/api/mod.rs b/src/application/routes/api/mod.rs index 8cbbdc3..59ba854 100644 --- a/src/application/routes/api/mod.rs +++ b/src/application/routes/api/mod.rs @@ -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 { 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( diff --git a/src/application/routes/app/account.rs b/src/application/routes/app/admin.rs similarity index 91% rename from src/application/routes/app/account.rs rename to src/application/routes/app/admin.rs index fa50cdc..2a0651b 100644 --- a/src/application/routes/app/account.rs +++ b/src/application/routes/app/admin.rs @@ -65,8 +65,8 @@ fn format_date(dt: DateTime) -> 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, cookies: Cookies, ) -> Result { @@ -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; } }; diff --git a/src/application/routes/app/mod.rs b/src/application/routes/app/mod.rs index b8a8de9..cacc3f7 100644 --- a/src/application/routes/app/mod.rs +++ b/src/application/routes/app/mod.rs @@ -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 { .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)) diff --git a/templates/pages/account.html b/templates/pages/admin.html similarity index 98% rename from templates/pages/account.html rename to templates/pages/admin.html index 7c12ce4..8d145f4 100644 --- a/templates/pages/account.html +++ b/templates/pages/admin.html @@ -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 %} {% endblock %} {% block content %}
-

Account

+

Admin

Manage your passkeys, API tokens, and data.

@@ -295,7 +295,7 @@

Sign Out

-

Sign out of your account on this device.

+

Sign out on this device.

diff --git a/templates/partials/nav.html b/templates/partials/nav.html index bb8f8b2..ce9bff7 100644 --- a/templates/partials/nav.html +++ b/templates/partials/nav.html @@ -13,7 +13,7 @@ {% if is_authenticated %} - + {{ icons::user("h-5 w-5") }} {% else %} diff --git a/tests/server/pages.rs b/tests/server/pages.rs index dc6592a..d3bc935 100644 --- a/tests/server/pages.rs +++ b/tests/server/pages.rs @@ -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