From d68f17a0f2eb4c0ebdc55f17dd8c88f3c17bedc4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 8 Nov 2026 22:46:39 +0000 Subject: [PATCH] feat(layout): show the app icon before the app bar title Renders /icon.svg (from the consuming app's public folder) at the start of the app bar; hidden when the app has no such file. Part of buzz-code/ops#51 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012GTictk4m3LeNDMNyQ6Uow --- components/layout/CustomAppBar.jsx | 7 +++++++ components/layout/__tests__/CustomAppBar.test.jsx | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/components/layout/CustomAppBar.jsx b/components/layout/CustomAppBar.jsx index 8a1fd5f..97d2918 100644 --- a/components/layout/CustomAppBar.jsx +++ b/components/layout/CustomAppBar.jsx @@ -1,10 +1,17 @@ import { AppBar, TitlePortal } from 'react-admin'; import YearSelector from './YearSelector'; +// The app's own icon (client/public/icon.svg) before the title; hidden if the app has none. +const hideOnError = (e) => { e.currentTarget.style.display = 'none'; }; +const AppLogo = () => ( + +); + // content: what the app bar shows next to the title. Defaults to the year picker; // pass null for nothing, or an app's own control (e.g. a project switcher). const CustomAppBar = ({ content = , ...props }) => ( + {content} diff --git a/components/layout/__tests__/CustomAppBar.test.jsx b/components/layout/__tests__/CustomAppBar.test.jsx index 7a88356..5f47cc2 100644 --- a/components/layout/__tests__/CustomAppBar.test.jsx +++ b/components/layout/__tests__/CustomAppBar.test.jsx @@ -18,6 +18,11 @@ describe('CustomAppBar', () => { expect(screen.queryByText('year-selector')).not.toBeInTheDocument(); }); + it('shows the app icon before the title', () => { + const { container } = renderBar(); + expect(container.querySelector('img[src="/icon.svg"]')).toBeInTheDocument(); + }); + it('shows nothing next to the title for null content', () => { renderBar({ content: null }); expect(screen.queryByText('year-selector')).not.toBeInTheDocument();