77 type ScopeType ,
88 type SimpleScopeTypeType ,
99} from "@cursorless/common" ;
10- import React from "react" ;
10+ import React , { useState } from "react" ;
1111
1212export function MissingLanguageScopes ( ) : React . JSX . Element [ ] {
1313 return Object . keys ( languageScopeSupport )
@@ -36,6 +36,11 @@ function Language({
3636 return (
3737 < >
3838 < h3 > { languageId } </ h3 >
39+ < p >
40+ < a href = { `../../user/languages/${ languageId } ` } >
41+ languages/{ languageId }
42+ </ a >
43+ </ p >
3944 { renderFacets ( "Unsupported" , unsupportedFacets ) }
4045 { renderFacets ( "Unspecified" , unspecifiedFacets ) }
4146 </ >
@@ -46,6 +51,8 @@ function renderFacets(
4651 title : string ,
4752 facets : ScopeSupportFacet [ ] ,
4853) : React . JSX . Element | null {
54+ const [ open , setOpen ] = useState ( false ) ;
55+
4956 const scopes = Array . from (
5057 new Set (
5158 facets . map ( ( f ) =>
@@ -58,15 +65,30 @@ function renderFacets(
5865 return null ;
5966 }
6067
68+ const renderBody = ( ) => {
69+ if ( ! open ) {
70+ return null ;
71+ }
72+
73+ return (
74+ < div className = "card__body" >
75+ < ul >
76+ { scopes . map ( ( scope ) => {
77+ return < li key = { scope } > { scope } </ li > ;
78+ } ) }
79+ </ ul >
80+ </ div >
81+ ) ;
82+ } ;
83+
6184 return (
62- < >
63- { title } ({ scopes . length } )
64- < ul >
65- { scopes . map ( ( scope ) => {
66- return < li key = { scope } > { scope } </ li > ;
67- } ) }
68- </ ul >
69- </ >
85+ < div className = { "card" + ( open ? " open" : "" ) } >
86+ < div className = "card__header pointer" onClick = { ( ) => setOpen ( ! open ) } >
87+ { title } ({ scopes . length } )
88+ </ div >
89+
90+ { renderBody ( ) }
91+ </ div >
7092 ) ;
7193}
7294
0 commit comments