import { MapPin, Camera, Smile, Laugh, Meh, Frown, Sun, CloudSun, Cloud, CloudRain, CloudLightning, Snowflake } from 'lucide-react' import { formatLocationName } from '../../utils/formatters' import type { JourneyEntry, JourneyPhoto } from '../../store/journeyStore' const MOOD_ICONS: Record = { amazing: Laugh, good: Smile, neutral: Meh, rough: Frown, } const MOOD_COLORS: Record = { amazing: 'text-pink-500', good: 'text-amber-500', neutral: 'text-zinc-400', rough: 'text-violet-500', } const WEATHER_ICONS: Record = { sunny: Sun, partly: CloudSun, cloudy: Cloud, rainy: CloudRain, stormy: CloudLightning, cold: Snowflake, } function photoUrl(p: JourneyPhoto): string { return `/api/photos/${p.photo_id}/thumbnail` } function stripMarkdown(text: string): string { return text .replace(/[#*_~`>\[\]()!|-]/g, '') .replace(/\n+/g, ' ') .trim() } interface Props { entry: JourneyEntry | { id: number; type: string; title?: string | null; location_name?: string | null; location_lat?: number | null; location_lng?: number | null; entry_date: string; entry_time?: string | null; mood?: string | null; weather?: string | null; photos?: { photo_id: number }[]; story?: string | null } dayLabel: number dayColor: string isActive: boolean onClick: () => void publicPhotoUrl?: (photoId: number) => string } export default function MobileEntryCard({ entry, dayLabel, dayColor, isActive, onClick, publicPhotoUrl }: Props) { const hasLocation = !!(entry.location_lat && entry.location_lng) const hasPhotos = entry.photos && entry.photos.length > 0 const firstPhoto = hasPhotos ? entry.photos![0] : null const MoodIcon = entry.mood ? MOOD_ICONS[entry.mood] : null const moodColor = entry.mood ? MOOD_COLORS[entry.mood] : '' const WeatherIcon = entry.weather ? WEATHER_ICONS[entry.weather] : null const thumbSrc = firstPhoto ? publicPhotoUrl ? publicPhotoUrl((firstPhoto as any).photo_id ?? (firstPhoto as any).id) : photoUrl(firstPhoto as JourneyPhoto) : null const date = new Date(entry.entry_date + 'T00:00:00') const dateStr = date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' }) const storyPreview = entry.story ? stripMarkdown(entry.story) : '' return ( ) }