Skip to content

Commit

Permalink
fix: improve perspectives handling
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Dec 4, 2024
1 parent 729c535 commit cc4e393
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
1 change: 0 additions & 1 deletion packages/presentation/src/preview/PreviewHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ const PreviewHeaderDefault: FunctionComponent<Omit<PreviewHeaderProps, 'renderDe
canUseSharedPreviewAccess={canUseSharedPreviewAccess}
previewLocationRoute={previewLocationRoute}
initialUrl={initialUrl}
// @ts-expect-error - this is fine
perspective={perspective}
/>
</Flex>
Expand Down
13 changes: 10 additions & 3 deletions packages/presentation/src/preview/SharePreviewMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {SyncTag} from '@sanity/client'
import type {ClientPerspective, SyncTag} from '@sanity/client'
import {CopyIcon, ShareIcon} from '@sanity/icons'
import {SanityMonogram} from '@sanity/logos'
import {fetchSharedAccessQuery} from '@sanity/preview-url-secret/constants'
Expand Down Expand Up @@ -38,7 +38,7 @@ export interface SharePreviewMenuProps {
canUseSharedPreviewAccess: boolean
previewLocationRoute: string
initialUrl: PreviewProps['initialUrl']
perspective: string
perspective: ClientPerspective
}

const QrCodeLogoSize = 24
Expand Down Expand Up @@ -79,7 +79,14 @@ export const SharePreviewMenu = memo(function SharePreviewMenuComponent(
const busy = enabling || disabling || loading
const url = useMemo(
() =>
secret ? setSecretSearchParams(initialUrl, secret, previewLocationRoute, perspective) : null,
secret
? setSecretSearchParams(
initialUrl,
secret,
previewLocationRoute,
Array.isArray(perspective) ? perspective.join(',') : perspective,
)
: null,
[initialUrl, perspective, previewLocationRoute, secret],
)

Expand Down
24 changes: 12 additions & 12 deletions packages/visual-editing/src/ui/ElementOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
type ReactElement,
} from 'react'
import scrollIntoView from 'scroll-into-view-if-needed'
import {styled} from 'styled-components'
import {keyframes, styled} from 'styled-components'
import {PointerEvents} from '../overlay-components/components/PointerEvents'
import type {
ElementFocusedState,
Expand Down Expand Up @@ -147,21 +147,21 @@ const Labels = styled(Flex)`
}
`

const Releases = styled.div`
opacity: 0;
animation: o 300ms 500ms ease forwards;
@keyframes o {
from {
opacity: 0%;
}
const ReleasesKeyframes = keyframes`
from {
opacity: 0%;
}
to {
opacity: 100%;
}
to {
opacity: 100%;
}
`

const Releases = styled.div`
opacity: 0;
animation: ${ReleasesKeyframes} 300ms 500ms ease forwards;
`

function createIntentLink(node: SanityNode) {
const {id, type, path, baseUrl, tool, workspace} = node

Expand Down

0 comments on commit cc4e393

Please sign in to comment.