import { formatDistanceToNow } from 'date-fns'; import { sanitizeTerminalText } from '../../utils/terminal'; import { useAppState } from '../state/context'; import { colors } from '../theme'; export function Header() { const state = useAppState(); const lastFetchText = state.lastFetchedAt ? formatDistanceToNow(state.lastFetchedAt, { addSuffix: true }) : 'never'; const progressText = state.fetchProgress ? ` [Fetching ${state.fetchProgress.current}/${state.fetchProgress.total}...]` : ''; return ( RSS Reader {' · '} {state.totalUnread} unread {' · '} {state.totalStarred} starred {' · '} Last: {lastFetchText} {progressText ? {progressText} : null} {state.error ? ( {' '} {' · '} {sanitizeTerminalText(state.error)} ) : null} ? Help ); }