import React from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faChevronRight, faRightFromBracket, faUser, faList, faThLarge, faImage, faGear } from '@fortawesome/free-solid-svg-icons' import { Hooks } from 'applesauce-react' import { useEventModel } from 'applesauce-react/hooks' import { Models } from 'applesauce-core' import IconButton from './IconButton' import { ViewMode } from './Bookmarks' interface SidebarHeaderProps { onToggleCollapse: () => void onLogout: () => void viewMode: ViewMode onViewModeChange: (mode: ViewMode) => void onOpenSettings: () => void } const SidebarHeader: React.FC = ({ onToggleCollapse, onLogout, viewMode, onViewModeChange, onOpenSettings }) => { const activeAccount = Hooks.useActiveAccount() const profile = useEventModel(Models.ProfileModel, activeAccount ? [activeAccount.pubkey] : null) const getProfileImage = () => { return profile?.picture || null } const getUserDisplayName = () => { if (!activeAccount) return 'Unknown User' if (profile?.name) return profile.name if (profile?.display_name) return profile.display_name if (profile?.nip05) return profile.nip05 return `${activeAccount.pubkey.slice(0, 8)}...${activeAccount.pubkey.slice(-8)}` } const profileImage = getProfileImage() return ( <>
{profileImage ? ( {getUserDisplayName()} ) : ( )}
onViewModeChange('compact')} title="Compact list view" ariaLabel="Compact list view" variant={viewMode === 'compact' ? 'primary' : 'ghost'} /> onViewModeChange('cards')} title="Cards view" ariaLabel="Cards view" variant={viewMode === 'cards' ? 'primary' : 'ghost'} /> onViewModeChange('large')} title="Large preview view" ariaLabel="Large preview view" variant={viewMode === 'large' ? 'primary' : 'ghost'} />
) } export default SidebarHeader