Merge branch 'main' into static

This commit is contained in:
Sam Becker 2024-04-03 11:01:58 -05:00
commit fcf61b8db4
5 changed files with 264 additions and 288 deletions

View File

@ -18,18 +18,18 @@
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.2",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.2",
"@types/react": "18.2.73",
"@types/node": "^20.12.3",
"@types/react": "18.2.74",
"@types/react-dom": "18.2.23",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"@upstash/ratelimit": "^1.0.1",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"@upstash/ratelimit": "^1.0.3",
"@vercel/analytics": "^1.2.2",
"@vercel/blob": "^0.22.1",
"@vercel/kv": "^1.0.1",
"@vercel/postgres": "0.7.2",
"@vercel/postgres": "0.8.0",
"@vercel/speed-insights": "^1.0.10",
"ai": "^3.0.16",
"ai": "^3.0.17",
"autoprefixer": "10.4.19",
"camelcase-keys": "^9.1.3",
"clsx": "^2.1.0",
@ -45,7 +45,7 @@
"next": "14.2.0-canary.51",
"next-auth": "5.0.0-beta.15",
"next-themes": "^0.3.0",
"openai": "^4.31.0",
"openai": "^4.32.1",
"postcss": "8.4.38",
"react": "18.2.0",
"react-dom": "18.2.0",

516
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,7 @@ import MoreComponentsFromSearchParams from
'@/components/MoreComponentsFromSearchParams';
import { getPhotos } from '@/services/vercel-postgres';
import PhotoDate from '@/photo/PhotoDate';
import { revalidatePath } from 'next/cache';
const DEBUG_PHOTO_BLOBS = false;
@ -57,7 +58,14 @@ export default async function AdminPhotosPage({
<SiteGrid
contentMain={
<div className="space-y-8">
<PhotoUpload shouldResize={!PRO_MODE_ENABLED} />
<PhotoUpload
shouldResize={!PRO_MODE_ENABLED}
onLastUpload={async () => {
'use server';
// Update upload count in admin nav
revalidatePath('/admin', 'layout');
}}
/>
{blobPhotoUrls.length > 0 &&
<div className={clsx(
'border-b pb-6',

View File

@ -9,9 +9,11 @@ import { clsx } from 'clsx/lite';
export default function PhotoUpload({
shouldResize,
onLastUpload,
debug,
}: {
shouldResize?: boolean
onLastUpload?: () => Promise<void>
debug?: boolean
}) {
const [isUploading, setIsUploading] = useState(false);
@ -55,11 +57,9 @@ export default function PhotoUpload({
blob,
extension,
)
.then(url => {
.then(async url => {
if (isLastBlob) {
// Refresh page to update upload list,
// relevant to upload count in nav
router.refresh();
await onLastUpload?.();
if (hasMultipleUploads) {
// Redirect to view multiple uploads
router.push(PATH_ADMIN_UPLOADS);

View File

@ -3,7 +3,7 @@ import { absolutePathForPhoto } from './paths';
import { formatDateFromPostgresString } from '@/utility/date';
import { getNextImageUrlForRequest } from '@/services/next-image';
export const API_PHOTO_REQUEST_LIMIT = 20;
export const API_PHOTO_REQUEST_LIMIT = 40;
export interface PublicApi {
meta: {