diff --git a/client/index.html b/client/index.html index 0e50cf50..6d769c09 100644 --- a/client/index.html +++ b/client/index.html @@ -19,6 +19,7 @@ + }) => { - if (config?.demo_mode) setDemoMode(true) + setDemoMode(!!config?.demo_mode) if (config?.dev_mode) setDevMode(true) if (config?.is_prerelease !== undefined) setIsPrerelease(config.is_prerelease) if (config?.version) setAppVersion(config.version) diff --git a/client/src/api/client.ts b/client/src/api/client.ts index 248792f2..81d40904 100644 --- a/client/src/api/client.ts +++ b/client/src/api/client.ts @@ -497,6 +497,7 @@ export const filesApi = { export const reservationsApi = { list: (tripId: number | string) => apiClient.get(`/trips/${tripId}/reservations`).then(r => r.data), + upcoming: () => apiClient.get('/reservations/upcoming').then(r => r.data), create: (tripId: number | string, data: Record) => apiClient.post(`/trips/${tripId}/reservations`, data).then(r => r.data), update: (tripId: number | string, id: number, data: Record) => apiClient.put(`/trips/${tripId}/reservations/${id}`, data).then(r => r.data), delete: (tripId: number | string, id: number) => apiClient.delete(`/trips/${tripId}/reservations/${id}`).then(r => r.data), diff --git a/client/src/components/Layout/Navbar.tsx b/client/src/components/Layout/Navbar.tsx index 5eb7e6b0..71bc8574 100644 --- a/client/src/components/Layout/Navbar.tsx +++ b/client/src/components/Layout/Navbar.tsx @@ -24,6 +24,7 @@ interface Addon { name: string icon: string type: string + enabled: boolean } export default function Navbar({ tripTitle, tripId, onBack, showBack, onShare }: NavbarProps): React.ReactElement { @@ -123,42 +124,6 @@ export default function Navbar({ tripTitle, tripId, onBack, showBack, onShare }: TREK - {/* Global addon nav items */} - {globalAddons.length > 0 && !tripTitle && ( - <> - | - e.currentTarget.style.background = 'var(--bg-hover)'} - onMouseLeave={e => { if (location.pathname !== '/dashboard') e.currentTarget.style.background = 'transparent' }}> - - {t('nav.myTrips')} - - {globalAddons.map(addon => { - const Icon = ADDON_ICONS[addon.icon] || CalendarDays - const path = `/${addon.id}` - const isActive = location.pathname === path - return ( - e.currentTarget.style.background = 'var(--bg-hover)'} - onMouseLeave={e => { if (!isActive) e.currentTarget.style.background = 'transparent' }}> - - {getAddonName(addon)} - - ) - })} - - )} - {tripTitle && ( <> / @@ -169,6 +134,42 @@ export default function Navbar({ tripTitle, tripId, onBack, showBack, onShare }: )} + {/* Centred liquid-glass tab menu (design handoff). Absolutely positioned so + the left brand block and the right action cluster keep their layout. */} + {globalAddons.length > 0 && !tripTitle && ( +
+ {[{ id: '__trips', path: '/dashboard', label: t('nav.myTrips'), Icon: Briefcase }, + ...globalAddons.map(a => ({ id: a.id, path: `/${a.id}`, label: getAddonName(a), Icon: ADDON_ICONS[a.icon] || CalendarDays })) + ].map(tab => { + const isActive = location.pathname === tab.path + return ( + { if (!isActive) e.currentTarget.style.color = 'var(--text-primary)' }} + onMouseLeave={e => { if (!isActive) e.currentTarget.style.color = 'var(--text-muted)' }}> + + {tab.label} + + ) + })} +
+ )} + {/* Spacer */}
diff --git a/client/src/components/shared/ConfirmDialog.tsx b/client/src/components/shared/ConfirmDialog.tsx index d75ad190..2e3b4e8b 100644 --- a/client/src/components/shared/ConfirmDialog.tsx +++ b/client/src/components/shared/ConfirmDialog.tsx @@ -1,4 +1,5 @@ import React, { useEffect, useCallback } from 'react' +import ReactDOM from 'react-dom' import { AlertTriangle } from 'lucide-react' import { useTranslation } from '../../i18n' @@ -38,7 +39,7 @@ export default function ConfirmDialog({ if (!isOpen) return null - return ( + return ReactDOM.createPortal(
-
+ , + document.body ) } diff --git a/client/src/components/shared/CopyTripDialog.tsx b/client/src/components/shared/CopyTripDialog.tsx index 0cd4cf8b..e94710cb 100644 --- a/client/src/components/shared/CopyTripDialog.tsx +++ b/client/src/components/shared/CopyTripDialog.tsx @@ -1,4 +1,5 @@ import React, { useEffect, useCallback } from 'react' +import ReactDOM from 'react-dom' import { Check, X } from 'lucide-react' import { useTranslation } from '../../i18n' @@ -39,7 +40,7 @@ export default function CopyTripDialog({ isOpen, tripTitle, onClose, onConfirm } if (!isOpen) return null - return ( + return ReactDOM.createPortal(
- + , + document.body ) } diff --git a/client/src/components/shared/Modal.tsx b/client/src/components/shared/Modal.tsx index 246de62d..80a54b38 100644 --- a/client/src/components/shared/Modal.tsx +++ b/client/src/components/shared/Modal.tsx @@ -1,4 +1,5 @@ import React, { useEffect, useCallback, useRef } from 'react' +import ReactDOM from 'react-dom' import { X } from 'lucide-react' const sizeClasses: Record = { @@ -48,7 +49,7 @@ export default function Modal({ if (!isOpen) return null - return ( + return ReactDOM.createPortal(
-
+ , + document.body ) } diff --git a/client/src/index.css b/client/src/index.css index ac1723fb..09b16614 100644 --- a/client/src/index.css +++ b/client/src/index.css @@ -489,7 +489,7 @@ input[type="number"], input[type="time"], input[type="date"], input[type="dateti } @media (min-width: 768px) { - :root { --nav-h: calc(56px + env(safe-area-inset-top, 0px)); } + :root { --nav-h: calc(64px + env(safe-area-inset-top, 0px)); } } .dark { diff --git a/client/src/pages/DashboardPage.tsx b/client/src/pages/DashboardPage.tsx index c3e4fa85..d403243d 100644 --- a/client/src/pages/DashboardPage.tsx +++ b/client/src/pages/DashboardPage.tsx @@ -1,26 +1,23 @@ -import React, { useEffect, useState, useRef } from 'react' +import React, { useEffect, useState } from 'react' import { useNavigate, useSearchParams } from 'react-router-dom' -import { tripsApi } from '../api/client' +import { tripsApi, authApi, reservationsApi } from '../api/client' import { tripRepo } from '../repo/tripRepo' import { useAuthStore } from '../store/authStore' -import { useSettingsStore } from '../store/settingsStore' import { useTranslation } from '../i18n' import { getApiErrorMessage } from '../types' import Navbar from '../components/Layout/Navbar' import DemoBanner from '../components/Layout/DemoBanner' -import CurrencyWidget from '../components/Dashboard/CurrencyWidget' -import TimezoneWidget from '../components/Dashboard/TimezoneWidget' import TripFormModal from '../components/Trips/TripFormModal' import ConfirmDialog from '../components/shared/ConfirmDialog' import CopyTripDialog from '../components/shared/CopyTripDialog' +import CustomSelect from '../components/shared/CustomSelect' import { useToast } from '../components/shared/Toast' -import { useCountUp } from '../hooks/useCountUp' import { - Plus, Calendar, Trash2, Edit2, Map, ChevronDown, ChevronUp, - Archive, ArchiveRestore, Clock, MapPin, Settings, X, ArrowRightLeft, Users, - LayoutGrid, List, Copy, Bell, CheckCircle2, + Plus, Edit2, Trash2, Archive, Copy, ArrowRight, MapPin, + Plane, Hotel, Utensils, Clock, RefreshCw, ArrowRightLeft, Calendar, + LayoutGrid, List, SlidersHorizontal, Ticket, X, } from 'lucide-react' -import { useCanDo } from '../store/permissionsStore' +import '../styles/dashboard.css' interface DashboardTrip { id: number @@ -38,18 +35,16 @@ interface DashboardTrip { [key: string]: string | number | boolean | null | undefined } -const font: React.CSSProperties = { fontFamily: "-apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif" } - const MS_PER_DAY = 86400000 function daysUntil(dateStr: string | null | undefined): number | null { if (!dateStr) return null const today = new Date(); today.setHours(0, 0, 0, 0) const d = new Date(dateStr + 'T00:00:00'); d.setHours(0, 0, 0, 0) - return Math.round((d - today) / MS_PER_DAY) + return Math.round((d.getTime() - today.getTime()) / MS_PER_DAY) } -function getTripStatus(trip: DashboardTrip): string | null { +function getTripStatus(trip: DashboardTrip): 'ongoing' | 'today' | 'tomorrow' | 'future' | 'past' | null { const today = new Date().toISOString().split('T')[0] if (trip.start_date && trip.end_date && trip.start_date <= today && trip.end_date >= today) return 'ongoing' const until = daysUntil(trip.start_date) @@ -60,22 +55,12 @@ function getTripStatus(trip: DashboardTrip): string | null { return 'past' } -function formatDate(dateStr: string | null | undefined, locale: string = 'en-US'): string | null { - if (!dateStr) return null - return new Date(dateStr + 'T00:00:00Z').toLocaleDateString(locale, { day: 'numeric', month: 'short', year: 'numeric', timeZone: 'UTC' }) -} - -function formatDateShort(dateStr: string | null | undefined, locale: string = 'en-US'): string | null { - if (!dateStr) return null - return new Date(dateStr + 'T00:00:00Z').toLocaleDateString(locale, { day: 'numeric', month: 'short', timeZone: 'UTC' }) -} - function sortTrips(trips: DashboardTrip[]): DashboardTrip[] { const today = new Date().toISOString().split('T')[0] - function rank(t) { - if (t.start_date && t.end_date && t.start_date <= today && t.end_date >= today) return 0 // ongoing - if (t.start_date && t.start_date >= today) return 1 // upcoming - return 2 // past + const rank = (t: DashboardTrip) => { + if (t.start_date && t.end_date && t.start_date <= today && t.end_date >= today) return 0 + if (t.start_date && t.start_date >= today) return 1 + return 2 } return [...trips].sort((a, b) => { const ra = rank(a), rb = rank(b) @@ -86,7 +71,6 @@ function sortTrips(trips: DashboardTrip[]): DashboardTrip[] { }) } -// Gradient backgrounds when no cover image const GRADIENTS = [ 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)', @@ -99,608 +83,67 @@ const GRADIENTS = [ ] function tripGradient(id: number): string { return GRADIENTS[id % GRADIENTS.length] } -// ── Liquid Glass hover effect ──────────────────────────────────────────────── -interface LiquidGlassProps { - children: React.ReactNode - dark: boolean - style?: React.CSSProperties - className?: string - onClick?: () => void -} - -function LiquidGlass({ children, dark, style, className = '', onClick }: LiquidGlassProps): React.ReactElement { - const ref = useRef(null) - const glareRef = useRef(null) - const borderRef = useRef(null) - - const onMove = (e: React.MouseEvent): void => { - if (!ref.current || !glareRef.current || !borderRef.current) return - const rect = ref.current.getBoundingClientRect() - const x = e.clientX - rect.left - const y = e.clientY - rect.top - glareRef.current.style.background = `radial-gradient(circle 250px at ${x}px ${y}px, ${dark ? 'rgba(255,255,255,0.04)' : 'rgba(0,0,0,0.03)'} 0%, transparent 70%)` - glareRef.current.style.opacity = '1' - borderRef.current.style.opacity = '1' - borderRef.current.style.maskImage = `radial-gradient(circle 120px at ${x}px ${y}px, black 0%, transparent 100%)` - borderRef.current.style.WebkitMaskImage = `radial-gradient(circle 120px at ${x}px ${y}px, black 0%, transparent 100%)` +// Day + short month for the boarding pass / cards, e.g. { d: '10', m: 'Sep' }. +function splitDate(dateStr: string | null | undefined, locale: string): { d: string; m: string } | null { + if (!dateStr) return null + const date = new Date(dateStr + 'T00:00:00Z') + return { + d: date.toLocaleDateString(locale, { day: 'numeric', timeZone: 'UTC' }), + m: date.toLocaleDateString(locale, { month: 'short', timeZone: 'UTC' }), } - const onLeave = () => { - if (glareRef.current) glareRef.current.style.opacity = '0' - if (borderRef.current) borderRef.current.style.opacity = '0' - } - - return ( -
-
-
- {children} -
- ) } -// ── Spotlight Card (next upcoming trip) ───────────────────────────────────── -interface TripCardProps { - trip: DashboardTrip - onEdit?: (trip: DashboardTrip) => void - onCopy?: (trip: DashboardTrip) => void - onDelete?: (trip: DashboardTrip) => void - onArchive?: (id: number) => void - onClick: (trip: DashboardTrip) => void - t: (key: string, params?: Record) => string - locale: string - dark?: boolean +function buddyColor(seed: number): string { + const pairs = [ + ['#6366f1', '#8b5cf6'], ['#10b981', '#059669'], ['#f59e0b', '#d97706'], + ['#ec4899', '#be185d'], ['#0ea5e9', '#2563eb'], ['#14b8a6', '#0d9488'], + ] + const [a, b] = pairs[seed % pairs.length] + return `linear-gradient(135deg, ${a}, ${b})` } -function SpotlightStats({ trip, totalDays, t }: { trip: DashboardTrip; totalDays: number; t: TripCardProps['t'] }): React.ReactElement { - const days = useCountUp(trip.day_count || totalDays) - const places = useCountUp(trip.place_count || 0) - const buddies = useCountUp(trip.shared_count || 0) - return ( -
-
-

{days}

-

{t('dashboard.mobile.days')}

-
-
-

{places}

-

{t('dashboard.mobile.places')}

-
-
-

{buddies}

-

{t('dashboard.mobile.buddies')}

-
-
- ) +function initials(name: string | null | undefined): string { + if (!name) return '?' + const parts = name.trim().split(/\s+/) + if (parts.length >= 2) return (parts[0][0] + parts[1][0]).toUpperCase() + return name.slice(0, 2).toUpperCase() } -function SpotlightCard({ trip, onEdit, onCopy, onDelete, onArchive, onClick, t, locale }: TripCardProps): React.ReactElement { - const status = getTripStatus(trip) - const isLive = status === 'ongoing' - const today = new Date().toISOString().split('T')[0] - const startDate = trip.start_date || today - const endDate = trip.end_date || today - const totalDays = Math.max(1, Math.ceil((new Date(endDate).getTime() - new Date(startDate).getTime()) / 86400000) + 1) - const currentDay = Math.min(totalDays, Math.ceil((new Date(today).getTime() - new Date(startDate).getTime()) / 86400000) + 1) - const daysLeft = Math.max(0, totalDays - currentDay) - const progress = Math.round((currentDay / totalDays) * 100) - - const badgeText = isLive ? t('dashboard.mobile.liveNow') - : status === 'today' ? t('dashboard.mobile.startsToday') - : status === 'tomorrow' ? t('dashboard.mobile.tomorrow') - : status === 'future' ? t('dashboard.status.daysLeft', { count: daysUntil(trip.start_date) }) - : status === 'past' ? t('dashboard.mobile.completed') - : null - - return ( -
onClick(trip)} - className="group relative rounded-3xl overflow-hidden cursor-pointer mb-8 transition-[transform,box-shadow] duration-300 ease-[cubic-bezier(0.23,1,0.32,1)] hover:-translate-y-1 hover:shadow-[0_16px_60px_rgba(0,0,0,0.22)] active:scale-[0.995]" - style={{ minHeight: 340, boxShadow: '0 8px 40px rgba(0,0,0,0.13)', isolation: 'isolate' }} - > - {/* Background */} -
- {trip.cover_image && ( - <> - -
- - )} -
-
- - {/* Content */} -
- {/* Top: badge + actions */} -
- {badgeText ? ( - - {isLive ? ( - - ) : ( - - )} - {badgeText} - - ) : } -
e.stopPropagation()}> - {onEdit && } - {onCopy && } - {onArchive && } - {onDelete && } -
-
- - {/* Title area — pushed to bottom */} -
- {!trip.is_owner && ( - - {t('dashboard.sharedBy', { name: trip.owner_username })} - - )} -

{trip.title}

-

- {formatDateShort(trip.start_date, locale)} — {formatDateShort(trip.end_date, locale)} - {isLive && <> · {t('journey.pdf.day')} {currentDay} / {totalDays}} -

-
- - {/* Progress bar — only for live trips */} - {isLive && ( -
-
- {t('dashboard.mobile.tripProgress')} - {t('dashboard.mobile.daysLeft', { count: daysLeft })} -
-
-
- -
-
-
- )} - - {/* Stats */} - -
-
- ) +interface Member { id: number; username: string; avatar_url?: string | null } +interface Place { id: number; name: string; image_url?: string | null } +interface HeroBundle { members: Member[]; places: Place[] } +interface TravelStats { totalTrips?: number; totalDays?: number; totalPlaces?: number; totalDistanceKm?: number; countries?: string[] } +interface UpcomingReservation { + id: number; trip_id: number; title: string; type: string + reservation_time?: string | null; day_date?: string | null + location?: string | null; place_name?: string | null; trip_title?: string | null } -// ── Mobile Trip Card (upcoming style) ──────────────────────────────────────── -function MobileTripCard({ trip, onEdit, onCopy, onDelete, onArchive, onClick, t, locale }: Omit): React.ReactElement { - const status = getTripStatus(trip) - const until = daysUntil(trip.start_date) - const duration = trip.start_date && trip.end_date - ? Math.ceil((new Date(trip.end_date).getTime() - new Date(trip.start_date).getTime()) / 86400000) + 1 - : trip.day_count || null - - const badgeText = status === 'ongoing' ? t('dashboard.mobile.ongoing') - : status === 'today' ? t('dashboard.mobile.startsToday') - : status === 'tomorrow' ? t('dashboard.mobile.tomorrow') - : until && until > 0 ? (until < 30 ? t('dashboard.mobile.inDays', { count: until }) : until < 365 ? t('dashboard.mobile.inMonths', { count: Math.round(until / 30) }) : `In ${Math.round(until / 365)}y`) - : status === 'past' ? t('dashboard.mobile.completed') - : null - - return ( -
onClick?.(trip)} - className="group rounded-2xl border border-zinc-200 dark:border-zinc-700 overflow-hidden cursor-pointer transition-[transform,box-shadow,border-color] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] hover:-translate-y-0.5 hover:shadow-md" - style={{ background: 'var(--bg-card)', isolation: 'isolate' }} - > - {/* Cover */} -
- {trip.cover_image && ( - - )} -
- - {/* Action buttons top-right */} -
- {onEdit && } - {onCopy && } - {onArchive && } - {onDelete && } -
- - {/* Countdown badge */} - {badgeText && ( -
- - {status === 'ongoing' ? ( - - ) : status === 'past' ? ( - - ) : ( - - )} - {badgeText} - -
- )} - - {/* Title on cover */} -
-

{trip.title}

- {trip.description && ( -

{trip.description}

- )} -
-
- - {/* Bottom stats */} -
-
- {trip.start_date && ( -
- {formatDateShort(trip.start_date, locale)} - {t('dashboard.mobile.starts')} -
- )} - {duration && ( -
- {duration} {duration === 1 ? t('dashboard.mobile.day') : t('dashboard.mobile.days')} - {t('dashboard.mobile.duration')} -
- )} -
- {trip.place_count || 0} - {t('dashboard.mobile.places')} -
- {(trip.shared_count || 0) > 0 && ( -
- {trip.shared_count} - {t('dashboard.mobile.buddies')} -
- )} -
-
-
- ) +const RES_ICON: Record = { + flight: , hotel: , restaurant: , } +const RES_TYPE_CLASS: Record = { flight: 'flight', hotel: 'hotel', restaurant: 'food' } -// ── Regular Trip Card (matches mobile card design) ────────────────────────── -function TripCard({ trip, onEdit, onCopy, onDelete, onArchive, onClick, t, locale }: Omit): React.ReactElement { - const status = getTripStatus(trip) - const until = daysUntil(trip.start_date) - const duration = trip.start_date && trip.end_date - ? Math.ceil((new Date(trip.end_date).getTime() - new Date(trip.start_date).getTime()) / 86400000) + 1 - : trip.day_count || null - - const badgeText = status === 'ongoing' ? t('dashboard.mobile.ongoing') - : status === 'today' ? t('dashboard.mobile.startsToday') - : status === 'tomorrow' ? t('dashboard.mobile.tomorrow') - : until && until > 0 ? (until < 30 ? t('dashboard.mobile.inDays', { count: until }) : until < 365 ? t('dashboard.mobile.inMonths', { count: Math.round(until / 30) }) : `In ${Math.round(until / 365)}y`) - : status === 'past' ? t('dashboard.mobile.completed') - : null - - return ( -
onClick(trip)} - className="group rounded-2xl border border-zinc-200 dark:border-zinc-700 overflow-hidden cursor-pointer transition-[transform,box-shadow,border-color] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] hover:-translate-y-0.5 hover:shadow-lg hover:border-zinc-300 dark:hover:border-zinc-600" - style={{ background: 'var(--bg-card)', isolation: 'isolate' }} - > - {/* Cover */} -
- {trip.cover_image && ( - - )} -
- - {/* Action buttons top-right — visible on hover */} -
- {onEdit && } - {onCopy && } - {onArchive && } - {onDelete && } -
- - {/* Status badge top-left */} - {badgeText && ( -
- - {status === 'ongoing' ? ( - - ) : status === 'past' ? ( - - ) : ( - - )} - {badgeText} - -
- )} - - {/* Shared badge */} - {!trip.is_owner && ( -
- - {t('dashboard.shared')} - -
- )} - - {/* Title on cover */} -
-

{trip.title}

- {trip.description && ( -

{trip.description}

- )} -
-
- - {/* Bottom stats */} -
-
- {trip.start_date && ( -
- {formatDateShort(trip.start_date, locale)} - {t('dashboard.mobile.starts')} -
- )} - {duration && ( -
- {duration} {duration === 1 ? t('dashboard.mobile.day') : t('dashboard.mobile.days')} - {t('dashboard.mobile.duration')} -
- )} -
- {trip.place_count || 0} - {t('dashboard.mobile.places')} -
- {(trip.shared_count || 0) > 0 && ( -
- {trip.shared_count} - {t('dashboard.mobile.buddies')} -
- )} -
-
-
- ) -} - -// ── List View Item ────────────────────────────────────────────────────────── -function TripListItem({ trip, onEdit, onCopy, onDelete, onArchive, onClick, t, locale }: Omit): React.ReactElement { - const status = getTripStatus(trip) - const [hovered, setHovered] = useState(false) - - const coverBg = trip.cover_image - ? `url(${trip.cover_image}) center/cover no-repeat` - : tripGradient(trip.id) - - return ( -
setHovered(true)} - onMouseLeave={() => setHovered(false)} - onClick={() => onClick(trip)} - style={{ - display: 'flex', alignItems: 'center', gap: 14, padding: '10px 16px', - background: hovered ? 'var(--bg-tertiary)' : 'var(--bg-card)', borderRadius: 14, - border: `1px solid ${hovered ? 'var(--text-faint)' : 'var(--border-primary)'}`, - cursor: 'pointer', transition: 'all 0.15s', - boxShadow: hovered ? '0 4px 16px rgba(0,0,0,0.08)' : '0 1px 3px rgba(0,0,0,0.03)', - }} - > - {/* Cover thumbnail */} -
- {status === 'ongoing' && ( - - )} -
- - {/* Title & description */} -
-
- - {trip.title} - - {!trip.is_owner && ( - - {t('dashboard.shared')} - - )} - {status && ( - - {status === 'ongoing' ? t('dashboard.status.ongoing') - : status === 'today' ? t('dashboard.status.today') - : status === 'tomorrow' ? t('dashboard.status.tomorrow') - : status === 'future' ? t('dashboard.status.daysLeft', { count: daysUntil(trip.start_date) }) - : t('dashboard.mobile.completed')} - - )} -
- {trip.description && ( -

- {trip.description} -

- )} -
- - {/* Date & stats */} -
- {trip.start_date && ( -
- - {formatDateShort(trip.start_date, locale)} - {trip.end_date && <> — {formatDateShort(trip.end_date, locale)}} -
- )} -
- {trip.day_count || 0} -
-
- {trip.place_count || 0} -
-
- {trip.shared_count || 0} -
-
- - {/* Actions */} - {(onEdit || onCopy || onArchive || onDelete) && ( -
e.stopPropagation()}> - {onEdit && onEdit(trip)} icon={} label="" />} - {onCopy && onCopy(trip)} icon={} label="" />} - {onArchive && onArchive(trip.id)} icon={} label="" />} - {onDelete && onDelete(trip)} icon={} label="" danger />} -
- )} -
- ) -} - -// ── Archived Trip Row ──────────────────────────────────────────────────────── -interface ArchivedRowProps { - trip: DashboardTrip - onEdit?: (trip: DashboardTrip) => void - onCopy?: (trip: DashboardTrip) => void - onUnarchive?: (id: number) => void - onDelete?: (trip: DashboardTrip) => void - onClick: (trip: DashboardTrip) => void - t: (key: string, params?: Record) => string - locale: string -} - -function ArchivedRow({ trip, onEdit, onCopy, onUnarchive, onDelete, onClick, t, locale }: ArchivedRowProps): React.ReactElement { - return ( -
onClick(trip)} style={{ - display: 'flex', alignItems: 'center', gap: 12, padding: '10px 16px', - borderRadius: 12, border: '1px solid var(--border-faint)', background: 'var(--bg-card)', cursor: 'pointer', - transition: 'border-color 0.12s', - }} - onMouseEnter={e => e.currentTarget.style.borderColor = 'var(--border-primary)'} - onMouseLeave={e => e.currentTarget.style.borderColor = 'var(--border-faint)'}> - {/* Mini cover */} -
-
-
- {trip.title} - {!trip.is_owner && {t('dashboard.shared')}} -
- {trip.start_date && ( -
- {formatDateShort(trip.start_date, locale)}{trip.end_date ? ` — ${formatDateShort(trip.end_date, locale)}` : ''} -
- )} -
- {(onEdit || onCopy || onUnarchive || onDelete) && ( -
e.stopPropagation()}> - {onCopy && } - {onUnarchive && } - {onDelete && } -
- )} -
- ) -} - -// ── Helpers ────────────────────────────────────────────────────────────────── -function Stat({ value, label }: { value: number | string; label: string }): React.ReactElement { - return ( -
- {value} - {label} -
- ) -} - -function CardAction({ onClick, icon, label, danger }: { onClick: () => void; icon: React.ReactNode; label: string; danger?: boolean }): React.ReactElement { - return ( - - ) -} - -function IconBtn({ onClick, title, danger, loading, children }: { onClick: () => void; title: string; danger?: boolean; loading?: boolean; children: React.ReactNode }): React.ReactElement { - return ( - - ) -} - -// ── Skeleton ───────────────────────────────────────────────────────────────── -function SkeletonCard(): React.ReactElement { - return ( -
-
-
-
-
-
-
- ) -} - -// ── Main Page ──────────────────────────────────────────────────────────────── export default function DashboardPage(): React.ReactElement { const [trips, setTrips] = useState([]) const [archivedTrips, setArchivedTrips] = useState([]) const [isLoading, setIsLoading] = useState(true) const [showForm, setShowForm] = useState(false) const [editingTrip, setEditingTrip] = useState(null) - const [showArchived, setShowArchived] = useState(false) - const [showWidgetSettings, setShowWidgetSettings] = useState(false) const [viewMode, setViewMode] = useState<'grid' | 'list'>(() => (localStorage.getItem('trek_dashboard_view') as 'grid' | 'list') || 'grid') const [deleteTrip, setDeleteTrip] = useState(null) const [copyTrip, setCopyTrip] = useState(null) + const [tripFilter, setTripFilter] = useState<'planned' | 'archive' | 'completed'>('planned') + + const [stats, setStats] = useState(null) + const [upcoming, setUpcoming] = useState([]) + const [heroBundle, setHeroBundle] = useState(null) + + const navigate = useNavigate() + const [searchParams, setSearchParams] = useSearchParams() + const toast = useToast() + const { t, locale } = useTranslation() + const { demoMode } = useAuthStore() const toggleViewMode = () => { setViewMode(prev => { @@ -710,28 +153,6 @@ export default function DashboardPage(): React.ReactElement { }) } - const navigate = useNavigate() - const [searchParams, setSearchParams] = useSearchParams() - const toast = useToast() - const { t, locale } = useTranslation() - const { demoMode, user } = useAuthStore() - const { settings, updateSetting } = useSettingsStore() - const can = useCanDo() - const dm = settings.dark_mode - const dark = dm === true || dm === 'dark' || (dm === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) - const showCurrency = settings.dashboard_currency !== 'off' - const showTimezone = settings.dashboard_timezone !== 'off' - const showSidebar = showCurrency || showTimezone - - useEffect(() => { - if (showWidgetSettings === 'mobile' || showWidgetSettings === 'mobile-currency' || showWidgetSettings === 'mobile-timezone') { - document.body.style.overflow = 'hidden' - } else { - document.body.style.overflow = '' - } - return () => { document.body.style.overflow = '' } - }, [showWidgetSettings]) - useEffect(() => { if (searchParams.get('create') === '1') { setShowForm(true) @@ -741,6 +162,13 @@ export default function DashboardPage(): React.ReactElement { useEffect(() => { loadTrips() }, []) + // Travel stats + upcoming reservations power the atlas row and the sidebar. + // Both are best-effort: a failure just leaves that section empty. + useEffect(() => { + authApi.travelStats().then(setStats).catch(() => {}) + reservationsApi.upcoming().then((r: { reservations: UpcomingReservation[] }) => setUpcoming(r.reservations || [])).catch(() => {}) + }, []) + const loadTrips = async () => { setIsLoading(true) try { @@ -754,7 +182,25 @@ export default function DashboardPage(): React.ReactElement { } } - const handleCreate = async (tripData) => { + const today = new Date().toISOString().split('T')[0] + const spotlight = trips.find(t => t.start_date && t.end_date && t.start_date <= today && t.end_date >= today) + || trips.find(t => t.start_date && t.start_date >= today) + || trips[0] + || null + const rest = spotlight ? trips.filter(t => t.id !== spotlight.id) : trips + + // Pull the spotlight trip's members + places so the boarding pass can show + // real buddies and place thumbnails instead of placeholders. + useEffect(() => { + if (!spotlight) { setHeroBundle(null); return } + let cancelled = false + tripsApi.bundle(spotlight.id) + .then((b: HeroBundle) => { if (!cancelled) setHeroBundle({ members: b.members || [], places: b.places || [] }) }) + .catch(() => { if (!cancelled) setHeroBundle(null) }) + return () => { cancelled = true } + }, [spotlight?.id]) + + const handleCreate = async (tripData: Record) => { try { const data = await tripsApi.create(tripData) setTrips(prev => sortTrips([data.trip, ...prev])) @@ -765,7 +211,8 @@ export default function DashboardPage(): React.ReactElement { } } - const handleUpdate = async (tripData) => { + const handleUpdate = async (tripData: Record) => { + if (!editingTrip) return try { const data = await tripsApi.update(editingTrip.id, tripData) setTrips(prev => sortTrips(prev.map(t => t.id === editingTrip.id ? data.trip : t))) @@ -775,7 +222,6 @@ export default function DashboardPage(): React.ReactElement { } } - const handleDelete = (trip) => setDeleteTrip(trip) const confirmDelete = async () => { if (!deleteTrip) return try { @@ -789,7 +235,7 @@ export default function DashboardPage(): React.ReactElement { setDeleteTrip(null) } - const handleArchive = async (id) => { + const handleArchive = async (id: number) => { try { const data = await tripsApi.archive(id) setTrips(prev => prev.filter(t => t.id !== id)) @@ -800,7 +246,7 @@ export default function DashboardPage(): React.ReactElement { } } - const handleUnarchive = async (id) => { + const handleUnarchive = async (id: number) => { try { const data = await tripsApi.unarchive(id) setArchivedTrips(prev => prev.filter(t => t.id !== id)) @@ -811,14 +257,6 @@ export default function DashboardPage(): React.ReactElement { } } - const handleCoverUpdate = (tripId: number, coverImage: string | null): void => { - const update = (t: DashboardTrip) => t.id === tripId ? { ...t, cover_image: coverImage } : t - setTrips(prev => prev.map(update)) - setArchivedTrips(prev => prev.map(update)) - } - - const handleCopy = (trip: DashboardTrip) => setCopyTrip(trip) - const confirmCopy = async () => { if (!copyTrip) return try { @@ -831,406 +269,549 @@ export default function DashboardPage(): React.ReactElement { setCopyTrip(null) } - const today = new Date().toISOString().split('T')[0] - const spotlight = trips.find(t => t.start_date && t.end_date && t.start_date <= today && t.end_date >= today) - || trips.find(t => t.start_date && t.start_date >= today) - || trips[0] - || null - const rest = spotlight ? trips.filter(t => t.id !== spotlight.id) : trips + const gridTrips = tripFilter === 'archive' ? archivedTrips + : tripFilter === 'completed' ? rest.filter(t => getTripStatus(t) === 'past') + : rest.filter(t => getTripStatus(t) !== 'past') return ( -
+
{demoMode && }
-
- - {/* Mobile greeting header */} -
-
-

