From c1f2bf405b95c2f17eb02cbdac011bb29d56747e Mon Sep 17 00:00:00 2001 From: Rita Date: Tue, 22 Oct 2024 08:50:24 +0200 Subject: [PATCH] chore(test): update imports and exports (use from package sanity vs relative paths) --- packages/sanity/src/core/index.ts | 7 +++++++ .../{tool => }/components/ReleaseAvatar.tsx | 0 .../sanity/src/core/releases/components/index.ts | 2 ++ packages/sanity/src/core/releases/index.ts | 3 +++ .../src/core/releases/navbar/ReleasesNav.tsx | 2 +- .../tool/detail/ReleaseDashboardDetails.tsx | 2 +- packages/sanity/src/core/store/release/index.ts | 1 + .../header/perspective/DocumentPerspectiveMenu.tsx | 7 +++---- .../header/perspective/VersionChip.tsx | 2 +- .../perspective/contextMenu/VersionContextMenu.tsx | 2 +- .../contextMenu/VersionContextMenuItem.tsx | 5 +---- .../perspective/dialog/CreateReleaseDialog.tsx | 14 ++++++-------- 12 files changed, 27 insertions(+), 20 deletions(-) rename packages/sanity/src/core/releases/{tool => }/components/ReleaseAvatar.tsx (100%) diff --git a/packages/sanity/src/core/index.ts b/packages/sanity/src/core/index.ts index 72f5bbe09a6d..f33c49bf5705 100644 --- a/packages/sanity/src/core/index.ts +++ b/packages/sanity/src/core/index.ts @@ -22,15 +22,22 @@ export * from './i18n' export * from './presence' export * from './preview' export { + AddedVersion, + CreatedRelease, + createReleaseId, DEFAULT_RELEASE_TYPE, getCreateVersionOrigin, getDocumentIsInPerspective, + getReleaseTone, LATEST, ReleaseActions, + ReleaseAvatar, ReleaseBadge, + ReleaseForm, ReleasesMenu, useDocumentVersions, usePerspective, + versionDocumentExists, } from './releases' export * from './scheduledPublishing' export * from './schema' diff --git a/packages/sanity/src/core/releases/tool/components/ReleaseAvatar.tsx b/packages/sanity/src/core/releases/components/ReleaseAvatar.tsx similarity index 100% rename from packages/sanity/src/core/releases/tool/components/ReleaseAvatar.tsx rename to packages/sanity/src/core/releases/components/ReleaseAvatar.tsx diff --git a/packages/sanity/src/core/releases/components/index.ts b/packages/sanity/src/core/releases/components/index.ts index e72380366439..32f1545df2dd 100644 --- a/packages/sanity/src/core/releases/components/index.ts +++ b/packages/sanity/src/core/releases/components/index.ts @@ -1,3 +1,5 @@ +export * from './dialog/ReleaseForm' export * from './panes/ReleaseActions' +export * from './ReleaseAvatar' export * from './ReleaseBadge' export * from './ReleasesMenu' diff --git a/packages/sanity/src/core/releases/index.ts b/packages/sanity/src/core/releases/index.ts index e0b008466832..6af55903a164 100644 --- a/packages/sanity/src/core/releases/index.ts +++ b/packages/sanity/src/core/releases/index.ts @@ -1,4 +1,7 @@ +export * from './__telemetry__/releases.telemetry' export * from './components' export * from './hooks' export * from './util/const' +export * from './util/createReleaseId' +export * from './util/getReleaseTone' export * from './util/util' diff --git a/packages/sanity/src/core/releases/navbar/ReleasesNav.tsx b/packages/sanity/src/core/releases/navbar/ReleasesNav.tsx index 77264661739b..95f01246342b 100644 --- a/packages/sanity/src/core/releases/navbar/ReleasesNav.tsx +++ b/packages/sanity/src/core/releases/navbar/ReleasesNav.tsx @@ -7,9 +7,9 @@ import {LATEST, ToolLink} from 'sanity' import {IntentLink, useRouterState} from 'sanity/router' import {Tooltip} from '../../../ui-components' +import {ReleaseAvatar} from '../components/ReleaseAvatar' import {usePerspective} from '../hooks/usePerspective' import {RELEASES_INTENT, RELEASES_TOOL_NAME} from '../plugin' -import {ReleaseAvatar} from '../tool/components/ReleaseAvatar' import {getReleaseTone} from '../util/getReleaseTone' import {GlobalPerspectiveMenu} from './GlobalPerspectiveMenu' diff --git a/packages/sanity/src/core/releases/tool/detail/ReleaseDashboardDetails.tsx b/packages/sanity/src/core/releases/tool/detail/ReleaseDashboardDetails.tsx index cd9188093ec2..ab4a56c776a2 100644 --- a/packages/sanity/src/core/releases/tool/detail/ReleaseDashboardDetails.tsx +++ b/packages/sanity/src/core/releases/tool/detail/ReleaseDashboardDetails.tsx @@ -14,9 +14,9 @@ import {format} from 'date-fns' import {useCallback} from 'react' import {type BundleDocument, usePerspective, useTranslation} from 'sanity' +import {ReleaseAvatar} from '../../components/ReleaseAvatar' import {releasesLocaleNamespace} from '../../i18n' import {getReleaseTone} from '../../util/getReleaseTone' -import {ReleaseAvatar} from '../components/ReleaseAvatar' import {ReleaseDetailsEditor} from './ReleaseDetailsEditor' export function ReleaseDashboardDetails({release}: {release: BundleDocument}) { diff --git a/packages/sanity/src/core/store/release/index.ts b/packages/sanity/src/core/store/release/index.ts index 950ca0e55101..f8dc7aaebca8 100644 --- a/packages/sanity/src/core/store/release/index.ts +++ b/packages/sanity/src/core/store/release/index.ts @@ -1,2 +1,3 @@ export * from './types' +export * from './useReleaseOperations' export * from './useReleases' diff --git a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/DocumentPerspectiveMenu.tsx b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/DocumentPerspectiveMenu.tsx index 88e109879fc4..33c593ee4c9e 100644 --- a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/DocumentPerspectiveMenu.tsx +++ b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/DocumentPerspectiveMenu.tsx @@ -1,18 +1,17 @@ import {Text} from '@sanity/ui' import {memo, useCallback} from 'react' import { + getReleaseTone, getVersionFromId, isVersionId, useDateTimeFormat, usePerspective, useReleases, useTranslation, + versionDocumentExists, } from 'sanity' +import {useDocumentPane, usePaneRouter} from 'sanity/structure' -import {versionDocumentExists} from '../../../../../../core/releases' -import {getReleaseTone} from '../../../../../../core/releases/util/getReleaseTone' -import {usePaneRouter} from '../../../../../components' -import {useDocumentPane} from '../../../useDocumentPane' import {VersionChip} from './VersionChip' export const DocumentPerspectiveMenu = memo(function DocumentPerspectiveMenu() { diff --git a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/VersionChip.tsx b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/VersionChip.tsx index 1c61847fbad9..c6db40395e69 100644 --- a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/VersionChip.tsx +++ b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/VersionChip.tsx @@ -3,7 +3,7 @@ import {memo, type MouseEvent, type ReactNode, useCallback, useMemo, useRef, use import {type BundleDocument, getVersionId} from 'sanity' import {styled} from 'styled-components' -import {ReleaseAvatar} from '../../../../../../core/releases/tool/components/ReleaseAvatar' +import {ReleaseAvatar} from '../../../../../../core/releases/components/ReleaseAvatar' import {Button, Popover, Tooltip} from '../../../../../../ui-components' import {VersionContextMenu} from './contextMenu/VersionContextMenu' import {CreateReleaseDialog} from './dialog/CreateReleaseDialog' diff --git a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/contextMenu/VersionContextMenu.tsx b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/contextMenu/VersionContextMenu.tsx index 824ac2c3ca9f..b17468523fd8 100644 --- a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/contextMenu/VersionContextMenu.tsx +++ b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/contextMenu/VersionContextMenu.tsx @@ -4,6 +4,7 @@ import {Menu, MenuDivider, Spinner, Stack} from '@sanity/ui' import {memo, useCallback} from 'react' import {filter, firstValueFrom} from 'rxjs' import { + AddedVersion, type BundleDocument, getCreateVersionOrigin, getPublishedId, @@ -17,7 +18,6 @@ import { import {IntentLink} from 'sanity/router' import {styled} from 'styled-components' -import {AddedVersion} from '../../../../../../../core/releases/__telemetry__/releases.telemetry' import {MenuGroup, MenuItem} from '../../../../../../../ui-components' import {VersionContextMenuItem} from './VersionContextMenuItem' diff --git a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/contextMenu/VersionContextMenuItem.tsx b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/contextMenu/VersionContextMenuItem.tsx index 5f89d1ee6560..a432a76fa8c4 100644 --- a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/contextMenu/VersionContextMenuItem.tsx +++ b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/contextMenu/VersionContextMenuItem.tsx @@ -1,10 +1,7 @@ /* eslint-disable i18next/no-literal-string */ import {Flex, Stack, Text} from '@sanity/ui' import {memo} from 'react' -import {type BundleDocument, useDateTimeFormat} from 'sanity' - -import {ReleaseAvatar} from '../../../../../../../core/releases/tool/components/ReleaseAvatar' -import {getReleaseTone} from '../../../../../../../core/releases/util/getReleaseTone' +import {type BundleDocument, getReleaseTone, ReleaseAvatar, useDateTimeFormat} from 'sanity' export const VersionContextMenuItem = memo(function VersionContextMenuItem(props: { release: BundleDocument diff --git a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/dialog/CreateReleaseDialog.tsx b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/dialog/CreateReleaseDialog.tsx index 16560430162b..47cfe00cd84e 100644 --- a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/dialog/CreateReleaseDialog.tsx +++ b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/dialog/CreateReleaseDialog.tsx @@ -3,6 +3,9 @@ import {type BadgeTone, Box, Flex, Text, useToast} from '@sanity/ui' import {useCallback, useState} from 'react' import {filter, firstValueFrom} from 'rxjs' import { + AddedVersion, + CreatedRelease, + createReleaseId, DEFAULT_RELEASE_TYPE, type FormBundleDocument, getCreateVersionOrigin, @@ -12,20 +15,15 @@ import { isVersionId, LoadingBlock, Preview, + ReleaseAvatar, + ReleaseForm, useDocumentOperation, useDocumentStore, usePerspective, + useReleaseOperations, useSchema, } from 'sanity' -import { - AddedVersion, - CreatedRelease, -} from '../../../../../../../core/releases/__telemetry__/releases.telemetry' -import {ReleaseForm} from '../../../../../../../core/releases/components/dialog/ReleaseForm' -import {ReleaseAvatar} from '../../../../../../../core/releases/tool/components/ReleaseAvatar' -import {createReleaseId} from '../../../../../../../core/releases/util/createReleaseId' -import {useReleaseOperations} from '../../../../../../../core/store/release/useReleaseOperations' import {Dialog} from '../../../../../../../ui-components' export function CreateReleaseDialog(props: {