This commit is contained in:
Desktop
2025-11-13 01:04:19 +05:00
parent 31bfadf38a
commit 04f15a77bc
2 changed files with 46 additions and 34 deletions

View File

@@ -18,6 +18,7 @@ interface PageHeaderProps {
icon: ReactNode;
color: 'blue' | 'green' | 'purple' | 'orange' | 'red' | 'indigo';
};
hideSiteSector?: boolean; // Hide site/sector selector and info for global pages
}
export default function PageHeader({
@@ -27,6 +28,7 @@ export default function PageHeader({
onRefresh,
className = "",
badge,
hideSiteSector = false,
}: PageHeaderProps) {
const { activeSite } = useSiteStore();
const { activeSector } = useSectorStore();
@@ -53,42 +55,51 @@ export default function PageHeader({
)}
<h2 className="text-2xl font-bold text-gray-800 dark:text-white/90">{title}</h2>
</div>
<div className="flex items-center gap-3 mt-1">
{lastUpdated && (
<>
<p className="text-sm text-gray-500 dark:text-gray-400">
Last updated: {lastUpdated.toLocaleTimeString()}
</p>
</>
)}
{activeSite && (
<>
{lastUpdated && <span className="text-sm text-gray-400 dark:text-gray-600"></span>}
<p className="text-sm font-medium text-gray-700 dark:text-gray-300">
Site: <span className="text-brand-600 dark:text-brand-400">{activeSite.name}</span>
</p>
</>
)}
{activeSector && (
<>
<span className="text-sm text-gray-400 dark:text-gray-600"></span>
<p className="text-sm font-medium text-gray-700 dark:text-gray-300">
Sector: <span className="text-brand-600 dark:text-brand-400">{activeSector.name}</span>
</p>
</>
)}
{!activeSector && activeSite && (
<>
<span className="text-sm text-gray-400 dark:text-gray-600"></span>
<p className="text-sm font-medium text-gray-700 dark:text-gray-300">
Sector: <span className="text-brand-600 dark:text-brand-400">All Sectors</span>
</p>
</>
)}
</div>
{!hideSiteSector && (
<div className="flex items-center gap-3 mt-1">
{lastUpdated && (
<>
<p className="text-sm text-gray-500 dark:text-gray-400">
Last updated: {lastUpdated.toLocaleTimeString()}
</p>
</>
)}
{activeSite && (
<>
{lastUpdated && <span className="text-sm text-gray-400 dark:text-gray-600"></span>}
<p className="text-sm font-medium text-gray-700 dark:text-gray-300">
Site: <span className="text-brand-600 dark:text-brand-400">{activeSite.name}</span>
</p>
</>
)}
{activeSector && (
<>
<span className="text-sm text-gray-400 dark:text-gray-600"></span>
<p className="text-sm font-medium text-gray-700 dark:text-gray-300">
Sector: <span className="text-brand-600 dark:text-brand-400">{activeSector.name}</span>
</p>
</>
)}
{!activeSector && activeSite && (
<>
<span className="text-sm text-gray-400 dark:text-gray-600"></span>
<p className="text-sm font-medium text-gray-700 dark:text-gray-300">
Sector: <span className="text-brand-600 dark:text-brand-400">All Sectors</span>
</p>
</>
)}
</div>
)}
{hideSiteSector && lastUpdated && (
<div className="flex items-center gap-3 mt-1">
<p className="text-sm text-gray-500 dark:text-gray-400">
Last updated: {lastUpdated.toLocaleTimeString()}
</p>
</div>
)}
</div>
<div className="flex items-center gap-3">
<SiteAndSectorSelector />
{!hideSiteSector && <SiteAndSectorSelector />}
{showRefresh && onRefresh && (
<button
onClick={onRefresh}