{new Date().getHours() < 12 ? t('dashboard.greeting.morning') : new Date().getHours() < 18 ? t('dashboard.greeting.afternoon') : t('dashboard.greeting.evening')}

-

{user?.username || t('nav.profile')}

-
-
- - -
-
- - {/* Mobile: Hero Trip (spotlight — ongoing or next upcoming) */} - {!isLoading && spotlight && ( -
- +
+ {spotlight && ( + { setEditingTrip(tr); setShowForm(true) } : undefined} - onCopy={can('trip_create') ? handleCopy : undefined} - onDelete={can('trip_delete', spotlight) ? handleDelete : undefined} - onArchive={can('trip_archive', spotlight) ? handleArchive : undefined} - onClick={tr => navigate(`/trips/${tr.id}`)} + bundle={heroBundle} + locale={locale} + onOpen={() => navigate(`/trips/${spotlight.id}`)} + onEdit={() => { setEditingTrip(spotlight); setShowForm(true) }} + onCopy={() => setCopyTrip(spotlight)} + onArchive={() => spotlight.is_archived ? handleUnarchive(spotlight.id) : handleArchive(spotlight.id)} + onDelete={() => setDeleteTrip(spotlight)} /> -
- )} - - {/* Mobile: Quick Actions */} -
- {can('trip_create') && ( - )} - - -
- {/* Desktop header — unified toolbar */} -
-
-

- {t('dashboard.title')} -

-
- - {isLoading ? t('common.loading') - : trips.length > 0 ? `${t(trips.length !== 1 ? 'dashboard.subtitle.activeMany' : 'dashboard.subtitle.activeOne', { count: trips.length })}${archivedTrips.length > 0 ? t('dashboard.subtitle.archivedSuffix', { count: archivedTrips.length }) : ''}` - : t('dashboard.subtitle.empty')} - + -
- - - {can('trip_create') && ( - + + +
+ - )} + +
-
-
- {/* Widget settings dropdown */} - {showWidgetSettings && ( -
- Widgets: - - -
- )} - - {/* Mobile widgets button — replaced by Quick Actions */} - -
- {/* Main content */} -
- - {/* Loading skeletons */} - {isLoading && ( - <> -
-
- {[1, 2, 3].map(i => )} -
- - )} - - {/* Empty state */} - {!isLoading && trips.length === 0 && ( -
-
- -
-

{t('dashboard.emptyTitle')}

-

- {t('dashboard.emptyText')} -

- {can('trip_create') && } -
- )} - - {/* Spotlight (grid mode, desktop only — mobile has Live Hero) */} - {!isLoading && spotlight && viewMode === 'grid' && ( -
{ setEditingTrip(tr); setShowForm(true) } : undefined} - onCopy={can('trip_create') ? handleCopy : undefined} - onDelete={can('trip_delete', spotlight) ? handleDelete : undefined} - onArchive={can('trip_archive', spotlight) ? handleArchive : undefined} - onClick={tr => navigate(`/trips/${tr.id}`)} - />
- )} - - {/* Trips — mobile cards */} - {!isLoading && rest.length > 0 && ( -
-
- - {rest.some(t => getTripStatus(t) === 'future' || getTripStatus(t) === 'tomorrow') ? t('dashboard.mobile.upcomingTrips') : t('dashboard.mobile.yourTrips')} - - {rest.length} {t('dashboard.mobile.trips')} -
- {rest.map(trip => ( - { setEditingTrip(tr); setShowForm(true) } : undefined} - onCopy={can('trip_create') ? handleCopy : undefined} - onDelete={can('trip_delete', trip) ? handleDelete : undefined} - onArchive={can('trip_archive', trip) ? handleArchive : undefined} - onClick={tr => navigate(`/trips/${tr.id}`)} - /> - ))} -
- )} - - {/* Trips — desktop grid or list */} - {!isLoading && (viewMode === 'grid' ? rest : trips).length > 0 && ( - viewMode === 'grid' ? ( -
- {rest.map(trip => ( +
+ {gridTrips.map(trip => ( { setEditingTrip(tr); setShowForm(true) } : undefined} - onCopy={can('trip_create') ? handleCopy : undefined} - onDelete={can('trip_delete', trip) ? handleDelete : undefined} - onArchive={can('trip_archive', trip) ? handleArchive : undefined} - onClick={tr => navigate(`/trips/${tr.id}`)} + locale={locale} + onOpen={() => navigate(`/trips/${trip.id}`)} + onEdit={() => { setEditingTrip(trip); setShowForm(true) }} + onCopy={() => setCopyTrip(trip)} + onArchive={() => trip.is_archived ? handleUnarchive(trip.id) : handleArchive(trip.id)} + onDelete={() => setDeleteTrip(trip)} /> ))} + {tripFilter === 'planned' && !isLoading && ( + + )}
- ) : ( -
- {trips.map(trip => ( - { setEditingTrip(tr); setShowForm(true) } : undefined} - onCopy={can('trip_create') ? handleCopy : undefined} - onDelete={can('trip_delete', trip) ? handleDelete : undefined} - onArchive={can('trip_archive', trip) ? handleArchive : undefined} - onClick={tr => navigate(`/trips/${tr.id}`)} - /> - ))} -
- ) - )} - - {/* Archived section */} - {!isLoading && archivedTrips.length > 0 && ( -
- - {showArchived && ( -
- {archivedTrips.map(trip => ( - { setEditingTrip(tr); setShowForm(true) } : undefined} - onCopy={can('trip_create') ? handleCopy : undefined} - onUnarchive={can('trip_archive', trip) ? handleUnarchive : undefined} - onDelete={can('trip_delete', trip) ? handleDelete : undefined} - onClick={tr => navigate(`/trips/${tr.id}`)} - /> - ))} -
- )} -
- )} +
- {/* Widgets sidebar */} - {showSidebar && ( -
- {showCurrency && } - {showTimezone && } -
- )} -
-
+ +
- {/* Mobile widgets bottom sheet */} - {(showWidgetSettings === 'mobile' || showWidgetSettings === 'mobile-currency' || showWidgetSettings === 'mobile-timezone') && ( -
setShowWidgetSettings(false)}> -
e.stopPropagation()}> -
-
-
-
- - {showWidgetSettings === 'mobile-currency' ? t('dashboard.mobile.currencyConverter') : showWidgetSettings === 'mobile-timezone' ? t('dashboard.mobile.timezone') : t('common.settings')} - - -
-
- {(showWidgetSettings === 'mobile' || showWidgetSettings === 'mobile-currency') && } - {(showWidgetSettings === 'mobile' || showWidgetSettings === 'mobile-timezone') && } -
-
-
+ + + {showForm && ( + { setShowForm(false); setEditingTrip(null) }} + onSave={editingTrip ? handleUpdate : handleCreate} + onCoverUpdate={(tripId, coverUrl) => setTrips(prev => prev.map(t => t.id === tripId ? { ...t, cover_image: coverUrl } : t))} + /> + )} + {deleteTrip && ( + setDeleteTrip(null)} + danger + /> + )} + {copyTrip && ( + setCopyTrip(null)} + /> + )} +
+ ) +} + +// ── Boarding-pass hero ─────────────────────────────────────────────────────── +function BoardingPassHero({ trip, bundle, locale, onOpen, onEdit, onCopy, onArchive, onDelete }: { + trip: DashboardTrip; bundle: HeroBundle | null; locale: string; onOpen: () => void + onEdit: () => void; onCopy: () => void; onArchive: () => void; onDelete: () => void +}): React.ReactElement { + const stop = (e: React.MouseEvent, fn: () => void) => { e.stopPropagation(); fn() } + const status = getTripStatus(trip) + const start = splitDate(trip.start_date, locale) + const end = splitDate(trip.end_date, locale) + const dayCount = trip.day_count || (trip.start_date && trip.end_date + ? Math.round((new Date(trip.end_date).getTime() - new Date(trip.start_date).getTime()) / MS_PER_DAY) + 1 + : null) + + const until = daysUntil(trip.start_date) + const ongoing = status === 'ongoing' + let ringFraction = 0 + let countdownNumber = '' + let countdownLabel = '' + if (ongoing && trip.end_date) { + const todayMid = new Date(); todayMid.setHours(0, 0, 0, 0) + const endMid = new Date(trip.end_date + 'T00:00:00') + const daysLeft = Math.max(0, Math.round((endMid.getTime() - todayMid.getTime()) / MS_PER_DAY)) + // Ring tracks progress through the trip; the number shows what's left. + if (trip.start_date && dayCount) { + const elapsed = Math.round((Date.now() - new Date(trip.start_date + 'T00:00:00').getTime()) / MS_PER_DAY) + 1 + ringFraction = Math.min(1, Math.max(0.04, elapsed / dayCount)) + } else { + ringFraction = 0.5 + } + countdownNumber = String(daysLeft) + countdownLabel = daysLeft === 0 ? 'Last day' : daysLeft === 1 ? 'Day left' : 'Days left' + } else if (until !== null && until >= 0) { + // Closer trips fill more of the ring (1-year horizon). + ringFraction = Math.min(1, Math.max(0.04, 1 - until / 365)) + countdownNumber = String(until) + countdownLabel = until === 1 ? 'Day left' : 'Days left' + } + const RING_LEN = 170 + const dashOffset = RING_LEN * (1 - ringFraction) + + const members = bundle?.members || [] + const places = (bundle?.places || []).filter(p => p.image_url) + const buddyCount = trip.shared_count != null ? trip.shared_count + 1 : members.length + const placeCount = trip.place_count || (bundle?.places.length ?? 0) + + const badge = status === 'ongoing' ? 'LIVE NOW' + : status === 'today' ? 'STARTS TODAY' + : status === 'tomorrow' ? 'TOMORROW' + : status === 'future' ? 'UP NEXT' + : 'RECENT' + + return ( +
+ {trip.cover_image + ? {trip.title} + :
} +
+
+
+
+ {status === 'ongoing' && } + {badge} +
+
+ + + + +
+
+ +
+

