Simplify AdminPhotoMenu types
This commit is contained in:
parent
b5b2eb8f46
commit
8151a4f1cd
@ -1,8 +1,10 @@
|
|||||||
import { authCached } from '@/auth/cache';
|
import { authCached } from '@/auth/cache';
|
||||||
import AdminPhotoMenuClient, { AdminPhotoMenuClientProps }
|
import AdminPhotoMenuClient from './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();
|
const session = await authCached();
|
||||||
return Boolean(session?.user?.email)
|
return Boolean(session?.user?.email)
|
||||||
? <AdminPhotoMenuClient {...props} />
|
? <AdminPhotoMenuClient {...props} />
|
||||||
|
|||||||
@ -4,15 +4,12 @@ import { ComponentProps } from 'react';
|
|||||||
import { pathForAdminPhotoEdit } from '@/site/paths';
|
import { pathForAdminPhotoEdit } from '@/site/paths';
|
||||||
import MoreMenu from '../components/MoreMenu';
|
import MoreMenu from '../components/MoreMenu';
|
||||||
|
|
||||||
export interface AdminPhotoMenuClientProps
|
|
||||||
extends Omit<ComponentProps<typeof MoreMenu>, 'items'> {
|
|
||||||
photoId: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function AdminPhotoMenuClient({
|
export default function AdminPhotoMenuClient({
|
||||||
photoId,
|
photoId,
|
||||||
...props
|
...props
|
||||||
}: AdminPhotoMenuClientProps) {
|
}: Omit<ComponentProps<typeof MoreMenu>, 'items'> & {
|
||||||
|
photoId: string
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<MoreMenu {...{
|
<MoreMenu {...{
|
||||||
items: [{ href: pathForAdminPhotoEdit(photoId), label: 'Edit Photo' }],
|
items: [{ href: pathForAdminPhotoEdit(photoId), label: 'Edit Photo' }],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user