import { __ } from '@wordpress/i18n' import React, { useId } from 'react' import Select from 'react-select' import { useSnippetForm } from '../WithSnippetFormContext' import { SNIPPET_TYPE_SCOPES } from '../../../../types/Snippet' import { SNIPPET_SCOPE_DESCRIPTIONS, SNIPPET_SCOPE_ICONS, getSnippetType, isCondition } from '../../../../utils/snippets/snippets' import type { SnippetCodeScope } from '../../../../types/Snippet' import type { SelectOption } from '../../../../types/SelectOption' export const SnippetLocationInput: React.FC = () => { const { snippet, setSnippet, isReadOnly } = useSnippetForm() const locationId = useId() const options: SelectOption[] = SNIPPET_TYPE_SCOPES[getSnippetType(snippet)] .filter(scope => 'condition' !== scope) .map(scope => ({ key: scope, value: scope, label: SNIPPET_SCOPE_DESCRIPTIONS[scope] })) return isCondition(snippet) ? null :