/** * @file components/layout/AppHeader.tsx * @description Unified application header supporting general views, chat channels, and DM views. */ "use client"; import { useSidebarStore } from "@/lib/stores/useSidebarStore"; import { PanelLeftOpen, PanelLeftClose, Users, Hash } from "lucide-react"; /** * Properties for the AppHeader component. * * @interface AppHeaderProps * @property {string} [title] - Optional channel or page title to display in the header. * @property {boolean} [showMembersButton=false] - Flag indicating whether to display the member list toggle button. */ interface AppHeaderProps { title?: string; showMembersButton?: boolean; } /** * Renders the application header bar with navigation controls, dynamic page titles, and member list toggle capability. * * @param {AppHeaderProps} props - The component props. * @param {string} [props.title] - Optional channel or page title to display. * @param {boolean} [props.showMembersButton=false] - Whether to show the button toggling the right sidebar/member panel. * @returns {JSX.Element} The header component visual structure. */ export function AppHeader({ title, showMembersButton = false, }: AppHeaderProps) { const { isNavOpen, toggleNav, toggleMembers } = useSidebarStore(); const hasContent = !isNavOpen || !!title || showMembersButton; return (
{/* Toggle button for navigation */} {/* Dynamic Title (Channel/Page Name) */} {title && (

{title}

)}
{/* Button for the member bar */} {showMembersButton && ( )}
); }