sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
32 lines (28 loc) • 861 B
text/typescript
import {RestoreIcon} from '@sanity/icons'
import {type DocumentInspector, useTranslation} from 'sanity'
import {useStructureTool} from '../../../../useStructureTool'
import {HISTORY_INSPECTOR_NAME} from '../../constants'
import {ChangesTabs} from './ChangesTabs'
export const changesInspector: DocumentInspector = {
name: HISTORY_INSPECTOR_NAME,
useMenuItem: () => {
const {features} = useStructureTool()
const {t} = useTranslation()
return {
hidden: !features.reviewChanges,
icon: RestoreIcon,
title: t('changes.title'),
}
},
component: ChangesTabs,
onClose: ({params}) => ({
params: {
...params,
since: undefined,
rev: undefined,
changesInspectorTab: undefined,
historyVersion: undefined,
},
}),
onOpen: ({params}) => ({params: {...params, since: '@lastPublished'}}),
}