From c18885f2b022f4a8116809aa893929f2c278b319 Mon Sep 17 00:00:00 2001
From: yyamashita <yyamashita@mosquit.one>
Date: Wed, 6 May 2026 22:09:41 +0900
Subject: Limit scrape window and default event list to ~1 month

Scraper runner now filters events to today + 35 days before upserting,
so the DB only holds the upcoming month of events.

Event list loader defaults date_from/date_to to the same window when
no query params are set, and passes the values down to FilterBar so the
date inputs are pre-filled on first load.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---
 app/components/FilterBar.tsx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'app/components/FilterBar.tsx')

diff --git a/app/components/FilterBar.tsx b/app/components/FilterBar.tsx
index 97a3c02..266865d 100644
--- a/app/components/FilterBar.tsx
+++ b/app/components/FilterBar.tsx
@@ -3,9 +3,11 @@ import type { Venue } from "~/lib/db.server";
 
 interface Props {
   venues: Venue[];
+  defaultDateFrom?: string;
+  defaultDateTo?: string;
 }
 
-export default function FilterBar({ venues }: Props) {
+export default function FilterBar({ venues, defaultDateFrom, defaultDateTo }: Props) {
   const [searchParams] = useSearchParams();
 
   return (
@@ -45,7 +47,7 @@ export default function FilterBar({ venues }: Props) {
         <input
           name="date_from"
           type="date"
-          defaultValue={searchParams.get("date_from") ?? ""}
+          defaultValue={searchParams.get("date_from") ?? defaultDateFrom ?? ""}
           className="rounded-md bg-gray-800 border border-gray-700 px-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-500"
         />
       </div>
@@ -56,7 +58,7 @@ export default function FilterBar({ venues }: Props) {
         <input
           name="date_to"
           type="date"
-          defaultValue={searchParams.get("date_to") ?? ""}
+          defaultValue={searchParams.get("date_to") ?? defaultDateTo ?? ""}
           className="rounded-md bg-gray-800 border border-gray-700 px-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-500"
         />
       </div>
-- 
cgit v1.2.3

