File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,19 @@ const sections: SidebarSection[] = [
8787 } ,
8888]
8989
90+ const FREQUENTLY_USED_IDS = new Set ( [
91+ 'auth' ,
92+ 'rate-limits' ,
93+ 'get-user' ,
94+ 'get-repo' ,
95+ 'list-repos' ,
96+ 'get-readme' ,
97+ 'list-commits' ,
98+ 'list-issues' ,
99+ 'list-prs' ,
100+ 'repo-views' ,
101+ ] )
102+
90103interface SidebarProps {
91104 selectedId ?: string
92105 onSelectItem : ( id : string ) => void
@@ -109,12 +122,16 @@ export function Sidebar({ selectedId = 'intro', onSelectItem }: SidebarProps) {
109122 setExpandedSections ( newExpanded )
110123 }
111124
112- const filteredSections = sections
125+ const displaySections = frequentlyUsed ? sections : sections
126+
127+ const filteredSections = displaySections
113128 . map ( ( section ) => ( {
114129 ...section ,
115- items : section . items . filter ( ( item ) =>
116- item . label . toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) )
117- ) ,
130+ items : section . items . filter ( ( item ) => {
131+ const matchesSearch = item . label . toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) )
132+ const isFrequent = frequentlyUsed ? FREQUENTLY_USED_IDS . has ( item . id ) : true
133+ return matchesSearch && isFrequent
134+ } ) ,
118135 } ) )
119136 . filter (
120137 ( section ) =>
You can’t perform that action at this time.
0 commit comments