Vercel/src/admin/AdminPhotosTableInfinite.tsx
Sam Becker 646f32e642
Rich sort controls (#283)
* Generalize app switcher menus

* Organize sort module

* Build configuration for nav sort control

* Refine sort menu styles

* Upgrade next.js

* Reset custom sort when clicking grid/full a second time

* Light up sort button when overridden
2025-07-15 22:43:36 -05:00

39 lines
1.0 KiB
TypeScript

'use client';
import { PATH_ADMIN_PHOTOS } from '@/app/path';
import InfinitePhotoScroll from '../photo/InfinitePhotoScroll';
import AdminPhotosTable from './AdminPhotosTable';
import { ComponentProps } from 'react';
export default function AdminPhotosTableInfinite({
initialOffset,
itemsPerPage,
hasAiTextGeneration,
canEdit,
canDelete,
}: {
initialOffset: number
itemsPerPage: number
} & Omit<ComponentProps<typeof AdminPhotosTable>, 'photos'>) {
return (
<InfinitePhotoScroll
cacheKey={`page-${PATH_ADMIN_PHOTOS}`}
initialOffset={initialOffset}
itemsPerPage={itemsPerPage}
useCachedPhotos={false}
sortBy="createdAt"
includeHiddenPhotos
>
{({ photos, onLastPhotoVisible, revalidatePhoto }) =>
<AdminPhotosTable
photos={photos}
onLastPhotoVisible={onLastPhotoVisible}
revalidatePhoto={revalidatePhoto}
hasAiTextGeneration={hasAiTextGeneration}
canEdit={canEdit}
canDelete={canDelete}
/>}
</InfinitePhotoScroll>
);
}