{trip.title}

+
+ +
{ e.stopPropagation(); onOpen() }}> +
+
Buddies
+
+ {members.slice(0, 4).map((m, i) => ( + m.avatar_url + ? {m.username} + :
{initials(m.username)}
+ ))} + {members.length > 4 &&
+{members.length - 4}
} + {members.length === 0 &&
{initials(trip.owner_username)}
} +
+
{buddyCount} {buddyCount === 1 ? 'traveler' : 'travelers'}
+
+ +
+
Trip dates
+
+ {start ?
{start.d}
{start.m}
+ :
} +
+ {end ?
{end.d}
{end.m}
+ :
} +
+
{dayCount ? `${dayCount} ${dayCount === 1 ? 'day' : 'days'}` : 'No dates set'}
+
+ +
+ {countdownNumber && ( + <> +
+ + + + + +
{Math.round(ringFraction * 100)}%
+
+
+
{countdownNumber}
+
{countdownLabel}
+
+ + )} +
+ +
+
Places
+
+ {places.slice(0, 4).map(p => ( + {p.name} + ))} + {places.length === 0 &&
} + {placeCount > 4 &&
+{placeCount - 4}
} +
+
{placeCount} {placeCount === 1 ? 'destination' : 'destinations'}
+
+
+
+
+ ) +} + +// ── Atlas / stats row ──────────────────────────────────────────────────────── +function AtlasStats({ stats }: { stats: TravelStats | null }): React.ReactElement { + const countries = stats?.countries || [] + const distanceKm = stats?.totalDistanceKm || 0 + const distanceText = distanceKm >= 1000 ? `${(distanceKm / 1000).toFixed(1)}k` : String(distanceKm) + const equatorTimes = (distanceKm / 40075).toFixed(2) + + return ( +
+
+
Atlas · Countries visited
+
{countries.length} of 195
+
+ {countries.slice(0, 5).map((c, i) => ( + + {c} + + ))} + {countries.length > 5 && +{countries.length - 5}} +
+
+
+ +
+
Trips total
+
{stats?.totalTrips ?? 0}
+
{stats?.totalPlaces ?? 0} places mapped
+ + + +
+ +
+
Days traveled
+
{stats?.totalDays ?? 0} days
+
across all trips
+ + + +
+ +
+
Distance flown
+
{distanceText} km
+
≈ {equatorTimes}× around the equator
+ + + + +
+
+ ) +} + +// ── Trip card ──────────────────────────────────────────────────────────────── +function TripCard({ trip, locale, onOpen, onEdit, onCopy, onArchive, onDelete }: { + trip: DashboardTrip; locale: string; onOpen: () => void + onEdit: () => void; onCopy: () => void; onArchive: () => void; onDelete: () => void +}): React.ReactElement { + const status = getTripStatus(trip) + const start = splitDate(trip.start_date, locale) + const end = splitDate(trip.end_date, locale) + const until = daysUntil(trip.start_date) + + const statusClass = status === 'ongoing' ? '' : status === 'past' ? 'completed' : status === 'future' || status === 'today' || status === 'tomorrow' ? 'upcoming' : 'idea' + const statusLabel = status === 'ongoing' ? 'Live now' + : status === 'today' ? 'Today' + : status === 'tomorrow' ? 'Tomorrow' + : status === 'future' && until !== null ? (until > 60 ? `In ${Math.round(until / 30)} months` : `In ${until} days`) + : status === 'past' ? 'Completed' + : 'Idea' + + const stop = (e: React.MouseEvent, fn: () => void) => { e.stopPropagation(); fn() } + + return ( +
+
+ {trip.cover_image + ? {trip.title} + :
} +
{statusLabel}
+
+ + + + +
+
+

