Rename legacy search params infinite scroll
This commit is contained in:
parent
66f6458dd0
commit
548b3e6f4c
@ -22,7 +22,7 @@ import {
|
||||
import { AiOutlineEyeInvisible } from 'react-icons/ai';
|
||||
import {
|
||||
PaginationParams,
|
||||
getPaginationForSearchParams,
|
||||
getPaginationFromSearchParams,
|
||||
} from '@/site/pagination';
|
||||
import AdminGrid from '@/admin/AdminGrid';
|
||||
import DeleteButton from '@/admin/DeleteButton';
|
||||
@ -32,14 +32,15 @@ import { PRO_MODE_ENABLED } from '@/site/config';
|
||||
import SubmitButtonWithStatus from '@/components/SubmitButtonWithStatus';
|
||||
import IconGrSync from '@/site/IconGrSync';
|
||||
import { getStoragePhotoUrlsNoStore } from '@/services/storage/cache';
|
||||
import MoreComponentsClient from '@/components/MoreComponentsClient';
|
||||
import MoreComponentsFromSearchParams from
|
||||
'@/components/MoreComponentsFromSearchParams';
|
||||
|
||||
const DEBUG_PHOTO_BLOBS = false;
|
||||
|
||||
export default async function AdminPhotosPage({
|
||||
searchParams,
|
||||
}: PaginationParams) {
|
||||
const { offset, limit } = getPaginationForSearchParams(searchParams);
|
||||
const { offset, limit } = getPaginationFromSearchParams(searchParams);
|
||||
|
||||
const [
|
||||
photos,
|
||||
@ -145,7 +146,7 @@ export default async function AdminPhotosPage({
|
||||
</Fragment>)}
|
||||
</AdminGrid>
|
||||
{showMorePhotos &&
|
||||
<MoreComponentsClient
|
||||
<MoreComponentsFromSearchParams
|
||||
label="More photos"
|
||||
path={pathForAdminPhotos(offset + 1)}
|
||||
/>}
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
import { getPhotosCached, getPhotosCountCached } from '@/photo/cache';
|
||||
import MoreComponentsClient from '@/components/MoreComponentsClient';
|
||||
import MoreComponentsFromSearchParams from
|
||||
'@/components/MoreComponentsFromSearchParams';
|
||||
import StaggeredOgPhotos from '@/photo/StaggeredOgPhotos';
|
||||
import {
|
||||
PaginationParams,
|
||||
getPaginationForSearchParams,
|
||||
getPaginationFromSearchParams,
|
||||
} from '@/site/pagination';
|
||||
import { pathForOg } from '@/site/paths';
|
||||
|
||||
export default async function GridPage({ searchParams }: PaginationParams) {
|
||||
const { offset, limit } = getPaginationForSearchParams(searchParams);
|
||||
const { offset, limit } = getPaginationFromSearchParams(searchParams);
|
||||
|
||||
const [
|
||||
photos,
|
||||
@ -26,7 +27,7 @@ export default async function GridPage({ searchParams }: PaginationParams) {
|
||||
<StaggeredOgPhotos photos={photos} />
|
||||
</div>
|
||||
{showMorePhotos &&
|
||||
<MoreComponentsClient
|
||||
<MoreComponentsFromSearchParams
|
||||
label="More photos"
|
||||
path={pathForOg(offset + 1)}
|
||||
/>}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import {
|
||||
PaginationSearchParams,
|
||||
getPaginationForSearchParams,
|
||||
getPaginationFromSearchParams,
|
||||
} from '@/site/pagination';
|
||||
import { Camera } from '.';
|
||||
import {
|
||||
@ -32,7 +32,7 @@ export const getPhotosCameraDataCachedWithPagination = async ({
|
||||
limit?: number,
|
||||
searchParams?: PaginationSearchParams,
|
||||
}) => {
|
||||
const { offset, limit } = getPaginationForSearchParams(searchParams);
|
||||
const { offset, limit } = getPaginationFromSearchParams(searchParams);
|
||||
|
||||
const [photos, count, dateRange] =
|
||||
await getPhotosCameraDataCached({
|
||||
|
||||
@ -4,7 +4,7 @@ import { useRouter } from 'next/navigation';
|
||||
import { useCallback, useEffect, useRef, useTransition } from 'react';
|
||||
import Spinner from './Spinner';
|
||||
|
||||
export default function MoreComponentsClient({
|
||||
export default function MoreComponentsFromSearchParams({
|
||||
path,
|
||||
label = 'Load more',
|
||||
triggerOnView = true,
|
||||
@ -5,7 +5,7 @@ import {
|
||||
} from '@/photo/cache';
|
||||
import {
|
||||
PaginationSearchParams,
|
||||
getPaginationForSearchParams,
|
||||
getPaginationFromSearchParams,
|
||||
} from '@/site/pagination';
|
||||
import { pathForFilmSimulation } from '@/site/paths';
|
||||
import { FilmSimulation } from '.';
|
||||
@ -32,7 +32,7 @@ export const getPhotosFilmSimulationDataCachedWithPagination = async ({
|
||||
limit?: number,
|
||||
searchParams?: PaginationSearchParams,
|
||||
}) => {
|
||||
const { offset, limit } = getPaginationForSearchParams(searchParams);
|
||||
const { offset, limit } = getPaginationFromSearchParams(searchParams);
|
||||
|
||||
const [photos, count, dateRange] =
|
||||
await getPhotosFilmSimulationDataCached({
|
||||
|
||||
@ -4,7 +4,7 @@ export interface PaginationParams {
|
||||
searchParams?: PaginationSearchParams
|
||||
}
|
||||
|
||||
export const getPaginationForSearchParams = (
|
||||
export const getPaginationFromSearchParams = (
|
||||
query?: PaginationSearchParams,
|
||||
limitPerOffset = 24,
|
||||
) => {
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
} from '@/photo/cache';
|
||||
import {
|
||||
PaginationSearchParams,
|
||||
getPaginationForSearchParams,
|
||||
getPaginationFromSearchParams,
|
||||
} from '@/site/pagination';
|
||||
import { pathForTag } from '@/site/paths';
|
||||
|
||||
@ -31,7 +31,7 @@ export const getPhotosTagDataCachedWithPagination = async ({
|
||||
limit?: number,
|
||||
searchParams?: PaginationSearchParams,
|
||||
}) => {
|
||||
const { offset, limit } = getPaginationForSearchParams(searchParams);
|
||||
const { offset, limit } = getPaginationFromSearchParams(searchParams);
|
||||
|
||||
const [photos, count, dateRange] =
|
||||
await getPhotosTagDataCached({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user