From 1435fb5efca3216eb1c06a53a3cfc56e30d264a3 Mon Sep 17 00:00:00 2001 From: Chris Olson Date: Fri, 4 Sep 2026 12:16:05 -0400 Subject: [PATCH] Remove global date/district filter from top bar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The global filter caused confusion — activities saved with future dates were silently filtered out, making it appear saves didn't work. Subviews can add their own filtering where it makes sense. Co-Authored-By: Claude Opus 4.6 --- src/components/layout/TopBar.tsx | 90 +------------------------------- src/lib/data-context.tsx | 45 +--------------- 2 files changed, 3 insertions(+), 132 deletions(-) diff --git a/src/components/layout/TopBar.tsx b/src/components/layout/TopBar.tsx index 802f33b..3443279 100644 --- a/src/components/layout/TopBar.tsx +++ b/src/components/layout/TopBar.tsx @@ -1,49 +1,12 @@ 'use client'; -import { useData, DatePreset } from '@/lib/data-context'; +import { useData } from '@/lib/data-context'; import { usePageTitle } from '@/lib/page-title-context'; import { format } from 'date-fns'; -import { useState, useRef, useEffect } from 'react'; -import { DISTRICTS } from '@/types/data'; - -const DATE_PRESETS: { value: DatePreset; label: string }[] = [ - { value: 'this_week', label: 'This Week' }, - { value: 'last_7', label: 'Last 7 Days' }, - { value: 'this_month', label: 'This Month' }, - { value: 'this_quarter', label: 'This Quarter' }, - { value: 'last_quarter', label: 'Last Quarter' }, -]; export function TopBar() { - const { filters, setDistricts, setDatePreset, refresh, isLoading, lastRefreshed, clearAllFilters, clearCrossFilter } = useData(); + const { filters, refresh, isLoading, lastRefreshed, clearCrossFilter } = useData(); const { title } = usePageTitle(); - const [showDistrictDropdown, setShowDistrictDropdown] = useState(false); - const dropdownRef = useRef(null); - - useEffect(() => { - function handleClick(e: MouseEvent) { - if (dropdownRef.current && !dropdownRef.current.contains(e.target as Node)) { - setShowDistrictDropdown(false); - } - } - document.addEventListener('mousedown', handleClick); - return () => document.removeEventListener('mousedown', handleClick); - }, []); - - const toggleDistrict = (d: string) => { - const current = filters.districts; - if (current.includes(d)) { - setDistricts(current.filter(x => x !== d)); - } else { - setDistricts([...current, d]); - } - }; - - const districtLabel = filters.districts.length === 0 - ? 'All Districts' - : filters.districts.length === 1 - ? filters.districts[0].replace('SE-', '') - : `${filters.districts.length} Districts`; return (
@@ -71,55 +34,6 @@ export function TopBar() { )} - {/* Date preset */} - - - {/* District filter */} -
- - {showDistrictDropdown && ( -
- - {DISTRICTS.map(d => ( - - ))} -
- )} -
- {/* Refresh */}