MCPcopy Create free account
hub / github.com/effector/effector / getLocalizedPanelSidebar

Function getLocalizedPanelSidebar

documentation/src/navigation.ts:243–300  ·  view source on GitHub ↗
(slug: string, lang: string)

Source from the content-addressed store, hash-verified

241};
242
243export async function getLocalizedPanelSidebar(slug: string, lang: string) {
244 const sidebar = [...PANEL_ITEMS, ...PANEL_FRAMEWORK_ITEMS];
245
246 const slugs = await getSlugs();
247
248 const localizedSidebars = sidebar.map(({ items, id }) => {
249 const sidebarItems = items.map((group) => {
250 const groupTitle = getTextLocalized(group, lang);
251 return {
252 title: groupTitle,
253 collapsed: group.collapsed,
254 items: group.items.map((item) => {
255 const itemTitle = getTextLocalized(item, lang);
256
257 if (isExternal(item)) {
258 return {
259 title: itemTitle,
260 link: item.link,
261 };
262 }
263
264 const link = createLink(item, lang);
265
266 // Translated page exists
267 if (slugs.has(link.toLowerCase())) {
268 return {
269 title: itemTitle,
270 link,
271 };
272 }
273
274 // If original page exists
275 const originalLink = createLink(item, SITE.defaultLanguage);
276 if (slugs.has(originalLink.toLowerCase())) {
277 return {
278 title: `${itemTitle}`,
279 link,
280 isFallback: true,
281 };
282 }
283
284 // If no original page exists, may be link is wrong?
285 return {
286 title: `${itemTitle} (404)`,
287 link: item.link,
288 };
289 }),
290 };
291 });
292
293 return {
294 sidebarItems,
295 panelId: id,
296 };
297 });
298
299 return localizedSidebars;
300}

Callers

nothing calls this directly

Calls 5

getTextLocalizedFunction · 0.90
isExternalFunction · 0.90
createLinkFunction · 0.90
getSlugsFunction · 0.85
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…