import { useParams } from 'react-router-dom'; import { useSeoMeta } from '@unhead/react'; import { Card, CardContent } from '@/components/ui/card'; import { Skeleton } from '@/components/ui/skeleton'; import { LoginArea } from '@/components/auth/LoginArea'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useTour } from '@/hooks/useTours'; import { Route, AlertTriangle } from 'lucide-react'; import CreateTourPage from './CreateTourPage'; import NotFound from './NotFound'; import { useTranslation } from '@/contexts/language'; /** * Edit an existing tour. Loads the tour by pubkey + identifier and hands it to * CreateTourPage as `existing`, which prefills every field, reuses the same * addressable identifier, and preserves unmanaged tags on save. Only the tour's * owner may edit. */ export default function EditTourPage() { const { t } = useTranslation(); const { pubkey, identifier } = useParams<{ pubkey: string; identifier: string }>(); const { user } = useCurrentUser(); const { data: tour, isLoading, error } = useTour(identifier || '', pubkey); useSeoMeta({ title: tour?.title ? `Edit ${tour.title} - SkateSpots` : 'Edit Tour - SkateSpots', description: 'Edit your skate tour — update stops, dates and details.', }); if (isLoading) { return ( <>
{t('placesUi.editTour.loginToEdit')}
{t('placesUi.editTour.accessDeniedDesc')}