From 43a180da667ad38a85e5cd3feae8e618f75edb04 Mon Sep 17 00:00:00 2001 From: Ash Date: Fri, 29 Nov 2024 10:13:21 +0000 Subject: [PATCH] wip --- .../diffView/plugin/DiffViewStudioLayout.tsx | 5 ++ .../sanity/src/core/diffView/plugin/index.ts | 58 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 packages/sanity/src/core/diffView/plugin/DiffViewStudioLayout.tsx create mode 100644 packages/sanity/src/core/diffView/plugin/index.ts diff --git a/packages/sanity/src/core/diffView/plugin/DiffViewStudioLayout.tsx b/packages/sanity/src/core/diffView/plugin/DiffViewStudioLayout.tsx new file mode 100644 index 00000000000..3f4e93833f8 --- /dev/null +++ b/packages/sanity/src/core/diffView/plugin/DiffViewStudioLayout.tsx @@ -0,0 +1,5 @@ +import {type LayoutProps} from '../../config' + +export function DiffViewStudioLayout(props: LayoutProps) { + return props.renderDefault(props) +} diff --git a/packages/sanity/src/core/diffView/plugin/index.ts b/packages/sanity/src/core/diffView/plugin/index.ts new file mode 100644 index 00000000000..8a1d865dab5 --- /dev/null +++ b/packages/sanity/src/core/diffView/plugin/index.ts @@ -0,0 +1,58 @@ +import {route} from 'sanity/router' + +import {definePlugin} from '../../config' +// import {ReleasesStudioNavbar} from '../navbar/ReleasesStudioNavbar' +// import {ReleasesTool} from '../tool/ReleasesTool' +// import resolveDocumentActions from './documentActions' +// import {ReleasesStudioLayout} from './ReleasesStudioLayout' + +// TODO: DiffView may not be the best name? DiffTool? DocumentDiffTool? VersionDiffTool? + +/** + * @internal + */ +export const DIFF_VIEW_NAME = 'sanity/diffView' + +/** + * @internal + */ +export const DIFF_VIEW_TOOL_NAME = 'diffView' + +/** + * @internal + */ +export const DIFF_VIEW_INTENT = 'diffView' + +/** + * @internal + */ +export const releases = definePlugin({ + name: DIFF_VIEW_NAME, + studio: { + components: { + layout: ReleasesStudioLayout, + navbar: ReleasesStudioNavbar, + }, + }, + tools: [ + { + name: DIFF_VIEW_TOOL_NAME, + title: 'Releases', + // component: ReleasesTool, + router: route.create('/', [route.create('/:releaseId')]), + canHandleIntent: (intent) => intent === DIFF_VIEW_INTENT, + getIntentState(intent, params) { + if (intent === DIFF_VIEW_INTENT) { + // return {releaseId: params.id} + } + return null + }, + }, + ], + // i18n: { + // bundles: [releasesUsEnglishLocaleBundle], + // }, + // document: { + // actions: (actions, context) => resolveDocumentActions(actions, context), + // }, +})