Subtitles added noise without value. Stripped subtitle props from all 8 PageHeader calls, removed subtitle display from TopBar, and simplified the PageTitleContext and PageHeader interfaces to title-only. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
737 B
TypeScript
32 lines
737 B
TypeScript
'use client';
|
|
|
|
import { createContext, useContext, useState, useCallback, ReactNode } from 'react';
|
|
|
|
interface PageTitleContextValue {
|
|
title: string;
|
|
setPageTitle: (title: string) => void;
|
|
}
|
|
|
|
const PageTitleContext = createContext<PageTitleContextValue>({
|
|
title: '',
|
|
setPageTitle: () => {},
|
|
});
|
|
|
|
export function PageTitleProvider({ children }: { children: ReactNode }) {
|
|
const [title, setTitle] = useState('');
|
|
|
|
const setPageTitle = useCallback((t: string) => {
|
|
setTitle(prev => prev === t ? prev : t);
|
|
}, []);
|
|
|
|
return (
|
|
<PageTitleContext.Provider value={{ title, setPageTitle }}>
|
|
{children}
|
|
</PageTitleContext.Provider>
|
|
);
|
|
}
|
|
|
|
export function usePageTitle() {
|
|
return useContext(PageTitleContext);
|
|
}
|