Skip to content

Commit

Permalink
For the first level 1 guide only the level 2 guides should be displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarah committed Dec 2, 2024
1 parent a33f818 commit 6dcfd60
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ type Guide = {
* - Each level 1 guide's seeAlso contains level 2 guides.
* - Each level 2 guide's seeAlso may contain level 1, level 2, and level 3 guides.
* - Level 3 guides should only be shown once across all level 2 guides.
* - The first level 1 guide only shows the level 2 guides.
*/
export const filterLevel3Guides = (topLevel: Guide): Guide => {
const displayedLevel3Guides = new Set<string>();

// For the first level 1 guide only the level 2 guides should be displayed
if (topLevel.seeAlso && topLevel.seeAlso[0]) {
topLevel.seeAlso[0].seeAlso = topLevel.seeAlso[0].seeAlso?.map(guide => {
guide.seeAlso = undefined;
return guide;
});
}

topLevel.seeAlso?.forEach(level1Guide => {
level1Guide.seeAlso?.forEach(level2Guide => {
const filteredSeeAlso =
Expand Down

0 comments on commit 6dcfd60

Please sign in to comment.