Compare commits
4 Commits
feat/gloss
...
feat/gloss
| Author | SHA1 | Date | |
|---|---|---|---|
| 36bb47f9c6 | |||
| b2ca1f17a4 | |||
| ad545b52af | |||
| 467c07232e |
@@ -510,13 +510,24 @@ export function getGlossarySmartNavigation(
|
|||||||
): GlossarySmartNavigation {
|
): GlossarySmartNavigation {
|
||||||
const currentSlug = slugOfGlossaryEntry(currentEntry);
|
const currentSlug = slugOfGlossaryEntry(currentEntry);
|
||||||
const rawNavigation = currentEntry.data.navigation;
|
const rawNavigation = currentEntry.data.navigation;
|
||||||
const defaultNavigation = GLOSSARY_NAV_DEFAULTS[familyOf(currentEntry)];
|
const defaultNavigation = GLOSSARY_NAV_DEFAULTS[familyOf(currentEntry)] ?? {};
|
||||||
|
|
||||||
const navigationSource = rawNavigation ?? {
|
const withDefaultPath = (
|
||||||
primaryNext: undefined,
|
explicit: string[] | undefined,
|
||||||
primaryReason: undefined,
|
fallback: string[] | undefined,
|
||||||
paths: defaultNavigation ?? {},
|
): string[] => (explicit && explicit.length > 0 ? explicit : fallback ?? []);
|
||||||
flows: {},
|
|
||||||
|
const navigationSource = {
|
||||||
|
primaryNext: rawNavigation?.primaryNext,
|
||||||
|
primaryReason: rawNavigation?.primaryReason,
|
||||||
|
paths: {
|
||||||
|
understand: withDefaultPath(rawNavigation?.paths?.understand, defaultNavigation.understand),
|
||||||
|
deepen: withDefaultPath(rawNavigation?.paths?.deepen, defaultNavigation.deepen),
|
||||||
|
compare: withDefaultPath(rawNavigation?.paths?.compare, defaultNavigation.compare),
|
||||||
|
apply: withDefaultPath(rawNavigation?.paths?.apply, defaultNavigation.apply),
|
||||||
|
},
|
||||||
|
flows: rawNavigation?.flows ?? {},
|
||||||
|
relationWeights: rawNavigation?.relationWeights ?? {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const primaryNext = resolveGlossaryEntriesInSourceOrder(
|
const primaryNext = resolveGlossaryEntriesInSourceOrder(
|
||||||
|
|||||||
Reference in New Issue
Block a user