import { useParams } from 'react-router';
import { DEFAULT_PHOTOS_SECTION, isPhotosSection, type PhotosSectionId } from './shared';

// The URL names the section; nothing else does. PhotosScreen redirects anything unrecognised, so the fallback
// here only covers the instant before that lands.

export function usePhotosSection(): PhotosSectionId {
  const { section } = useParams();
  return isPhotosSection(section) ? section : DEFAULT_PHOTOS_SECTION;
}
