import { useParams } from 'react-router-dom';
import { Layout } from '@/components/Layout';
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';
/**
* 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 { pubkey, identifier } = useParams<{ pubkey: string; identifier: string }>();
const { user } = useCurrentUser();
const { data: tour, isLoading, error } = useTour(identifier || '', pubkey);
if (isLoading) {
return (
);
}
if (error || !tour) {
return ;
}
if (!user) {
return (