import { Link } from "react-router";
import type { Event } from "~/lib/db.server";
interface Props {
event: Event;
}
export default function EventListRow({ event }: Props) {
const formattedDate = formatDate(event.date);
const timeLabel = buildTimeLabel(event.open_time, event.start_time);
return (
{/* Date */}
{formattedDate}
{timeLabel && (
{timeLabel}
)}
{/* Venue */}
{event.venue_name}
{event.venue_area ? `(${event.venue_area})` : ""}
{/* Title + artist */}
{event.title}
{event.artist && (
{event.artist}
)}
{/* Price */}
{event.price ? (
¥{event.price}
) : (
)}
);
}
function formatDate(iso: string): string {
const [y, m, d] = iso.split("-");
const days = ["日", "月", "火", "水", "木", "金", "土"];
const dayIdx = new Date(`${iso}T00:00:00`).getDay();
return `${y}/${m}/${d}(${days[dayIdx]})`;
}
function buildTimeLabel(open: string | null, start: string | null): string {
const parts: string[] = [];
if (open) parts.push(`OPEN ${open}`);
if (start) parts.push(`START ${start}`);
return parts.join(" / ");
}