Skip to content

Recipe book in the Sheet section; phone-friendly top bar with real user avatar - #37

Merged
zzuse merged 3 commits into
mainfrom
claude/technical-blog-markdown-yqktk3
Nov 3, 2026
Merged

zzuse merged 3 commits into
mainfrom
claude/technical-blog-markdown-yqktk3

Conversation

@zzuse

@zzuse zzuse commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Summary

Recipe book (Sheet section, separate from the calculators)

  • /recipes lists recipes as picture cards (title, summary, time, servings, tags). /recipes/<slug> shows the picture, an ingredient checklist, numbered steps and an optional tip.
  • Static, no database: recipes are a plain list in src/safe_family/urls/recipes_data.py. To add one, copy a block. Pictures go in src/safe_family/static/recipes/. Ships with one example (Tomato and Egg Stir-Fry) and its own SVG picture.
  • tests/test_recipes.py checks the hand-edited data: required fields, a valid slug, no duplicate slugs, list types, and that each picture file exists. It also covers the pages: login, list, detail, 404, no picture, empty list.

Top bar on phones

  • The bar was a single fixed row, so every page was about 660 px wide on a phone. Up to 900 px, the links now move to their own row. On small phones the "ZZUSE™" mark, the name text and the badge give way: the admin's avatar gets an accent ring instead. Desktop is unchanged.
  • Logout moves from the menu to the user area, so the six links fit on one row from 320 px up.

Real user in the top bar

  • The avatar always showed "M" and the name was empty, because the template read session.user_name, which login never sets. session.role had the same problem, so the GAME MASTER badge never appeared.
  • A context processor (inject_nav_user in app.py) now looks up the logged-in user per request, so each user gets their own initial and name.
  • The badge requires the configured ADMIN_IDENTITY, the same rule as the admin checks elsewhere.
  • A missing user or a database error falls back to ? rather than failing the page.

Testing

  • pytest: 346 passed, total coverage 84% (above the 80% gate). ruff check . is clean.
  • New tests/test_nav_user.py: per-user initials, Logout placement, the admin badge, an admin claim for the wrong identity being ignored, a missing user, a database error, logged out.
  • Checked in a browser at 320, 360, 390, 430, 768 and 1280 px as the admin, as a normal user and logged out: no page is wider than the viewport.

Deploying

docker compose up -d --build app. Templates, CSS and the recipe data are built into the app image.


Generated by Claude Code

/recipes lists recipes as picture cards; /recipes/<slug> shows the
picture, an ingredient checklist and numbered steps. Recipes are plain
data in src/safe_family/urls/recipes_data.py (copy a block to add one),
pictures in static/recipes/. One example recipe with its own SVG picture.

The Sheet page gets a separate Recipes section below Calculators, and the
Sheet nav item stays active on the recipe pages. tests/test_recipes.py
validates the hand-edited data (fields, unique slugs, pictures exist) and
the pages (login, list, detail, 404, no picture, empty list).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CKZWtPcMA8pSrVvGGwno21
The bar was one fixed row (brand, eight links, user), so on a phone it
made every page about 660px wide and scroll sideways.

- Up to 900px: brand and user stay on the first row; the links move to a
  full-width second row that wraps.
- Up to 480px: the links form a balanced grid (4 + 3) and the ZZUSE mark
  and user name text are hidden (the avatar shows the initial), keeping
  the first row on one line.
Desktop is unchanged. Checked at 320, 360, 390, 430, 768 and 1280px on
the Sheet, recipe, notes, blog and calculator pages, logged in as admin
and logged out: no page is wider than the screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CKZWtPcMA8pSrVvGGwno21
The avatar always showed 'M' and the name was empty: the template read
session.user_name, which login never sets (same for session.role, so the
GAME MASTER badge never appeared). A context processor now looks up the
logged-in user per request (get_current_username) and gives the template
their username, initial and admin flag; admin still requires the
configured ADMIN_IDENTITY, as elsewhere. A missing user or a database
error falls back to '?' instead of failing the page.

Logout moves from the menu to the user area. On phones the six links fit
on one row from 320px up (tighter spacing under 340px), the badge gives
way to an accent ring on the admin's avatar, and the 4-column grid is
gone. Checked at 320-1280px as admin and as a normal user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CKZWtPcMA8pSrVvGGwno21
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T21:26:31.207816Z 884461c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@zzuse
zzuse merged commit 1a21f71 into main Nov 3, 2026
2 checks passed
@zzuse
zzuse deleted the claude/technical-blog-markdown-yqktk3 branch November 3, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants