Merge pull request #119 from sambecker/rsalik/main
Make admin photo queries consistent
This commit is contained in:
commit
8bb23a583e
@ -91,7 +91,7 @@ export default function AdminPhotosTable({
|
|||||||
)}>
|
)}>
|
||||||
<PhotoDate {...{
|
<PhotoDate {...{
|
||||||
photo,
|
photo,
|
||||||
dateType: showUpdatedAt ? 'updatedAt' : undefined,
|
dateType: showUpdatedAt ? 'updatedAt' : 'createdAt',
|
||||||
}} />
|
}} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ export default function AdminPhotosTableInfinite({
|
|||||||
initialOffset={initialOffset}
|
initialOffset={initialOffset}
|
||||||
itemsPerPage={itemsPerPage}
|
itemsPerPage={itemsPerPage}
|
||||||
useCachedPhotos={false}
|
useCachedPhotos={false}
|
||||||
|
sortBy="createdAt"
|
||||||
includeHiddenPhotos
|
includeHiddenPhotos
|
||||||
>
|
>
|
||||||
{({ photos, onLastPhotoVisible, revalidatePhoto }) =>
|
{({ photos, onLastPhotoVisible, revalidatePhoto }) =>
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { clsx } from 'clsx/lite';
|
|||||||
import { useAppState } from '@/state/AppState';
|
import { useAppState } from '@/state/AppState';
|
||||||
import { Camera } from '@/camera';
|
import { Camera } from '@/camera';
|
||||||
import { FilmSimulation } from '@/simulation';
|
import { FilmSimulation } from '@/simulation';
|
||||||
|
import { GetPhotosOptions } from './db';
|
||||||
|
|
||||||
export type RevalidatePhoto = (
|
export type RevalidatePhoto = (
|
||||||
photoId: string,
|
photoId: string,
|
||||||
@ -25,6 +26,7 @@ export default function InfinitePhotoScroll({
|
|||||||
cacheKey,
|
cacheKey,
|
||||||
initialOffset,
|
initialOffset,
|
||||||
itemsPerPage,
|
itemsPerPage,
|
||||||
|
sortBy,
|
||||||
tag,
|
tag,
|
||||||
camera,
|
camera,
|
||||||
simulation,
|
simulation,
|
||||||
@ -35,6 +37,7 @@ export default function InfinitePhotoScroll({
|
|||||||
}: {
|
}: {
|
||||||
initialOffset: number
|
initialOffset: number
|
||||||
itemsPerPage: number
|
itemsPerPage: number
|
||||||
|
sortBy?: GetPhotosOptions['sortBy']
|
||||||
tag?: string
|
tag?: string
|
||||||
camera?: Camera
|
camera?: Camera
|
||||||
simulation?: FilmSimulation
|
simulation?: FilmSimulation
|
||||||
@ -59,25 +62,18 @@ export default function InfinitePhotoScroll({
|
|||||||
, [key]);
|
, [key]);
|
||||||
|
|
||||||
const fetcher = useCallback(([_key, size]: [string, number]) =>
|
const fetcher = useCallback(([_key, size]: [string, number]) =>
|
||||||
useCachedPhotos
|
(useCachedPhotos ? getPhotosCachedAction : getPhotosAction)({
|
||||||
? getPhotosCachedAction({
|
offset: initialOffset + size * itemsPerPage,
|
||||||
offset: initialOffset + size * itemsPerPage,
|
sortBy,
|
||||||
limit: itemsPerPage,
|
limit: itemsPerPage,
|
||||||
hidden: includeHiddenPhotos ? 'include' : 'exclude',
|
hidden: includeHiddenPhotos ? 'include' : 'exclude',
|
||||||
tag,
|
tag,
|
||||||
camera,
|
camera,
|
||||||
simulation,
|
simulation,
|
||||||
})
|
})
|
||||||
: getPhotosAction({
|
|
||||||
offset: initialOffset + size * itemsPerPage,
|
|
||||||
limit: itemsPerPage,
|
|
||||||
hidden: includeHiddenPhotos ? 'include' : 'exclude',
|
|
||||||
tag,
|
|
||||||
camera,
|
|
||||||
simulation,
|
|
||||||
})
|
|
||||||
, [
|
, [
|
||||||
useCachedPhotos,
|
useCachedPhotos,
|
||||||
|
sortBy,
|
||||||
initialOffset,
|
initialOffset,
|
||||||
itemsPerPage,
|
itemsPerPage,
|
||||||
includeHiddenPhotos,
|
includeHiddenPhotos,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user