From 874749df46cc291ca61f2f98092ccabfdeffbf16 Mon Sep 17 00:00:00 2001 From: yyamashita Date: Sat, 26 Sep 2026 00:19:53 +0900 Subject: Add passkey login and favorite search terms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Single-user auth: any registered passkey logs in as the owner. First registration needs a one-time token that the app writes to data/registration-token when no passkey exists yet; once logged in, more passkeys can be added without a token. Logged in, /favorites manages a list of terms (e.g. band names). Events whose title or artist contains a term (NFKC + case-insensitive) get a ★, and the event list gains an "お気に入りのみ" filter. Co-Authored-By: Claude Opus 5.5 --- app/routes/events._index.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'app/routes/events._index.tsx') diff --git a/app/routes/events._index.tsx b/app/routes/events._index.tsx index 33568df..563b0c0 100644 --- a/app/routes/events._index.tsx +++ b/app/routes/events._index.tsx @@ -6,6 +6,7 @@ import EventListRow from "~/components/EventListRow"; import FilterBar from "~/components/FilterBar"; import ScrapeButton from "~/components/ScrapeButton"; import { useVenueFilter } from "~/lib/venue-filter"; +import { isLoggedIn } from "~/lib/auth.server"; function defaultWindow() { const today = new Date(); @@ -27,19 +28,24 @@ export async function loader({ request }: Route.LoaderArgs) { const keyword = url.searchParams.get("keyword") ?? undefined; const capacity_range = (url.searchParams.get("capacity_range") ?? undefined) as CapacityRange | undefined; const area = url.searchParams.get("area") ?? undefined; + const loggedIn = isLoggedIn(request); + const favorites_only = loggedIn && url.searchParams.get("fav") === "1"; const page = Math.max(1, parseInt(url.searchParams.get("page") ?? "1", 10)); const limit = 30; const offset = (page - 1) * limit; - const events = queryEvents({ date_from, date_to, venue_id, keyword, capacity_range, area, limit, offset }); + const events = queryEvents({ + date_from, date_to, venue_id, keyword, capacity_range, area, + with_favorites: loggedIn, favorites_only, limit, offset, + }); const venues = getVenues(); const areas = [...new Set(venues.filter((v) => v.area).map((v) => v.area as string))].sort(); - return { events, venues, areas, page, hasMore: events.length === limit, date_from, date_to }; + return { events, venues, areas, page, hasMore: events.length === limit, date_from, date_to, loggedIn }; } export default function EventsIndex() { - const { events, venues, areas, page, hasMore, date_from, date_to } = useLoaderData(); + const { events, venues, areas, page, hasMore, date_from, date_to, loggedIn } = useLoaderData(); const [searchParams, setSearchParams] = useSearchParams(); const view = (searchParams.get("view") ?? "card") as "card" | "list"; const { hiddenIds } = useVenueFilter(); @@ -67,6 +73,7 @@ export default function EventsIndex() { イベント 日付別 会場一覧 + ★ お気に入り @@ -94,7 +101,7 @@ export default function EventsIndex() { - + {hiddenEventCount > 0 && (

-- cgit v1.3