Skip to content

Commit

Permalink
add naming map to allow customization of sdk ref names
Browse files Browse the repository at this point in the history
  • Loading branch information
0div committed Nov 27, 2024
1 parent e24e530 commit 99bba4c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/app/(docs)/docs/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CodeInterpreting } from '@/components/CodeInterpreting'
<HeroPattern />

# E2B Documentation
Here you'll find all the guides, concepts, and SDK reference for developing with E2B.
Here you'll find all the guides, concepts, and SDK references for developing with E2B.

<CodeGroup isTerminalCommand>
```bash {{ language: 'js' }}
Expand Down
41 changes: 29 additions & 12 deletions apps/web/src/components/Navigation/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,17 +449,34 @@ export const docRoutes: NavGroup[] = [
// },
]

const sdkRefNameMap = {
'JS-SDK': 'JavaScript SDK',
'PYTHON-SDK': 'Python SDK',
'DESKTOP-JS-SDK': 'Desktop JavaScript SDK',
'DESKTOP-PYTHON-SDK': 'Desktop Python SDK',
'CODE-INTERPRETER-JS-SDK': 'Code Interpreter JavaScript SDK',
'CODE-INTERPRETER-PYTHON-SDK': 'Code Interpreter Python SDK',
}

export const sdkRefRoutes: VersionedNavGroup[] = (
sdkRefRoutesJson as VersionedNavGroup[]
).sort((a, b) => {
const order = {
CLI: 1,
'JS-SDK': 2,
'PYTHON-SDK': 3,
'DESKTOP-JS-SDK': 4,
'DESKTOP-PYTHON-SDK': 5,
}
const aOrder = order[a.title || ''] || 999
const bOrder = order[b.title || ''] || 999
return aOrder - bOrder
})
)
.sort((a, b) => {
const order = {
CLI: 1,
'JS-SDK': 2,
'PYTHON-SDK': 3,
'DESKTOP-JS-SDK': 4,
'DESKTOP-PYTHON-SDK': 5,
}
const aOrder = order[a.title || ''] || 999
const bOrder = order[b.title || ''] || 999
return aOrder - bOrder
})
.map((group) => ({
...group,
title:
group?.title && sdkRefNameMap[group.title]
? sdkRefNameMap[group.title]
: group.title,
}))

0 comments on commit 99bba4c

Please sign in to comment.