Skip to content

Commit

Permalink
chore: removes test code
Browse files Browse the repository at this point in the history
  • Loading branch information
snorrees committed Oct 20, 2024
1 parent e5fd3d3 commit c89eeef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export function StartInCreateAction(
content: (
<StartInCreateDialog
onLinkingStarted={linkingStarted}
publicId={id}
createLinkId={createLinkId}
appId={appId}
type={type}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@ import {Box, Checkbox, Flex, Stack, Text, useToast} from '@sanity/ui'
import {useCallback, useEffect, useId, useState} from 'react'

import {Button} from '../../../ui-components'
import {set, toMutationPatches} from '../../form'
import {useDocumentOperation} from '../../hooks'
import {useTranslation} from '../../i18n'
import {useWorkspace} from '../../studio'
import {CreateLearnMoreButton} from '../components/CreateLearnMoreButton'
import {StartInCreateSvg} from '../components/media/StartInCreateSvg'
import {createLocaleNamespace} from '../i18n'
import {type CreateLinkMetadata} from '../types'
import {getCreateLinkUrl} from '../useCreateDocumentUrl'
import {useGlobalUserId} from '../useGlobalUserId'
import {useSanityCreateTelemetry} from '../useSanityCreateTelemetry'

export const CREATE_LINK_TARGET = 'create'

export interface StartInCreateDialogProps {
publicId: string
createLinkId: string
appId: string
type: string
Expand All @@ -27,16 +23,14 @@ export interface StartInCreateDialogProps {
}

export function StartInCreateDialog(props: StartInCreateDialogProps) {
const {publicId, createLinkId, appId, type, onLinkingStarted, autoConfirm} = props
const {createLinkId, appId, type, onLinkingStarted, autoConfirm} = props
const {t} = useTranslation(createLocaleNamespace)
const checkboxId = useId()
const [dontShowAgain, setDontShowAgain] = useState(false)

const telemetry = useSanityCreateTelemetry()
const toggleDontShowAgain = useCallback(() => setDontShowAgain((current) => !current), [])

const {patch} = useDocumentOperation(publicId, type)

const {push: pushToast} = useToast()
const globalUserId = useGlobalUserId()
const workspace = useWorkspace()
Expand All @@ -62,25 +56,7 @@ export function StartInCreateDialog(props: StartInCreateDialogProps) {
window?.open(createUrl, CREATE_LINK_TARGET)?.focus()
onLinkingStarted(autoConfirm || dontShowAgain)
telemetry.startInCreateAccepted()

//@todo delete me
setTimeout(() => {
patch.execute(
toMutationPatches([
set(
{
_id: 'dummy',
userId: 'dummy',
host: 'dummy',
ejected: false,
dataset: 'dummy',
} satisfies CreateLinkMetadata,
['_create'],
),
]),
)
}, 10000)
}, [patch, createUrl, onLinkingStarted, pushToast, t, dontShowAgain, autoConfirm, telemetry])
}, [createUrl, onLinkingStarted, pushToast, t, dontShowAgain, autoConfirm, telemetry])

useEffect(() => {
if (autoConfirm && createUrl) {
Expand Down

0 comments on commit c89eeef

Please sign in to comment.