// topbar.jsx — top toolbar with date nav, view switcher, search, +New function Topbar({ anchorDate, setAnchorDate, today, view, setView, search, setSearch, onNewBooking, dark, setDark, onCalendar = true, pageTitle, }) { const goToday = () => setAnchorDate(new Date(today)); const stepDays = (n) => { const d = new Date(anchorDate); d.setDate(d.getDate() + n); setAnchorDate(d); }; // Compute window-end based on view let windowEnd; if (view === 'timeline') { windowEnd = new Date(anchorDate); windowEnd.setDate(windowEnd.getDate() + 13); } else if (view === 'week') { windowEnd = new Date(anchorDate); windowEnd.setDate(windowEnd.getDate() + 6); } else { windowEnd = anchorDate; } const dateLabel = view === 'month' ? `${MONTH_VN[anchorDate.getMonth()]} ${anchorDate.getFullYear()}` : view === 'day' ? formatDateVN(anchorDate) : formatRange(anchorDate, windowEnd); const step = view === 'timeline' ? 7 : view === 'week' ? 7 : view === 'month' ? 30 : 1; return (