Vercel/src/photo/PhotoGridInfinite.tsx
Aonan Li 91f99508f7
Start batch editing from the current page (#303)
* Batch edit from the current page

* Redirect to grid when batch editing a page without grid

* Always clear selected ids on path change

* Only clear ids when selecting

* Use data-photo-grid to find grid

* Update batch edit from command K

* Not mount batch edit panel when not needed

* Not clear selecting state when go to /grid

* Use search param to force batch editing
2025-09-06 18:11:35 -05:00

46 lines
1.1 KiB
TypeScript

'use client';
import { INFINITE_SCROLL_GRID_MULTIPLE } from '.';
import InfinitePhotoScroll from './InfinitePhotoScroll';
import PhotoGrid from './PhotoGrid';
import { ComponentProps } from 'react';
import { SortBy } from './sort';
export default function PhotoGridInfinite({
cacheKey,
initialOffset,
sortBy,
sortWithPriority,
excludeFromFeeds,
canStart,
animateOnFirstLoadOnly,
...categories
}: {
cacheKey: string
initialOffset: number
sortBy?: SortBy
sortWithPriority?: boolean
excludeFromFeeds?: boolean
} & Omit<ComponentProps<typeof PhotoGrid>, 'photos'>) {
return (
<InfinitePhotoScroll
cacheKey={cacheKey}
initialOffset={initialOffset}
itemsPerPage={INFINITE_SCROLL_GRID_MULTIPLE}
sortBy={sortBy}
sortWithPriority={sortWithPriority}
excludeFromFeeds={excludeFromFeeds}
{...categories}
>
{({ photos, onLastPhotoVisible }) =>
<PhotoGrid {...{
photos,
...categories,
canStart,
onLastPhotoVisible,
animateOnFirstLoadOnly,
}} />}
</InfinitePhotoScroll>
);
}