'use client' import * as React from 'react' import type { EntityVersionWithAuthor } from '@admin/actions/entity-versions' import { EntityVersionsDrawer } from '@admin/components/shared/entity-versions/entity-versions-drawer' import { useEntityVersions } from '@admin/hooks/use-entity-versions' import { useIsPhone } from '@admin/hooks/use-is-phone' import { format, formatDistanceToNow } from 'date-fns' import { ChevronRight } from 'lucide-react' interface EntityDetailsRowsUser { name: string email: string image?: string | null } interface EntityDetailsRowsProps { className?: string data: { createdAt: Date | string updatedAt: Date | string updatedByUser?: EntityDetailsRowsUser | null } entityType: string entityId: string getVersionsAction: (entityId: string) => Promise restoreVersionAction: (versionId: string) => Promise } // The edit form's `Details` group on phones (Paper `Posts / Edit / Mobile`, 2026-11-12): last edit, // creation date and a Versions row that opens the versions drawer, in place of the desktop // metadata bar. The version count includes the current version. export function EntityDetailsRows({ className, data, entityType, entityId, getVersionsAction, restoreVersionAction }: EntityDetailsRowsProps) { const isPhone = useIsPhone() const [open, setOpen] = React.useState(false) const { versions, isPending, load } = useEntityVersions({ entityId, getVersionsAction }) React.useEffect(() => { if (isPhone) { load() } }, [isPhone, load]) if (!isPhone) { return null } const updatedBy = data.updatedByUser?.name || data.updatedByUser?.email || 'System' return (

Details

Last edited {updatedBy} · {formatDistanceToNow(new Date(data.updatedAt), { addSuffix: true })}
Created {format(new Date(data.createdAt), 'MMM d, yyyy · h:mm a')}
) }