Move page titles into the top header bar to reclaim vertical space

PageHeader now sets title via context instead of rendering inline.
TopBar displays the current page title and subtitle in the left area
that was previously an empty spacer. Content area gains ~40px of
vertical space on every page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-01 08:56:06 -04:00
parent d996fb66b6
commit 957376c770
4 changed files with 73 additions and 17 deletions

View File

@@ -0,0 +1,39 @@
'use client';
import { createContext, useContext, useState, useCallback, ReactNode } from 'react';
interface PageTitleState {
title: string;
subtitle: string;
}
interface PageTitleContextValue extends PageTitleState {
setPageTitle: (title: string, subtitle: string) => void;
}
const PageTitleContext = createContext<PageTitleContextValue>({
title: '',
subtitle: '',
setPageTitle: () => {},
});
export function PageTitleProvider({ children }: { children: ReactNode }) {
const [state, setState] = useState<PageTitleState>({ title: '', subtitle: '' });
const setPageTitle = useCallback((title: string, subtitle: string) => {
setState(prev => {
if (prev.title === title && prev.subtitle === subtitle) return prev;
return { title, subtitle };
});
}, []);
return (
<PageTitleContext.Provider value={{ ...state, setPageTitle }}>
{children}
</PageTitleContext.Provider>
);
}
export function usePageTitle() {
return useContext(PageTitleContext);
}