Skip to content

fix(web): span the viewing-as banner full width outside the app shell - #1298

Merged
Quick104 merged 2 commits into
mainfrom
fix/issue-1290-viewing-as-banner-gap
Sep 22, 2026
Merged

Quick104 merged 2 commits into
mainfrom
fix/issue-1290-viewing-as-banner-gap

Conversation

@Quick104

@Quick104 Quick104 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1290

While an admin views the app as another user, the "Viewing as" banner on the profile picker starts 260px from the left edge, leaving a blank strip where no sidebar exists. The banner renders above every route, but its left margin came from --app-sidebar-offset, which resolved to 260px on any viewport at or above 1024px whether or not Layout and its sidebar were mounted. The profile picker, login, and player routes live outside Layout, so they reserved room for a sidebar that was not there.

Approach

Gate the desktop offset values in web/src/app.css on a shell attribute. Layout already sets data-app-shell for exactly as long as its sidebar exists, so routes outside the shell keep the 0px default and routes inside it keep the 260px and 64px values they had.

The admin area is a second shell: AdminLayout sits outside Layout and draws its own fixed 240px sidebar, and the audiobook mini bar reads the same variable and stays mounted across admin navigation. AdminLayout now publishes data-admin-shell for its lifetime and the CSS resolves the offset to 240px while it is present. Codex review caught this after the first commit.

The alternative was to make the banner and mini bar route-aware themselves, but that would duplicate knowledge the two layouts already publish. A CSS contract test in sidebarCollapseCss.test.ts requires every non-zero offset to hang off one of the two shell attributes and fails on the original ungated rule. AdminLayout.test.tsx covers the new attribute's lifetime.

Validation

  • Reproduced on a shared dev deployment through the Vite dev server: sign in as admin, impersonate a non-admin user from the admin user page, land on the profile picker. Banner left edge measured at 260px before the change and 0px after, with the variable at 260px and 0px respectively.
  • Adjacent states in the same session: home with the expanded sidebar keeps the banner at 260px, matching the sidebar's right edge; an episode detail page with the collapsed rail keeps it at 64px; /admin resolves the variable to 240px with the admin sidebar's right edge at 240px; returning to /profiles drops it to 0px.
  • sidebarCollapseCss.test.ts, navigationTransitionCss.test.ts, Layout.test.tsx, and AdminLayout.test.tsx pass. The contract test fails against the previous CSS.
  • pnpm run lint, pnpm run format:check, and pnpm run build pass. make test-web passed twice in full on the first commit; a first run had one failure in AdminRequests.v2.test.tsx that did not reproduce and is unrelated to these files.
  • Not run: the Go gate and the generated-contract checks, since no Go, migration, or contract files changed.

Risks

None identified. The change is web-only chrome. No Apple, Android, or jellycompat follow-up is needed.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (T3 Code)
  • Tool(s): Claude Code
  • Model(s): claude-fable-5-1
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: Codex (chatgpt-codex-connector) reviewed the first commit and flagged the admin sidebar regression for the audiobook mini bar; verified against source and fixed in the second commit.

🤖 Generated with Claude Code

The impersonation banner renders above every route, but its left margin
came from a sidebar offset that resolved to 260px on any desktop viewport,
whether or not Layout and its sidebar were mounted. On the profile picker,
login, and player routes the banner reserved room for a sidebar that was
not there, leaving a blank strip on the left.

Gate the desktop offset values on html[data-app-shell], which Layout sets
for exactly the sidebar's lifetime, so off-shell routes keep the 0px
default. Add a CSS contract test that fails on the ungated rule.

Closes #1290

Co-Authored-By: Claude Fable 5.1 <[email protected]>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick104 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 46a6bfe9-3c5d-4f6b-9b3d-035bc82ff6fc

📥 Commits

Reviewing files that changed from the base of the PR and between cef0272 and 4f9e7b6.

📒 Files selected for processing (5)
  • web/src/app.css
  • web/src/components/AdminLayout.test.tsx
  • web/src/components/AdminLayout.tsx
  • web/src/components/Layout.tsx
  • web/src/sidebarCollapseCss.test.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 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-09-22T13:45:40.223515Z 4f9e7b6 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc49b46b12

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/src/app.css Resolved
Gating the sidebar offset on data-app-shell also zeroed it inside the
admin area, which has its own fixed 240px sidebar outside Layout. The
audiobook MiniBar stays mounted across admin navigation and sets its left
edge from that variable, so it would have started at 0px under the admin
navigation.

AdminLayout now publishes data-admin-shell for its lifetime and app.css
resolves the offset to 240px while it is present. The CSS contract test
requires every non-zero offset to hang off one of the two shell
attributes, and AdminLayout.test covers the attribute's lifetime.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@Quick104
Quick104 merged commit 661578e into main Sep 22, 2026
11 checks passed
@Quick104
Quick104 deleted the fix/issue-1290-viewing-as-banner-gap branch September 22, 2026 14:00
@Quick104 Quick104 mentioned this pull request Sep 23, 2026
2 tasks done
@zZebrahz zZebrahz mentioned this pull request Sep 24, 2026
8 tasks done
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.

1 participant