import { __, _x } from '@wordpress/i18n' import classnames from 'classnames' import React, { useState } from 'react' import { isLicensed, shouldShowUpsell } from '../../utils/screen' import { buildUrl, fetchQueryParam } from '../../utils/urls' import { BlueprintIcon, CommunityIcon, LibraryIcon, SettingsIcon, SnippetsIcon } from './icons/ToolbarIcons' import { UpsellDialog } from './UpsellDialog' import type { ReactNode } from 'react' export const SUBPAGES = ['snippets', 'blueprints', 'cloud-community', 'cloud-library'] as const interface NavLink { name: string url?: string label: string external?: boolean icon?: ReactNode pro?: boolean pageSlug?: string subpage?: typeof SUBPAGES[number] end?: boolean } const UPPER_NAV_LINKS: readonly NavLink[] = [ { name: 'docs', url: 'https://codesnippets.pro/docs', label: __('Docs', 'code-snippets'), external: true }, { name: 'cloud', url: 'https://codesnippets.cloud/', label: __('Cloud Dashboard', 'code-snippets'), external: true }, { name: 'welcome', url: window.CODE_SNIPPETS?.urls.welcome, label: __("What's New", 'code-snippets'), pageSlug: 'code-snippets-welcome' }, { name: 'import-snippets', url: window.CODE_SNIPPETS?.urls.import, label: _x('Import', 'snippets', 'code-snippets'), pageSlug: 'import-code-snippets' } ] const LOWER_NAV_LINKS: readonly NavLink[] = [ { name: 'snippets', url: window.CODE_SNIPPETS?.urls.manage, label: __('Snippets', 'code-snippets'), icon: