diff --git a/backend/routes/trips.py b/backend/routes/trips.py index c34588c..329d4fb 100644 --- a/backend/routes/trips.py +++ b/backend/routes/trips.py @@ -17,6 +17,7 @@ def list_trips(db: Session = Depends(get_db)): joinedload(models.Trip.selected_tags), joinedload(models.Trip.marked_tags), ) + .order_by(models.Trip.start_date.asc()) .all() ) return [ diff --git a/frontend/src/pages/TripsPage.tsx b/frontend/src/pages/TripsPage.tsx index a7e9b28..85a7af5 100644 --- a/frontend/src/pages/TripsPage.tsx +++ b/frontend/src/pages/TripsPage.tsx @@ -41,6 +41,13 @@ export default function TripsPage() { loadTrips(); }, []); + // Markiere nächsten anstehenden Trip + const today = new Date().toISOString().slice(0, 10); + const nextTripIdx = trips.findIndex( + (trip) => trip.start_date >= today + ); + const nextTripId = nextTripIdx !== -1 ? trips[nextTripIdx].id : null; + return (
- {trip.start_date} – {trip.end_date} -
+ {trips.map(trip => { + const isPast = trip.start_date < today; + const isNext = trip.id === nextTripId; + return ( + ++ {trip.start_date} – {trip.end_date} +
+