import { useState } from 'react' import { X, Pencil, Trash2, MapPin, Clock, Camera, Laugh, Smile, Meh, Frown, Sun, CloudSun, Cloud, CloudRain, CloudLightning, Snowflake, ThumbsUp, ThumbsDown, ChevronDown, } from 'lucide-react' import JournalBody from './JournalBody' import { formatLocationName } from '../../utils/formatters' import type { JourneyEntry, JourneyPhoto } from '../../store/journeyStore' const MOOD_CONFIG: Record = { amazing: { icon: Laugh, label: 'Amazing', bg: 'bg-pink-50 dark:bg-pink-900/20', text: 'text-pink-600 dark:text-pink-400' }, good: { icon: Smile, label: 'Good', bg: 'bg-amber-50 dark:bg-amber-900/20', text: 'text-amber-600 dark:text-amber-400' }, neutral: { icon: Meh, label: 'Neutral', bg: 'bg-zinc-100 dark:bg-zinc-800', text: 'text-zinc-500 dark:text-zinc-400' }, rough: { icon: Frown, label: 'Rough', bg: 'bg-violet-50 dark:bg-violet-900/20', text: 'text-violet-600 dark:text-violet-400' }, } const WEATHER_CONFIG: Record = { sunny: { icon: Sun, label: 'Sunny' }, partly: { icon: CloudSun, label: 'Partly cloudy' }, cloudy: { icon: Cloud, label: 'Cloudy' }, rainy: { icon: CloudRain, label: 'Rainy' }, stormy: { icon: CloudLightning, label: 'Stormy' }, cold: { icon: Snowflake, label: 'Cold' }, } function photoUrl(p: JourneyPhoto, size: 'thumbnail' | 'original' = 'original', builder?: (id: number) => string): string { if (builder) return builder(p.photo_id) return `/api/photos/${p.photo_id}/${size}` } interface Props { entry: JourneyEntry readOnly?: boolean publicPhotoUrl?: (photoId: number) => string onClose: () => void onEdit: () => void onDelete: () => void onPhotoClick: (photos: JourneyPhoto[], index: number) => void } export default function MobileEntryView({ entry, readOnly, publicPhotoUrl, onClose, onEdit, onDelete, onPhotoClick }: Props) { const photos = entry.photos || [] const mood = entry.mood ? MOOD_CONFIG[entry.mood] : null const weather = entry.weather ? WEATHER_CONFIG[entry.weather] : null const prosArr = entry.pros_cons?.pros ?? [] const consArr = entry.pros_cons?.cons ?? [] const hasProscons = prosArr.length > 0 || consArr.length > 0 const date = new Date(entry.entry_date + 'T00:00:00') const dateStr = date.toLocaleDateString(undefined, { weekday: 'long', day: 'numeric', month: 'long' }) return (
{/* Top bar */}
{!readOnly && (
)}
{/* Scrollable content */}
{/* Hero photo(s) */} {photos.length > 0 && (
onPhotoClick(photos, 0)} /> {photos.length > 1 && (
{photos.length} photos
)} {/* Photo strip for multiple photos */} {photos.length > 1 && (
{photos.map((p, i) => ( onPhotoClick(photos, i)} /> ))}
)}
)} {/* Content */}
{/* Date + time + location header */}
{dateStr} {entry.entry_time && ( {entry.entry_time.slice(0, 5)} )}
{entry.location_name && (
{formatLocationName(entry.location_name)}
)} {/* Title */} {entry.title && (

{entry.title}

)} {/* Mood + Weather chips */} {(mood || weather) && (
{mood && ( {mood.label} )} {weather && ( {weather.label} )}
)} {/* Story */} {entry.story && (
)} {/* Tags */} {entry.tags && entry.tags.length > 0 && (
{entry.tags.map((tag, i) => ( {tag} ))}
)} {/* Pros & Cons */} {hasProscons && (
{prosArr.length > 0 && (
Pros
    {prosArr.map((p, i) => (
  • + {p}
  • ))}
)} {prosArr.length > 0 && consArr.length > 0 && (
)} {consArr.length > 0 && (
Cons
    {consArr.map((c, i) => (
  • {c}
  • ))}
)}
)}
) }