{trip.title}

+
+
+
+
+ {start && end ? ( + <> + {start.m} {start.d} + + {end.m} {end.d} + + ) : No dates set} +
+
+
{trip.day_count ?? 0}Days
+
{trip.place_count ?? 0}Places
+
{trip.shared_count ?? 0}{trip.shared_count === 1 ? 'Buddy' : 'Buddies'}
+
+
+
+ ) +} + +// ── Currency tool (self-contained, mirrors the design's fx widget) ─────────── +const FX_FALLBACK = ['EUR', 'USD', 'GBP', 'CHF', 'JPY', 'CAD', 'AUD', 'CNY', 'SEK', 'NOK', 'DKK', 'PLN', 'CZK', 'HUF', 'TRY', 'THB', 'INR', 'BRL', 'MXN', 'ZAR'] + +function CurrencyTool(): React.ReactElement { + const [from, setFrom] = useState(() => localStorage.getItem('trek_fx_from') || 'EUR') + const [to, setTo] = useState(() => localStorage.getItem('trek_fx_to') || 'USD') + const [amount, setAmount] = useState('100') + const [rates, setRates] = useState | null>(null) + + const fetchRate = React.useCallback(() => { + fetch(`https://api.exchangerate-api.com/v4/latest/${from}`) + .then(r => r.json()) + .then(d => setRates(d.rates ?? null)) + .catch(() => setRates(null)) + }, [from]) + + useEffect(() => { fetchRate() }, [fetchRate]) + useEffect(() => { localStorage.setItem('trek_fx_from', from); localStorage.setItem('trek_fx_to', to) }, [from, to]) + + const currencies = rates ? Object.keys(rates).sort() : FX_FALLBACK + const ccyOptions = currencies.map(c => ({ value: c, label: c })) + const rate = rates?.[to] ?? null + const converted = rate != null ? (parseFloat(amount.replace(',', '.')) || 0) * rate : null + + const swap = () => { setFrom(to); setTo(from) } + + return ( +
+
+
Currency
+ +
+
+
+
From
+ setAmount(e.target.value)} inputMode="decimal" /> + +
+ +
+
To
+ + +
+
+
+ {rate != null ? `1 ${from} = ${rate.toFixed(4)} ${to}` : 'Rate unavailable'} +
+
+ ) +} + +// ── Timezone tool ──────────────────────────────────────────────────────────── +const DEFAULT_ZONES = ['Europe/London', 'Asia/Tokyo'] + +// Fallback for the rare browser without Intl.supportedValuesOf. +const FALLBACK_ZONES = [ + 'Europe/London', 'Europe/Paris', 'Europe/Berlin', 'Europe/Madrid', 'Europe/Moscow', + 'America/New_York', 'America/Chicago', 'America/Denver', 'America/Los_Angeles', 'America/Sao_Paulo', + 'Asia/Dubai', 'Asia/Kolkata', 'Asia/Bangkok', 'Asia/Shanghai', 'Asia/Tokyo', 'Asia/Singapore', + 'Australia/Sydney', 'Pacific/Auckland', 'UTC', +] + +function shortZone(tz: string): string { + const city = tz.split('/').pop() || tz + return city.replace(/_/g, ' ') +} + +function TimezoneTool({ locale }: { locale: string }): React.ReactElement { + const home = Intl.DateTimeFormat().resolvedOptions().timeZone + const [now, setNow] = useState(() => new Date()) + const [zones, setZones] = useState(() => { + try { + const raw = localStorage.getItem('trek_dashboard_tz') + if (raw) return JSON.parse(raw) + } catch { /* ignore malformed storage */ } + return [home, ...DEFAULT_ZONES] + }) + const [adding, setAdding] = useState(false) + + // A minute's resolution is plenty for clocks and keeps re-renders cheap. + useEffect(() => { + const id = setInterval(() => setNow(new Date()), 30000) + return () => clearInterval(id) + }, []) + + useEffect(() => { localStorage.setItem('trek_dashboard_tz', JSON.stringify(zones)) }, [zones]) + + const allZones = React.useMemo(() => { + const supported = (Intl as unknown as { supportedValuesOf?: (k: string) => string[] }).supportedValuesOf + try { return supported ? supported('timeZone') : FALLBACK_ZONES } catch { return FALLBACK_ZONES } + }, []) + + const tzOptions = allZones + .filter(z => !zones.includes(z)) + .map(z => ({ value: z, label: z.replace(/_/g, ' '), searchLabel: z })) + + const addZone = (tz: string) => { if (tz) setZones(prev => prev.includes(tz) ? prev : [...prev, tz]); setAdding(false) } + const removeZone = (tz: string) => setZones(prev => prev.filter(z => z !== tz)) + + const timeIn = (tz: string) => now.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: false, timeZone: tz }) + const offsetLabel = (tz: string) => { + const part = new Intl.DateTimeFormat(locale, { timeZone: tz, timeZoneName: 'short' }).formatToParts(now).find(p => p.type === 'timeZoneName') + return part?.value || '' + } + + return ( +
+
+
Timezones
+ +
+ {adding && ( +
+ +
+ )} +
+ {zones.map(tz => ( +
+
{shortZone(tz)[0]?.toUpperCase()}
+
+
{shortZone(tz)}
+
{offsetLabel(tz)}
+
+
{timeIn(tz)}
+ +
+ ))} + {zones.length === 0 && ( +
Noch keine weiteren Zeitzonen — über + hinzufügen
+ )} +
+
+ ) +} + +// ── Upcoming reservations tool ─────────────────────────────────────────────── +function UpcomingTool({ items, locale, onOpen }: { + items: UpcomingReservation[]; locale: string; onOpen: (tripId: number) => void +}): React.ReactElement { + return ( +
+
+
Upcoming reservations
+
+ {items.length === 0 ? ( +
Nothing booked yet.
+ ) : ( +
+ {items.map(r => { + const when = r.reservation_time || (r.day_date ? r.day_date + 'T00:00:00' : null) + const d = when ? new Date(when) : null + const dateStr = d ? splitDate(d.toISOString().slice(0, 10), locale) : null + const timeStr = r.reservation_time ? new Date(r.reservation_time).toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit' }) : null + const typeClass = RES_TYPE_CLASS[r.type] || 'other' + return ( +
onOpen(r.trip_id)}> +
{dateStr?.d ?? '–'}
{dateStr?.m ?? ''}
+
+
{r.title}
+
+ {timeStr && <> {timeStr} · } + {r.location || r.place_name || r.trip_title} +
+
+
{RES_ICON[r.type] || }
+
+ ) + })} +
)} - - { setShowForm(false); setEditingTrip(null) }} - onSave={editingTrip ? handleUpdate : handleCreate} - trip={editingTrip} - onCoverUpdate={handleCoverUpdate} - /> - - setDeleteTrip(null)} - onConfirm={confirmDelete} - title={t('common.delete')} - message={t('dashboard.confirm.delete', { title: deleteTrip?.title || '' })} - /> - - setCopyTrip(null)} - onConfirm={confirmCopy} - /> - -
) } diff --git a/client/src/styles/dashboard.css b/client/src/styles/dashboard.css new file mode 100644 index 00000000..e1b0ab21 --- /dev/null +++ b/client/src/styles/dashboard.css @@ -0,0 +1,505 @@ +/* ============================================================================ + Dashboard rework — design tokens + layout. + Ported pixel-for-pixel from the design handoff (Dashboard.html) and scoped + under .trek-dash so none of it leaks into the rest of the app. The light + palette is the design's original; the dark block keeps the exact geometry + (radii, spacing, shadow structure) and only swaps colour values so the page + still feels at home when TREK's dark mode is on. + ============================================================================ */ + +.trek-dash { + /* warm light palette (design original) */ + --bg: #f8fafc; + --bg-2: oklch(0.965 0.01 70); + --surface: #ffffff; + --surface-2: oklch(0.985 0.006 78); + --ink: oklch(0.22 0.012 65); + --ink-2: oklch(0.42 0.012 65); + --ink-3: oklch(0.62 0.01 65); + --line: oklch(0.92 0.008 70); + --line-2: oklch(0.88 0.01 70); + --accent: oklch(0.66 0.17 38); + --accent-ink: oklch(0.32 0.13 38); + --accent-soft: oklch(0.95 0.04 50); + --success: oklch(0.58 0.12 155); + --warn: oklch(0.74 0.14 75); + + --sh-xs: 0 1px 0 oklch(0.92 0.01 70 / .6), 0 1px 2px oklch(0.4 0.02 60 / .04); + --sh-sm: 0 1px 2px oklch(0.4 0.02 60 / .04), 0 2px 6px oklch(0.4 0.02 60 / .05); + --sh-md: 0 1px 2px oklch(0.4 0.02 60 / .05), 0 8px 24px -8px oklch(0.3 0.02 60 / .14); + --sh-lg: 0 2px 4px oklch(0.4 0.02 60 / .06), 0 20px 50px -16px oklch(0.25 0.04 60 / .26); + + --r-xs: 10px; + --r-sm: 14px; + --r-md: 18px; + --r-lg: 22px; + --r-xl: 28px; + --r-2xl: 32px; + + background: var(--bg); + color: var(--ink); + font-family: "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif; + font-feature-settings: "ss01", "cv11"; + letter-spacing: -0.005em; + min-height: 100%; +} + +/* dark variant — same geometry, dark surfaces, accent kept */ +.dark .trek-dash { + --bg: oklch(0.17 0.012 65); + --bg-2: oklch(0.21 0.012 65); + --surface: oklch(0.225 0.012 65); + --surface-2: oklch(0.255 0.012 65); + --ink: oklch(0.96 0.006 70); + --ink-2: oklch(0.78 0.008 70); + --ink-3: oklch(0.6 0.008 70); + --line: oklch(0.32 0.01 65); + --line-2: oklch(0.38 0.012 65); + --accent: oklch(0.7 0.16 40); + --accent-ink: oklch(0.82 0.13 50); + --accent-soft: oklch(0.32 0.07 45); + --success: oklch(0.7 0.13 155); + --warn: oklch(0.78 0.14 75); + + --sh-xs: 0 1px 0 oklch(0 0 0 / .4), 0 1px 2px oklch(0 0 0 / .3); + --sh-sm: 0 1px 2px oklch(0 0 0 / .3), 0 2px 6px oklch(0 0 0 / .35); + --sh-md: 0 1px 2px oklch(0 0 0 / .35), 0 8px 24px -8px oklch(0 0 0 / .5); + --sh-lg: 0 2px 4px oklch(0 0 0 / .4), 0 20px 50px -16px oklch(0 0 0 / .7); +} + +.trek-dash * { box-sizing: border-box; } +.trek-dash .mono { font-family: "Poppins", -apple-system, BlinkMacSystemFont, system-ui, sans-serif; font-feature-settings: "tnum"; } +.trek-dash button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; } +.trek-dash a { color: inherit; text-decoration: none; } + +/* ----------------- layout ----------------- */ +.trek-dash .page { + max-width: 1800px; + margin: 0 auto; + padding: 40px 48px 96px; + display: grid; + grid-template-columns: 1fr 400px; + gap: 48px; + align-items: start; +} +.trek-dash .page-main { min-width: 0; } +.trek-dash .page-sidebar { + position: sticky; + top: 24px; + display: flex; + flex-direction: column; + gap: 20px; +} + +/* ----------------- greeting ----------------- */ +.trek-dash .greeting { + display: grid; + grid-template-columns: 1fr auto; + align-items: end; + gap: 32px; + margin-bottom: 36px; +} +.trek-dash .greeting-kicker { + display: inline-flex; align-items: center; gap: 10px; + font-size: 12px; text-transform: uppercase; letter-spacing: 0.16em; + color: var(--ink-3); font-weight: 500; margin-bottom: 14px; +} +.trek-dash .greeting-kicker .live-dot { + width: 6px; height: 6px; border-radius: 50%; + background: var(--accent); box-shadow: 0 0 0 4px oklch(0.66 0.17 38 / .14); +} +.trek-dash .hello { + font-size: 56px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.02; margin: 0; +} +.trek-dash .hello .accent { color: var(--accent-ink); font-weight: 600; } +.trek-dash .hello-sub { margin-top: 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } +.trek-dash .meta-chip { + display: inline-flex; align-items: center; gap: 8px; + padding: 8px 14px 8px 10px; background: var(--surface); + border-radius: 999px; font-size: 13px; color: var(--ink-2); + font-weight: 500; box-shadow: var(--sh-sm); +} +.trek-dash .meta-chip strong { color: var(--ink); font-weight: 600; } +.trek-dash .meta-chip .ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; } +.trek-dash .meta-chip .ico svg { width: 12px; height: 12px; } +.trek-dash .meta-chip .ico.sun { background: linear-gradient(135deg, oklch(0.85 0.13 85), oklch(0.72 0.16 55)); } +.trek-dash .meta-chip .ico.trip { background: linear-gradient(135deg, oklch(0.7 0.16 38), oklch(0.55 0.14 25)); } + +.trek-dash .cta-stack { display: flex; gap: 10px; } +.trek-dash .btn { + display: inline-flex; align-items: center; gap: 8px; + padding: 12px 18px; border-radius: 12px; + font-size: 14px; font-weight: 500; + transition: transform .08s, box-shadow .15s, background .15s; +} +.trek-dash .btn:active { transform: translateY(1px); } +.trek-dash .btn-primary { + background: var(--ink); color: var(--bg); + box-shadow: var(--sh-md), inset 0 1px 0 oklch(1 0 0 / .12); +} +.trek-dash .btn-secondary { background: var(--surface); color: var(--ink); box-shadow: var(--sh-sm); } +.trek-dash .btn-secondary:hover { background: var(--surface-2); } + +/* ----------------- hero trip ----------------- */ +.trek-dash .hero-trip { + position: relative; border-radius: var(--r-2xl); overflow: hidden; cursor: pointer; + height: 520px; box-shadow: var(--sh-lg); margin-bottom: 56px; isolation: isolate; + transition: transform .35s cubic-bezier(0.23,1,0.32,1), box-shadow .35s cubic-bezier(0.23,1,0.32,1); +} +.trek-dash .hero-trip:hover { transform: translateY(-4px); box-shadow: var(--sh-xl, 0 24px 60px oklch(0 0 0 / .28)); } +.trek-dash .hero-trip img.bg { + position: absolute; inset: 0; width: 100%; height: 100%; + object-fit: cover; z-index: 0; transition: transform 12s ease-out; +} +.trek-dash .hero-trip:hover img.bg { transform: scale(1.04); } +.trek-dash .hero-trip .scrim { + position: absolute; inset: 0; z-index: 1; + background: + linear-gradient(180deg, oklch(0 0 0 / .35) 0%, oklch(0 0 0 / 0) 28%, oklch(0 0 0 / 0) 55%, oklch(0 0 0 / .45) 100%), + linear-gradient(90deg, oklch(0 0 0 / .25) 0%, oklch(0 0 0 / 0) 55%); +} +.trek-dash .hero-content { + position: absolute; inset: 0; z-index: 2; padding: 32px 32px 26px; + display: grid; grid-template-rows: auto 1fr auto; color: #fff; +} +.trek-dash .hero-top { display: flex; justify-content: space-between; align-items: start; } +.trek-dash .hero-badge { + display: inline-flex; align-items: center; gap: 8px; + background: oklch(1 0 0 / .14); + backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); + border: 1px solid oklch(1 0 0 / .2); padding: 8px 14px 8px 12px; + border-radius: 999px; font-size: 12px; font-weight: 500; + letter-spacing: 0.06em; text-transform: uppercase; +} +.trek-dash .hero-badge .pulse { + width: 7px; height: 7px; border-radius: 50%; + background: oklch(0.84 0.18 85); box-shadow: 0 0 0 0 oklch(0.84 0.18 85 / .7); + animation: trek-dash-pulse 2s infinite; +} +@keyframes trek-dash-pulse { + 0% { box-shadow: 0 0 0 0 oklch(0.84 0.18 85 / .7); } + 70% { box-shadow: 0 0 0 8px oklch(0.84 0.18 85 / 0); } + 100% { box-shadow: 0 0 0 0 oklch(0.84 0.18 85 / 0); } +} +.trek-dash .hero-tools { display: flex; gap: 8px; } +.trek-dash .hero-tool { + width: 38px; height: 38px; border-radius: 50%; + background: oklch(1 0 0 / .14); + backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); + border: 1px solid oklch(1 0 0 / .2); color: #fff; + display: grid; place-items: center; transition: background .15s, transform .12s; +} +.trek-dash .hero-tool:hover { background: oklch(1 0 0 / .26); transform: scale(1.05); } +.trek-dash .hero-tool svg { width: 16px; height: 16px; } +.trek-dash .hero-title-block { align-self: end; padding-bottom: 24px; } +.trek-dash .hero-eyebrow { + display: inline-flex; align-items: center; gap: 10px; + font-size: 11.5px; letter-spacing: 0.22em; text-transform: uppercase; + opacity: .88; margin-bottom: 16px; font-weight: 500; +} +.trek-dash .hero-eyebrow::before { content: ""; width: 28px; height: 1px; background: oklch(1 0 0 / .6); } +.trek-dash .hero-title { font-size: 104px; font-weight: 600; line-height: 0.9; letter-spacing: -0.045em; margin: 0; } + +/* ----------------- boarding pass ----------------- */ +.trek-dash .hero-pass { + background: linear-gradient(135deg, + oklch(0.99 0.006 75 / .75) 0%, oklch(0.985 0.008 70 / .85) 50%, oklch(0.98 0.01 65 / .8) 100%); + backdrop-filter: blur(40px) saturate(1.8) brightness(1.1); + -webkit-backdrop-filter: blur(40px) saturate(1.8) brightness(1.1); + border-radius: 24px; border: 1px solid oklch(0.92 0.008 70 / .35); + display: grid; grid-template-columns: 1fr 1.5fr 1fr 1fr; align-items: stretch; + padding: 24px 16px 24px 28px; gap: 0; + box-shadow: + 0 2px 8px -2px oklch(0 0 0 / .08), 0 8px 24px -6px oklch(0 0 0 / .12), + 0 20px 60px -16px oklch(0 0 0 / .35), inset 0 1px 1px 0 oklch(1 0 0 / .5); + color: var(--ink); position: relative; overflow: hidden; + mask-image: + radial-gradient(circle 8px at 0 50%, transparent 8px, black 8px), + radial-gradient(circle 8px at 100% 50%, transparent 8px, black 8px); + mask-composite: intersect; + -webkit-mask-image: + radial-gradient(circle 8px at 0 50%, transparent 8px, black 8px), + radial-gradient(circle 8px at 100% 50%, transparent 8px, black 8px); + -webkit-mask-composite: source-in; + transform: translateZ(0); +} +.dark .trek-dash .hero-pass { + background: linear-gradient(135deg, oklch(0.28 0.012 65 / .8) 0%, oklch(0.25 0.012 65 / .85) 50%, oklch(0.23 0.012 65 / .8) 100%); + border: 1px solid oklch(1 0 0 / .1); + box-shadow: + 0 2px 8px -2px oklch(0 0 0 / .3), 0 8px 24px -6px oklch(0 0 0 / .4), + 0 20px 60px -16px oklch(0 0 0 / .6), inset 0 1px 1px 0 oklch(1 0 0 / .08); +} +.trek-dash .hero-pass::before { + content: ""; position: absolute; inset: 0; border-radius: 24px; padding: 1px; + background: linear-gradient(135deg, oklch(1 0 0 / .25) 0%, oklch(1 0 0 / .08) 40%, oklch(1 0 0 / .02) 70%, oklch(1 0 0 / .15) 100%); + -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); + -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; +} +.trek-dash .pass-cell { + padding: 4px 18px; position: relative; display: flex; flex-direction: column; + justify-content: center; align-items: center; text-align: center; gap: 6px; flex: 1; min-width: 0; +} +.trek-dash .pass-cell + .pass-cell::before { + content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 1px; + background-image: linear-gradient(to bottom, oklch(0.78 0.008 70) 50%, transparent 50%); + background-size: 1px 5px; +} +.dark .trek-dash .pass-cell + .pass-cell::before { + background-image: linear-gradient(to bottom, oklch(0.5 0.01 70) 50%, transparent 50%); +} +.trek-dash .pass-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-3); font-weight: 500; } +.trek-dash .pass-value { font-size: 32px; font-weight: 600; letter-spacing: -0.025em; color: var(--ink); line-height: 1; display: flex; align-items: baseline; gap: 6px; } +.trek-dash .pass-value .unit { font-size: 16px; color: var(--ink-3); font-weight: 500; letter-spacing: -0.005em; } +.trek-dash .pass-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 500; } +.trek-dash .pass-cell.dates-combined { gap: 10px; } +.trek-dash .dates-row { display: flex; align-items: center; gap: 12px; justify-content: center; } +.trek-dash .date-block { display: flex; flex-direction: column; align-items: center; gap: 2px; } +.trek-dash .date-num { font-size: 36px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; color: var(--ink); } +.trek-dash .date-month { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); } +.trek-dash .date-arrow { width: 24px; height: 24px; display: grid; place-items: center; margin: 0 4px; } +.trek-dash .date-arrow svg { width: 18px; height: 18px; color: var(--ink-2); opacity: 0.5; } + +.trek-dash .pass-cell.buddies, +.trek-dash .pass-cell.places { display: flex; flex-direction: column; justify-content: center; gap: 8px; } +.trek-dash .buddies-avatars, +.trek-dash .places-preview { display: flex; gap: 0; justify-content: center; align-items: center; } +.trek-dash .buddy-avatar { + width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; + font-size: 13px; font-weight: 700; color: white; + border: 2px solid oklch(0.985 0.008 75 / .95); margin-left: -8px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); +} +.trek-dash .buddy-avatar:first-child { margin-left: 0; } +.trek-dash .buddy-more, +.trek-dash .place-more { + width: 36px; height: 36px; border-radius: 50%; + background: oklch(0.92 0.008 70); border: 2px solid oklch(0.985 0.008 75 / .95); + display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--ink); + margin-left: -8px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); +} +.dark .trek-dash .buddy-avatar, +.dark .trek-dash .place-thumb, +.dark .trek-dash .buddy-more, +.dark .trek-dash .place-more { border-color: oklch(0.25 0.012 65 / .95); } +.dark .trek-dash .buddy-more, +.dark .trek-dash .place-more { background: oklch(0.32 0.01 70); } +.trek-dash .place-thumb { + width: 36px; height: 36px; border-radius: 50%; object-fit: cover; + border: 2px solid oklch(0.985 0.008 75 / .95); box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin-left: -8px; +} +.trek-dash .place-thumb:first-child { margin-left: 0; } + +.trek-dash .pass-cell.countdown { flex-direction: row; align-items: center; text-align: left; gap: 12px; } +.trek-dash .countdown-ring { position: relative; width: 64px; height: 64px; flex-shrink: 0; } +.trek-dash .countdown-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); } +.trek-dash .countdown-ring .track { stroke: oklch(0.92 0.01 70); stroke-width: 5; } +.dark .trek-dash .countdown-ring .track { stroke: oklch(0.4 0.01 70); } +.trek-dash .countdown-ring .fill { stroke: var(--ink); stroke-linecap: round; stroke-width: 5; } +.trek-dash .countdown-ring .glow { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; opacity: 0.15; filter: blur(3px); } +.trek-dash .countdown-ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; } +.trek-dash .countdown-info { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; } +.trek-dash .countdown-days { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); line-height: 1; } +.trek-dash .countdown-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); font-weight: 500; } + +/* ----------------- atlas / stats ----------------- */ +.trek-dash .atlas { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 56px; } +.trek-dash .atlas-card { + background: var(--surface); border-radius: var(--r-lg); padding: 24px 26px; + box-shadow: var(--sh-sm); position: relative; overflow: hidden; +} +.trek-dash .atlas-card .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); font-weight: 500; } +.trek-dash .atlas-card .value { font-size: 44px; font-weight: 600; letter-spacing: -0.035em; line-height: 1; margin-top: 16px; display: flex; align-items: baseline; gap: 8px; } +.trek-dash .atlas-card .value .unit { font-size: 17px; color: var(--ink-3); font-weight: 500; letter-spacing: -0.01em; } +.trek-dash .atlas-card .delta { margin-top: 12px; font-size: 12.5px; color: var(--ink-3); } +.trek-dash .atlas-card .delta .up { color: var(--success); font-weight: 500; } +.trek-dash .atlas-card.passport { + background: + linear-gradient(135deg, oklch(0.95 0.01 70 / .15) 0%, oklch(0.98 0.005 70 / .08) 50%, oklch(1 0 0 / .12) 100%), + linear-gradient(180deg, oklch(0.15 0.02 65), oklch(0.08 0.01 70)); + color: #fff; border: 1px solid oklch(1 0 0 / .12); + box-shadow: 0 8px 32px oklch(0 0 0 / .15), inset 0 1px 0 oklch(1 0 0 / .15), inset 0 -1px 0 oklch(0 0 0 / .3); + backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); +} +.trek-dash .atlas-card.passport .label { color: oklch(1 0 0 / .65); } +.trek-dash .atlas-card.passport .value { font-size: 56px; } +.trek-dash .atlas-card.passport .delta { color: oklch(1 0 0 / .65); } +.trek-dash .passport-flags { display: flex; margin-top: 18px; } +.trek-dash .flag { + width: 24px; height: 24px; border-radius: 50%; overflow: hidden; + background: oklch(0.4 0.06 60); border: 2px solid oklch(0.28 0.04 50); + margin-left: -8px; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; +} +.trek-dash .flag img { width: 100%; height: 100%; object-fit: cover; display: block; } +.trek-dash .flag:first-child { margin-left: 0; } +.trek-dash .flag.more { background: oklch(1 0 0 / .15); color: #fff; font-size: 10px; border: 2px solid oklch(0.28 0.04 50); } +.trek-dash .spark { position: absolute; right: 18px; bottom: 18px; opacity: .55; } +.trek-dash .spark polyline, +.trek-dash .spark path, +.trek-dash .spark circle:not([stroke]) { stroke: var(--ink); } + +/* ----------------- section heads ----------------- */ +.trek-dash .sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; margin-top: 8px; } +.trek-dash .sec-title { font-size: 28px; font-weight: 600; letter-spacing: -0.025em; margin: 0; display: flex; align-items: baseline; gap: 14px; } +.trek-dash .sec-title .count { font-size: 14px; color: var(--ink-3); font-weight: 500; letter-spacing: -0.005em; font-family: "Poppins", sans-serif; } +.trek-dash .sec-tools { display: flex; gap: 6px; align-items: center; } +.trek-dash .seg { display: flex; background: oklch(0.94 0.008 70); border-radius: 10px; padding: 3px; } +.dark .trek-dash .seg { background: var(--bg-2); } +.trek-dash .seg button { padding: 7px 14px; font-size: 13px; border-radius: 8px; color: var(--ink-2); font-weight: 500; transition: background .12s, color .12s; } +.trek-dash .seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-xs); } + +/* ----------------- trips grid ----------------- */ +.trek-dash .trips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-bottom: 56px; transition: all 0.3s ease; } +.trek-dash .trips.list-view { grid-template-columns: 1fr; gap: 12px; } +.trek-dash .trips.list-view .trip-card { display: grid; grid-template-columns: 520px 1fr; gap: 0; height: auto; } +.trek-dash .trips.list-view .trip-cover { border-radius: var(--r-lg) 0 0 var(--r-lg); height: 100px; aspect-ratio: unset; } +.trek-dash .trips.list-view .trip-body { display: flex; align-items: center; justify-content: space-between; padding: 20px 32px; gap: 48px; } +.trek-dash .trips.list-view .trip-meta { display: flex; gap: 32px; padding: 0; border: none; } +.trek-dash .trip-card { + position: relative; border-radius: var(--r-xl); overflow: hidden; background: var(--surface); + box-shadow: var(--sh-md); transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s; + cursor: pointer; isolation: isolate; +} +.trek-dash .trip-card:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); } +.trek-dash .trip-cover { position: relative; aspect-ratio: 4 / 3; overflow: hidden; } +.trek-dash .trip-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); } +.trek-dash .trip-card:hover .trip-cover img { transform: scale(1.04); } +.trek-dash .trip-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, oklch(0 0 0 / 0) 40%, oklch(0 0 0 / .55) 100%); } +.trek-dash .trip-status { + position: absolute; top: 16px; left: 16px; z-index: 1; + display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px 6px 9px; + border-radius: 999px; font-size: 11.5px; font-weight: 500; letter-spacing: 0.02em; + background: oklch(1 0 0 / .18); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); + border: 1px solid oklch(1 0 0 / .22); color: #fff; text-transform: uppercase; +} +.trek-dash .trip-status .indicator { width: 6px; height: 6px; border-radius: 50%; background: oklch(0.84 0.16 145); } +.trek-dash .trip-status.completed .indicator { background: oklch(0.75 0.02 220); } +.trek-dash .trip-status.upcoming .indicator { background: oklch(0.84 0.18 85); } +.trek-dash .trip-status.idea .indicator { background: oklch(0.78 0.14 280); } +.trek-dash .trip-actions { position: absolute; top: 14px; right: 14px; z-index: 1; display: flex; gap: 6px; opacity: 0; transition: opacity .2s; } +.trek-dash .trip-card:hover .trip-actions { opacity: 1; } +.trek-dash .trip-action-btn { + width: 36px; height: 36px; border-radius: 50%; + background: oklch(1 0 0 / .18); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); + border: 1px solid oklch(1 0 0 / .22); color: #fff; display: grid; place-items: center; transition: background .15s; +} +.trek-dash .trip-action-btn:hover { background: oklch(1 0 0 / .3); } +.trek-dash .trip-action-btn svg { width: 16px; height: 16px; } +.trek-dash .trip-cover-content { position: absolute; left: 18px; right: 18px; bottom: 16px; z-index: 1; color: #fff; } +.trek-dash .trip-name { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin: 0; } +.trek-dash .trip-where { margin-top: 4px; font-size: 13px; opacity: .85; display: flex; align-items: center; gap: 6px; } +.trek-dash .trip-where svg { width: 12px; height: 12px; opacity: .8; } +.trek-dash .trip-body { padding: 18px 20px 20px; } +.trek-dash .trip-dates { font-size: 13px; color: var(--ink); display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 14px; font-weight: 500; } +.trek-dash .trip-dates .date-num { font-size: 13px; font-weight: 400; color: var(--ink-3); } +.trek-dash .trip-dates .date-arrow { display: inline-flex; align-items: center; justify-content: center; opacity: 0.4; margin: 0 2px; line-height: 1; } +.trek-dash .trip-dates .date-arrow svg { width: 11px; height: 11px; display: block; } +.trek-dash .trip-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); } +.trek-dash .trip-meta div { display: flex; flex-direction: column; gap: 3px; text-align: center; } +.trek-dash .trip-meta .n { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; } +.trek-dash .trip-meta .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); font-weight: 500; } +.trek-dash .add-trip-card { + border-radius: var(--r-xl); border: 1.5px dashed var(--line-2); + background: oklch(0.97 0.008 75 / .5); display: grid; place-items: center; + text-align: center; padding: 32px; transition: background .15s, border-color .15s; cursor: pointer; min-height: 240px; +} +.dark .trek-dash .add-trip-card { background: oklch(0.22 0.01 65 / .5); } +.trek-dash .add-trip-card:hover { background: var(--surface-2); border-color: var(--ink); color: var(--ink); } +.trek-dash .add-trip-card .circ { + width: 48px; height: 48px; border-radius: 50%; background: #111827; color: #fff; + display: grid; place-items: center; margin: 0 auto 14px; box-shadow: var(--sh-sm); + transition: transform .4s cubic-bezier(0.34,1.56,0.64,1), background .15s; +} +.dark .trek-dash .add-trip-card .circ { background: #fff; color: #111827; } +.trek-dash .add-trip-card:hover .circ { transform: rotate(180deg) scale(1.08); } +.trek-dash .add-trip-card .ttl { font-size: 16px; font-weight: 500; margin-bottom: 4px; } +.trek-dash .add-trip-card .sub { font-size: 13px; color: var(--ink-3); } + +/* ----------------- tools sidebar ----------------- */ +.trek-dash .tool { background: var(--surface); border-radius: var(--r-xl); padding: 24px 26px; box-shadow: var(--sh-sm); } +.trek-dash .tool-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; } +.trek-dash .tool-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); font-weight: 500; display: flex; align-items: center; gap: 8px; } +.trek-dash .tool-title svg { width: 14px; height: 14px; } +.trek-dash .tool-action { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-3); transition: background .12s, color .12s; } +.trek-dash .tool-action:hover { background: var(--bg-2); color: var(--ink); } +.trek-dash .fx-input { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 8px; margin-bottom: 14px; } +.trek-dash .fx-field { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; } +.trek-dash .fx-field .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); font-weight: 500; } +.trek-dash .fx-field .amt { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; margin-top: 2px; background: none; border: 0; width: 100%; outline: none; color: var(--ink); font-family: "Poppins", sans-serif; font-feature-settings: "tnum"; } +.trek-dash .fx-field .ccy { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; } +.trek-dash .fx-swap { align-self: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; box-shadow: var(--sh-sm); transition: transform .2s; } +.trek-dash .fx-swap:hover { transform: rotate(180deg); } +.trek-dash .fx-swap svg { width: 14px; height: 14px; } +.trek-dash .fx-rate { font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; font-family: "Poppins", sans-serif; } +.trek-dash .fx-rate .delta { color: var(--success); } +.trek-dash .tz-list { display: flex; flex-direction: column; gap: 14px; } +.trek-dash .tz-row { display: grid; grid-template-columns: auto 1fr auto 24px; gap: 14px; align-items: center; } +.trek-dash .tz-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; color: var(--ink-2); font-size: 11px; font-weight: 600; } +.trek-dash .tz-city { font-size: 14px; font-weight: 500; } +.trek-dash .tz-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; } +.trek-dash .tz-time { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; font-family: "Poppins", sans-serif; font-feature-settings: "tnum"; } +.trek-dash .tz-del { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: var(--ink-3); opacity: 0; transition: opacity .12s, background .12s, color .12s; } +.trek-dash .tz-row:hover .tz-del { opacity: 1; } +.trek-dash .tz-del:hover { background: var(--bg-2); color: #ef4444; } +.trek-dash .tz-empty { font-size: 12px; color: var(--ink-3); } +.trek-dash .upc-list { display: flex; flex-direction: column; gap: 12px; } +.trek-dash .upc-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; padding: 12px; border-radius: 14px; align-items: center; transition: background .12s; cursor: pointer; } +.trek-dash .upc-item:hover { background: var(--surface-2); } +.trek-dash .upc-date { background: var(--surface-2); border-radius: 10px; padding: 8px 4px; text-align: center; } +.trek-dash .upc-date .d { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; } +.trek-dash .upc-date .m { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); margin-top: 4px; font-weight: 500; } +.trek-dash .upc-info .t { font-size: 14px; font-weight: 500; margin-bottom: 2px; } +.trek-dash .upc-info .s { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; } +.trek-dash .upc-info .s svg { width: 11px; height: 11px; } +.trek-dash .upc-type { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; } +.trek-dash .upc-type.flight { background: oklch(0.95 0.04 230); color: oklch(0.45 0.13 230); } +.trek-dash .upc-type.hotel { background: oklch(0.95 0.04 145); color: oklch(0.4 0.12 155); } +.trek-dash .upc-type.food { background: oklch(0.95 0.05 60); color: oklch(0.5 0.13 50); } +.trek-dash .upc-type.other { background: var(--bg-2); color: var(--ink-2); } +.trek-dash .upc-type svg { width: 16px; height: 16px; } + +/* ----------------- responsive ----------------- */ +@media (max-width: 1280px) { + .trek-dash .page { padding-left: 32px; padding-right: 32px; grid-template-columns: 1fr; } + .trek-dash .page-sidebar { position: static; flex-direction: row; flex-wrap: wrap; } + .trek-dash .page-sidebar .tool { flex: 1 1 300px; } + .trek-dash .hero-title { font-size: 72px; } + .trek-dash .trips { grid-template-columns: repeat(2, 1fr); } + .trek-dash .atlas { grid-template-columns: repeat(2, 1fr); } +} +@media (max-width: 720px) { + .trek-dash .page { padding: 24px 16px 96px; } + .trek-dash .greeting { grid-template-columns: 1fr; } + .trek-dash .hello { font-size: 40px; } + .trek-dash .hero-trip { height: 420px; } + .trek-dash .hero-title { font-size: 52px; } + .trek-dash .hero-pass { grid-template-columns: 1fr 1fr; gap: 16px 0; } + .trek-dash .trips { grid-template-columns: 1fr; } + .trek-dash .atlas { grid-template-columns: 1fr 1fr; } +} + +/* Floating action button — Neuer Trip */ +.trek-dash .fab-new-trip { + position: fixed; right: 28px; bottom: 28px; z-index: 150; + display: inline-flex; align-items: center; gap: 9px; + height: 56px; padding: 0 24px; border: none; border-radius: 999px; + cursor: pointer; background: #111827; color: #fff; + font-size: 15px; font-weight: 600; font-family: inherit; + box-shadow: 0 6px 16px oklch(0 0 0 / .22), 0 12px 30px oklch(0 0 0 / .18); + transition: transform .28s cubic-bezier(0.23,1,0.32,1), box-shadow .28s cubic-bezier(0.23,1,0.32,1); +} +.dark .trek-dash .fab-new-trip { background: #fff; color: #111827; } +.trek-dash .fab-new-trip:hover { + transform: translateY(-3px) scale(1.02); + box-shadow: 0 10px 24px oklch(0 0 0 / .3), 0 18px 44px oklch(0 0 0 / .22); +} +.trek-dash .fab-new-trip:active { transform: translateY(-1px) scale(.99); } +.trek-dash .fab-new-trip svg { flex-shrink: 0; } + +@media (max-width: 768px) { + /* collapse to a round button and lift above the bottom nav */ + .trek-dash .fab-new-trip { + right: 18px; bottom: calc(84px + env(safe-area-inset-bottom, 0px) + 16px); + width: 56px; padding: 0; justify-content: center; gap: 0; + } + .trek-dash .fab-new-trip .fab-label { display: none; } +}