diff --git a/packages/sanity/src/_singletons/context/ReleasesTableContext.ts b/packages/sanity/src/_singletons/context/ReleasesTableContext.ts index 8d35e73535b..64f9023bb61 100644 --- a/packages/sanity/src/_singletons/context/ReleasesTableContext.ts +++ b/packages/sanity/src/_singletons/context/ReleasesTableContext.ts @@ -1,6 +1,6 @@ import {createContext} from 'sanity/_createContext' -import type {TableContextValue} from '../../core/releases/components/Table/TableProvider' +import type {TableContextValue} from '../../core/releases/tool/components/Table/TableProvider' /** * @internal diff --git a/packages/sanity/src/core/index.ts b/packages/sanity/src/core/index.ts index 9f60475c962..a50d54a9f95 100644 --- a/packages/sanity/src/core/index.ts +++ b/packages/sanity/src/core/index.ts @@ -1,12 +1,3 @@ -export { - getDocumentIsInPerspective, - LATEST, - ReleaseActions, - ReleaseBadge, - ReleasesMenu, - useDocumentVersions, - usePerspective, -} from './bundles' export * from './changeIndicators' export { CommentInput, @@ -30,6 +21,15 @@ export * from './hooks' export * from './i18n' export * from './presence' export * from './preview' +export { + getDocumentIsInPerspective, + LATEST, + ReleaseActions, + ReleaseBadge, + ReleasesMenu, + useDocumentVersions, + usePerspective, +} from './releases' export * from './scheduledPublishing' export * from './schema' export type {SearchFactoryOptions, SearchOptions, SearchSort, SearchTerms} from './search' diff --git a/packages/sanity/src/core/bundles/__telemetry__/releases.telemetry.ts b/packages/sanity/src/core/releases/__telemetry__/releases.telemetry.ts similarity index 100% rename from packages/sanity/src/core/bundles/__telemetry__/releases.telemetry.ts rename to packages/sanity/src/core/releases/__telemetry__/releases.telemetry.ts diff --git a/packages/sanity/src/core/bundles/components/ReleaseBadge.tsx b/packages/sanity/src/core/releases/components/ReleaseBadge.tsx similarity index 100% rename from packages/sanity/src/core/bundles/components/ReleaseBadge.tsx rename to packages/sanity/src/core/releases/components/ReleaseBadge.tsx diff --git a/packages/sanity/src/core/bundles/components/ReleasesMenu.tsx b/packages/sanity/src/core/releases/components/ReleasesMenu.tsx similarity index 100% rename from packages/sanity/src/core/bundles/components/ReleasesMenu.tsx rename to packages/sanity/src/core/releases/components/ReleasesMenu.tsx diff --git a/packages/sanity/src/core/bundles/components/__tests__/ReleasesMenu.test.tsx b/packages/sanity/src/core/releases/components/__tests__/ReleasesMenu.test.tsx similarity index 100% rename from packages/sanity/src/core/bundles/components/__tests__/ReleasesMenu.test.tsx rename to packages/sanity/src/core/releases/components/__tests__/ReleasesMenu.test.tsx diff --git a/packages/sanity/src/core/bundles/components/dialog/ReleaseDetailsDialog.tsx b/packages/sanity/src/core/releases/components/dialog/ReleaseDetailsDialog.tsx similarity index 100% rename from packages/sanity/src/core/bundles/components/dialog/ReleaseDetailsDialog.tsx rename to packages/sanity/src/core/releases/components/dialog/ReleaseDetailsDialog.tsx diff --git a/packages/sanity/src/core/bundles/components/dialog/ReleaseForm.tsx b/packages/sanity/src/core/releases/components/dialog/ReleaseForm.tsx similarity index 100% rename from packages/sanity/src/core/bundles/components/dialog/ReleaseForm.tsx rename to packages/sanity/src/core/releases/components/dialog/ReleaseForm.tsx diff --git a/packages/sanity/src/core/bundles/components/dialog/ReleaseIconEditorPicker.tsx b/packages/sanity/src/core/releases/components/dialog/ReleaseIconEditorPicker.tsx similarity index 100% rename from packages/sanity/src/core/bundles/components/dialog/ReleaseIconEditorPicker.tsx rename to packages/sanity/src/core/releases/components/dialog/ReleaseIconEditorPicker.tsx diff --git a/packages/sanity/src/core/bundles/components/dialog/__tests__/ReleaseDetailsDialog.test.tsx b/packages/sanity/src/core/releases/components/dialog/__tests__/ReleaseDetailsDialog.test.tsx similarity index 100% rename from packages/sanity/src/core/bundles/components/dialog/__tests__/ReleaseDetailsDialog.test.tsx rename to packages/sanity/src/core/releases/components/dialog/__tests__/ReleaseDetailsDialog.test.tsx diff --git a/packages/sanity/src/core/bundles/components/dialog/__tests__/ReleaseForm.test.tsx b/packages/sanity/src/core/releases/components/dialog/__tests__/ReleaseForm.test.tsx similarity index 100% rename from packages/sanity/src/core/bundles/components/dialog/__tests__/ReleaseForm.test.tsx rename to packages/sanity/src/core/releases/components/dialog/__tests__/ReleaseForm.test.tsx diff --git a/packages/sanity/src/core/bundles/components/dialog/__tests__/ReleaseIconEditorPicker.test.tsx b/packages/sanity/src/core/releases/components/dialog/__tests__/ReleaseIconEditorPicker.test.tsx similarity index 100% rename from packages/sanity/src/core/bundles/components/dialog/__tests__/ReleaseIconEditorPicker.test.tsx rename to packages/sanity/src/core/releases/components/dialog/__tests__/ReleaseIconEditorPicker.test.tsx diff --git a/packages/sanity/src/core/bundles/components/index.ts b/packages/sanity/src/core/releases/components/index.ts similarity index 100% rename from packages/sanity/src/core/bundles/components/index.ts rename to packages/sanity/src/core/releases/components/index.ts diff --git a/packages/sanity/src/core/bundles/components/panes/ReleaseActions.tsx b/packages/sanity/src/core/releases/components/panes/ReleaseActions.tsx similarity index 100% rename from packages/sanity/src/core/bundles/components/panes/ReleaseActions.tsx rename to packages/sanity/src/core/releases/components/panes/ReleaseActions.tsx diff --git a/packages/sanity/src/core/bundles/hooks/__tests__/useDocumentVersions.test.tsx b/packages/sanity/src/core/releases/hooks/__tests__/useDocumentVersions.test.tsx similarity index 100% rename from packages/sanity/src/core/bundles/hooks/__tests__/useDocumentVersions.test.tsx rename to packages/sanity/src/core/releases/hooks/__tests__/useDocumentVersions.test.tsx diff --git a/packages/sanity/src/core/bundles/hooks/index.ts b/packages/sanity/src/core/releases/hooks/index.ts similarity index 100% rename from packages/sanity/src/core/bundles/hooks/index.ts rename to packages/sanity/src/core/releases/hooks/index.ts diff --git a/packages/sanity/src/core/bundles/hooks/useDocumentVersions.tsx b/packages/sanity/src/core/releases/hooks/useDocumentVersions.tsx similarity index 100% rename from packages/sanity/src/core/bundles/hooks/useDocumentVersions.tsx rename to packages/sanity/src/core/releases/hooks/useDocumentVersions.tsx diff --git a/packages/sanity/src/core/bundles/hooks/usePerspective.tsx b/packages/sanity/src/core/releases/hooks/usePerspective.tsx similarity index 100% rename from packages/sanity/src/core/bundles/hooks/usePerspective.tsx rename to packages/sanity/src/core/releases/hooks/usePerspective.tsx diff --git a/packages/sanity/src/core/bundles/index.ts b/packages/sanity/src/core/releases/index.ts similarity index 100% rename from packages/sanity/src/core/bundles/index.ts rename to packages/sanity/src/core/releases/index.ts diff --git a/packages/sanity/src/core/releases/components/Chip.tsx b/packages/sanity/src/core/releases/tool/components/Chip.tsx similarity index 100% rename from packages/sanity/src/core/releases/components/Chip.tsx rename to packages/sanity/src/core/releases/tool/components/Chip.tsx diff --git a/packages/sanity/src/core/releases/components/ReleaseDocumentPreview.tsx b/packages/sanity/src/core/releases/tool/components/ReleaseDocumentPreview.tsx similarity index 88% rename from packages/sanity/src/core/releases/components/ReleaseDocumentPreview.tsx rename to packages/sanity/src/core/releases/tool/components/ReleaseDocumentPreview.tsx index 132b6b25b09..f6502b9c6fa 100644 --- a/packages/sanity/src/core/releases/components/ReleaseDocumentPreview.tsx +++ b/packages/sanity/src/core/releases/tool/components/ReleaseDocumentPreview.tsx @@ -5,11 +5,11 @@ import {type ForwardedRef, forwardRef, useMemo} from 'react' import {DocumentPreviewPresence, useDocumentPresence} from 'sanity' import {IntentLink} from 'sanity/router' -import {Tooltip} from '../../../ui-components' -import {useTranslation} from '../../i18n' -import {SanityDefaultPreview} from '../../preview/components/SanityDefaultPreview' -import {getPublishedId} from '../../util/draftUtils' -import {releasesLocaleNamespace} from '../i18n' +import {Tooltip} from '../../../../ui-components' +import {useTranslation} from '../../../i18n' +import {SanityDefaultPreview} from '../../../preview/components/SanityDefaultPreview' +import {getPublishedId} from '../../../util/draftUtils' +import {releasesLocaleNamespace} from '../../i18n' interface ReleaseDocumentPreviewProps { documentId: string diff --git a/packages/sanity/src/core/releases/components/ReleaseMenuButton/ReleaseMenuButton.tsx b/packages/sanity/src/core/releases/tool/components/ReleaseMenuButton/ReleaseMenuButton.tsx similarity index 92% rename from packages/sanity/src/core/releases/components/ReleaseMenuButton/ReleaseMenuButton.tsx rename to packages/sanity/src/core/releases/tool/components/ReleaseMenuButton/ReleaseMenuButton.tsx index 8b0485c2ff8..64e07dbe256 100644 --- a/packages/sanity/src/core/releases/components/ReleaseMenuButton/ReleaseMenuButton.tsx +++ b/packages/sanity/src/core/releases/tool/components/ReleaseMenuButton/ReleaseMenuButton.tsx @@ -10,17 +10,17 @@ import {Menu, Spinner, Text, useToast} from '@sanity/ui' import {useState} from 'react' import {useRouter} from 'sanity/router' -import {Button, Dialog, MenuButton, MenuItem} from '../../../../ui-components' +import {Button, Dialog, MenuButton, MenuItem} from '../../../../../ui-components' +import {Translate, useTranslation} from '../../../../i18n' +import {type BundleDocument} from '../../../../store/bundles/types' +import {useBundleOperations} from '../../../../store/bundles/useBundleOperations' import { ArchivedRelease, DeletedRelease, UnarchivedRelease, -} from '../../../bundles/__telemetry__/releases.telemetry' -import {ReleaseDetailsDialog} from '../../../bundles/components/dialog/ReleaseDetailsDialog' -import {Translate, useTranslation} from '../../../i18n' -import {type BundleDocument} from '../../../store/bundles/types' -import {useBundleOperations} from '../../../store/bundles/useBundleOperations' -import {releasesLocaleNamespace} from '../../i18n' +} from '../../../__telemetry__/releases.telemetry' +import {ReleaseDetailsDialog} from '../../../components/dialog/ReleaseDetailsDialog' +import {releasesLocaleNamespace} from '../../../i18n' export type ReleaseMenuButtonProps = { disabled?: boolean diff --git a/packages/sanity/src/core/releases/components/ReleaseMenuButton/__tests__/ReleaseMenuButton.test.tsx b/packages/sanity/src/core/releases/tool/components/ReleaseMenuButton/__tests__/ReleaseMenuButton.test.tsx similarity index 93% rename from packages/sanity/src/core/releases/components/ReleaseMenuButton/__tests__/ReleaseMenuButton.test.tsx rename to packages/sanity/src/core/releases/tool/components/ReleaseMenuButton/__tests__/ReleaseMenuButton.test.tsx index 24e715510ad..cf45f419b83 100644 --- a/packages/sanity/src/core/releases/components/ReleaseMenuButton/__tests__/ReleaseMenuButton.test.tsx +++ b/packages/sanity/src/core/releases/tool/components/ReleaseMenuButton/__tests__/ReleaseMenuButton.test.tsx @@ -3,17 +3,17 @@ import {fireEvent, render, screen} from '@testing-library/react' import {act} from 'react' import {useRouter} from 'sanity/router' -import {createTestProvider} from '../../../../../../test/testUtils/TestProvider' -import {type BundleDocument} from '../../../../store/bundles/types' -import {useBundleOperations} from '../../../../store/bundles/useBundleOperations' -import {releasesUsEnglishLocaleBundle} from '../../../i18n' +import {createTestProvider} from '../../../../../../../test/testUtils/TestProvider' +import {type BundleDocument} from '../../../../../store/bundles/types' +import {useBundleOperations} from '../../../../../store/bundles/useBundleOperations' +import {releasesUsEnglishLocaleBundle} from '../../../../i18n' import {ReleaseMenuButton, type ReleaseMenuButtonProps} from '../ReleaseMenuButton' jest.mock('sanity', () => ({ useTranslation: jest.fn().mockReturnValue({t: jest.fn()}), })) -jest.mock('../../../../store/bundles/useBundleOperations', () => ({ +jest.mock('../../../../../store/bundles/useBundleOperations', () => ({ useBundleOperations: jest.fn().mockReturnValue({ deleteBundle: jest.fn(), updateBundle: jest.fn(), diff --git a/packages/sanity/src/core/releases/components/ReleasePublishAllButton/ReleasePublishAllButton.tsx b/packages/sanity/src/core/releases/tool/components/ReleasePublishAllButton/ReleasePublishAllButton.tsx similarity index 91% rename from packages/sanity/src/core/releases/components/ReleasePublishAllButton/ReleasePublishAllButton.tsx rename to packages/sanity/src/core/releases/tool/components/ReleasePublishAllButton/ReleasePublishAllButton.tsx index b9f65f16c2f..21eaec5db51 100644 --- a/packages/sanity/src/core/releases/components/ReleasePublishAllButton/ReleasePublishAllButton.tsx +++ b/packages/sanity/src/core/releases/tool/components/ReleasePublishAllButton/ReleasePublishAllButton.tsx @@ -4,12 +4,12 @@ import {Flex, Text, useToast} from '@sanity/ui' import {useCallback, useMemo, useState} from 'react' import {type BundleDocument} from 'sanity' -import {Button, Dialog} from '../../../../ui-components' -import {PublishedRelease} from '../../../bundles/__telemetry__/releases.telemetry' -import {Translate, useTranslation} from '../../../i18n' -import {useBundleOperations} from '../../../store/bundles/useBundleOperations' -import {releasesLocaleNamespace} from '../../i18n' -import {type DocumentInBundleResult} from '../../tool/detail/useBundleDocuments' +import {Button, Dialog} from '../../../../../ui-components' +import {Translate, useTranslation} from '../../../../i18n' +import {useBundleOperations} from '../../../../store/bundles/useBundleOperations' +import {PublishedRelease} from '../../../__telemetry__/releases.telemetry' +import {releasesLocaleNamespace} from '../../../i18n' +import {type DocumentInBundleResult} from '../../../tool/detail/useBundleDocuments' import {useObserveDocumentRevisions} from './useObserveDocumentRevisions' interface ReleasePublishAllButtonProps { diff --git a/packages/sanity/src/core/releases/components/ReleasePublishAllButton/useObserveDocumentRevisions.ts b/packages/sanity/src/core/releases/tool/components/ReleasePublishAllButton/useObserveDocumentRevisions.ts similarity index 100% rename from packages/sanity/src/core/releases/components/ReleasePublishAllButton/useObserveDocumentRevisions.ts rename to packages/sanity/src/core/releases/tool/components/ReleasePublishAllButton/useObserveDocumentRevisions.ts diff --git a/packages/sanity/src/core/releases/components/Table/Table.tsx b/packages/sanity/src/core/releases/tool/components/Table/Table.tsx similarity index 98% rename from packages/sanity/src/core/releases/components/Table/Table.tsx rename to packages/sanity/src/core/releases/tool/components/Table/Table.tsx index 7478c1a5665..0d65198931d 100644 --- a/packages/sanity/src/core/releases/components/Table/Table.tsx +++ b/packages/sanity/src/core/releases/tool/components/Table/Table.tsx @@ -17,8 +17,8 @@ import { } from 'react' import {styled} from 'styled-components' -import {TooltipDelayGroupProvider} from '../../../../ui-components' -import {LoadingBlock} from '../../../components' +import {TooltipDelayGroupProvider} from '../../../../../ui-components' +import {LoadingBlock} from '../../../../components' import {TableHeader} from './TableHeader' import {TableProvider, type TableSort, useTableContext} from './TableProvider' import {type Column} from './types' diff --git a/packages/sanity/src/core/releases/components/Table/TableHeader.tsx b/packages/sanity/src/core/releases/tool/components/Table/TableHeader.tsx similarity index 96% rename from packages/sanity/src/core/releases/components/Table/TableHeader.tsx rename to packages/sanity/src/core/releases/tool/components/Table/TableHeader.tsx index 620eebfa2ad..ef73a358fec 100644 --- a/packages/sanity/src/core/releases/components/Table/TableHeader.tsx +++ b/packages/sanity/src/core/releases/tool/components/Table/TableHeader.tsx @@ -1,7 +1,7 @@ import {ArrowDownIcon, ArrowUpIcon, SearchIcon} from '@sanity/icons' import {Card, Flex, Stack, TextInput} from '@sanity/ui' -import {Button, type ButtonProps} from '../../../../ui-components' +import {Button, type ButtonProps} from '../../../../../ui-components' import {useTableContext} from './TableProvider' import {type HeaderProps, type TableHeaderProps} from './types' diff --git a/packages/sanity/src/core/releases/components/Table/TableProvider.tsx b/packages/sanity/src/core/releases/tool/components/Table/TableProvider.tsx similarity index 100% rename from packages/sanity/src/core/releases/components/Table/TableProvider.tsx rename to packages/sanity/src/core/releases/tool/components/Table/TableProvider.tsx diff --git a/packages/sanity/src/core/releases/components/Table/types.ts b/packages/sanity/src/core/releases/tool/components/Table/types.ts similarity index 100% rename from packages/sanity/src/core/releases/components/Table/types.ts rename to packages/sanity/src/core/releases/tool/components/Table/types.ts diff --git a/packages/sanity/src/core/releases/tool/detail/ReleaseDetail.tsx b/packages/sanity/src/core/releases/tool/detail/ReleaseDetail.tsx index 768e01585ad..64568bcebdb 100644 --- a/packages/sanity/src/core/releases/tool/detail/ReleaseDetail.tsx +++ b/packages/sanity/src/core/releases/tool/detail/ReleaseDetail.tsx @@ -7,10 +7,10 @@ import {type RouterContextValue, useRouter} from 'sanity/router' import {Button} from '../../../../ui-components' import {Translate, useTranslation} from '../../../i18n' import {useBundles} from '../../../store/bundles' -import {ReleaseMenuButton} from '../../components/ReleaseMenuButton/ReleaseMenuButton' -import {ReleasePublishAllButton} from '../../components/ReleasePublishAllButton/ReleasePublishAllButton' import {releasesLocaleNamespace} from '../../i18n' import {type ReleasesRouterState} from '../../types/router' +import {ReleaseMenuButton} from '../components/ReleaseMenuButton/ReleaseMenuButton' +import {ReleasePublishAllButton} from '../components/ReleasePublishAllButton/ReleasePublishAllButton' import {useReleaseHistory} from './documentTable/useReleaseHistory' import {ReleaseReview} from './ReleaseReview' import {ReleaseSummary} from './ReleaseSummary' diff --git a/packages/sanity/src/core/releases/tool/detail/ReleaseSummary.tsx b/packages/sanity/src/core/releases/tool/detail/ReleaseSummary.tsx index fc85fb86b81..06ededa46ee 100644 --- a/packages/sanity/src/core/releases/tool/detail/ReleaseSummary.tsx +++ b/packages/sanity/src/core/releases/tool/detail/ReleaseSummary.tsx @@ -2,18 +2,18 @@ import {DocumentsIcon} from '@sanity/icons' import {AvatarStack, Box, Flex, Heading, Stack, Text, useToast} from '@sanity/ui' import {type RefObject, useCallback, useEffect, useMemo, useState} from 'react' -import { - ReleaseIconEditorPicker, - type ReleaseIconEditorPickerValue, -} from '../../../bundles/components/dialog/ReleaseIconEditorPicker' import {RelativeTime} from '../../../components/RelativeTime' import {UserAvatar} from '../../../components/userAvatar/UserAvatar' import {Translate, useTranslation} from '../../../i18n' import {type BundleDocument} from '../../../store/bundles/types' import {useBundleOperations} from '../../../store/bundles/useBundleOperations' -import {Chip} from '../../components/Chip' -import {Table, type TableProps} from '../../components/Table/Table' +import { + ReleaseIconEditorPicker, + type ReleaseIconEditorPickerValue, +} from '../../components/dialog/ReleaseIconEditorPicker' import {releasesLocaleNamespace} from '../../i18n' +import {Chip} from '../components/Chip' +import {Table, type TableProps} from '../components/Table/Table' import {DocumentActions} from './documentTable/DocumentActions' import {getDocumentTableColumnDefs} from './documentTable/DocumentTableColumnDefs' import {type DocumentHistory} from './documentTable/useReleaseHistory' diff --git a/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseDetail.test.tsx b/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseDetail.test.tsx index 55a36a852a2..380eccd5e1d 100644 --- a/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseDetail.test.tsx +++ b/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseDetail.test.tsx @@ -32,7 +32,7 @@ jest.mock('sanity', () => ({ useTranslation: jest.fn().mockReturnValue({t: jest.fn()}), })) -jest.mock('../../../components/ReleasePublishAllButton/useObserveDocumentRevisions', () => ({ +jest.mock('../../components/ReleasePublishAllButton/useObserveDocumentRevisions', () => ({ useObserveDocumentRevisions: jest.fn().mockReturnValue({ '123': 'mock revision id', }), diff --git a/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseReview.test.tsx b/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseReview.test.tsx index 4d9226ff358..9d9bba3b76e 100644 --- a/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseReview.test.tsx +++ b/packages/sanity/src/core/releases/tool/detail/__tests__/ReleaseReview.test.tsx @@ -1,7 +1,7 @@ import {beforeEach, describe, expect, it, jest} from '@jest/globals' import {act, fireEvent, render, screen, within} from '@testing-library/react' import {type ReactNode} from 'react' -import {ColorSchemeProvider, UserColorManagerProvider} from 'sanity' +import {ColorSchemeProvider, type DefaultPreview, UserColorManagerProvider} from 'sanity' import {queryByDataUi} from '../../../../../../test/setup/customQueries' import {createTestProvider} from '../../../../../../test/testUtils/TestProvider' @@ -131,7 +131,7 @@ jest.mock('sanity/router', () => ({ }), })) -jest.mock('../../../../bundles/components/ReleasesMenu', () => ({ +jest.mock('../../../components/ReleasesMenu', () => ({ ReleasesMenu: () =>