-
Notifications
You must be signed in to change notification settings - Fork 313
Expand file tree
/
Copy pathshortcutReference.ts
More file actions
21 lines (17 loc) · 1022 Bytes
/
shortcutReference.ts
File metadata and controls
21 lines (17 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { planReviewSurface, annotateSurface } from '../../../../packages/editor/shortcuts';
import { codeReviewSurface } from '../../../../packages/review-editor/shortcuts';
import { listRegistryShortcutSections } from '../../../../packages/ui/shortcuts';
import type { ShortcutSurface } from '../../../../packages/ui/shortcuts';
const slugify = (value: string) => value.toLowerCase().replace(/\s+/g, '-');
const allSurfaces: ShortcutSurface[] = [planReviewSurface, annotateSurface, codeReviewSurface];
export const shortcutReferenceSurfaces = allSurfaces.map((surface) => ({
...surface,
sections: listRegistryShortcutSections(surface.registry).map((section) => ({
...section,
slug: `${surface.slug}-${slugify(section.title)}`,
})),
}));
export const shortcutReferenceHeadings = shortcutReferenceSurfaces.flatMap((surface) => [
{ depth: 2 as const, slug: surface.slug, text: surface.title },
...surface.sections.map((section) => ({ depth: 3 as const, slug: section.slug, text: section.title })),
]);