Skip to main content
Glama
KeyPathBreadcrumb.tsx1.3 kB
import { camelCaseToSentence } from '@intlayer/config/client'; import type { KeyPath, Locale } from '@intlayer/types'; import type { FC } from 'react'; import { Breadcrumb, type BreadcrumbLink } from '../Breadcrumb'; type KeyPathBreadcrumbProps = { dictionaryKey: string; keyPath: KeyPath[]; onClickKeyPath: (keyPath: KeyPath[]) => void; locale?: Locale; }; export const KeyPathBreadcrumb: FC<KeyPathBreadcrumbProps> = ({ keyPath, dictionaryKey, onClickKeyPath, locale, }) => { const formattedKeyPath: BreadcrumbLink[] = [ { text: camelCaseToSentence(dictionaryKey), onClick: () => onClickKeyPath([]), }, ...keyPath.map((el, index) => ({ onClick: () => onClickKeyPath( keyPath // With keyPath = [{type: NodeType.Object, key: '0'}, {type: NodeType.Array, key: '0'}, {type: NodeType.Object, key: '1'}] // If index is 0 -> onFocusKeyPath([{type: NodeType.Object, key: '0'}]) // If index is 1 -> onFocusKeyPath([{type: NodeType.Object, key: '0'}, {type: NodeType.Array, key: '0'}]) .slice(0, index + 1) ), text: el.key?.toString() ?? '', })), ]; return ( <Breadcrumb links={formattedKeyPath} locale={locale} elementType="location" /> ); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aymericzip/intlayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server