Simplify AdminPhotoMenu types

This commit is contained in:
Sam Becker 2024-02-09 20:56:21 -06:00
parent b5b2eb8f46
commit 8151a4f1cd
2 changed files with 8 additions and 9 deletions

View File

@ -1,8 +1,10 @@
import { authCached } from '@/auth/cache';
import AdminPhotoMenuClient, { AdminPhotoMenuClientProps }
from './AdminPhotoMenuClient';
import AdminPhotoMenuClient from './AdminPhotoMenuClient';
import { ComponentProps } from 'react';
export default async function AdminPhotoMenu(props: AdminPhotoMenuClientProps) {
export default async function AdminPhotoMenu(
props: ComponentProps<typeof AdminPhotoMenuClient>,
) {
const session = await authCached();
return Boolean(session?.user?.email)
? <AdminPhotoMenuClient {...props} />

View File

@ -4,15 +4,12 @@ import { ComponentProps } from 'react';
import { pathForAdminPhotoEdit } from '@/site/paths';
import MoreMenu from '../components/MoreMenu';
export interface AdminPhotoMenuClientProps
extends Omit<ComponentProps<typeof MoreMenu>, 'items'> {
photoId: string
}
export default function AdminPhotoMenuClient({
photoId,
...props
}: AdminPhotoMenuClientProps) {
}: Omit<ComponentProps<typeof MoreMenu>, 'items'> & {
photoId: string
}) {
return (
<MoreMenu {...{
items: [{ href: pathForAdminPhotoEdit(photoId), label: 'Edit Photo' }],